Skip to content

dwarves: support DW_TAG_atomic_type #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dwarf_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,8 @@ static int tag__recode_dwarf_bitfield(struct tag *tag, struct cu *cu, uint16_t b
break;

case DW_TAG_const_type:
case DW_TAG_volatile_type: {
case DW_TAG_volatile_type:
case DW_TAG_atomic_type: {
const struct dwarf_tag *dtag = tag->priv;
struct dwarf_tag *dtype = dwarf_cu__find_type_by_ref(cu->priv, &dtag->type);

Expand Down Expand Up @@ -1990,6 +1991,7 @@ static struct tag *__die__process_tag(Dwarf_Die *die, struct cu *cu,
case DW_TAG_restrict_type:
case DW_TAG_unspecified_type:
case DW_TAG_volatile_type:
case DW_TAG_atomic_type:
tag = die__create_new_tag(die, cu); break;
case DW_TAG_pointer_type:
tag = die__create_new_pointer_tag(die, cu, conf); break;
Expand Down
3 changes: 2 additions & 1 deletion dwarves.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ struct class_member *
case DW_TAG_const_type:
case DW_TAG_typedef:
case DW_TAG_rvalue_reference_type:
case DW_TAG_volatile_type: {
case DW_TAG_volatile_type:
case DW_TAG_atomic_type: {
struct tag *tag = cu__type(cu, type->type);
if (tag == NULL) {
tag__id_not_found_fprintf(stderr, type->type);
Expand Down
9 changes: 8 additions & 1 deletion dwarves.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,11 @@ static inline bool tag__is_volatile(const struct tag *tag)
return tag->tag == DW_TAG_volatile_type;
}

static inline bool tag__is_atomic(const struct tag *tag)
{
return tag->tag == DW_TAG_atomic_type;
}

static inline bool tag__is_restrict(const struct tag *tag)
{
return tag->tag == DW_TAG_restrict_type;
Expand All @@ -496,7 +501,8 @@ static inline int tag__is_modifier(const struct tag *tag)
{
return tag__is_const(tag) ||
tag__is_volatile(tag) ||
tag__is_restrict(tag);
tag__is_restrict(tag) ||
tag__is_atomic(tag);
}

static inline bool tag__has_namespace(const struct tag *tag)
Expand Down Expand Up @@ -539,6 +545,7 @@ static inline int tag__is_tag_type(const struct tag *tag)
tag->tag == DW_TAG_subroutine_type ||
tag->tag == DW_TAG_unspecified_type ||
tag->tag == DW_TAG_volatile_type ||
tag->tag == DW_TAG_atomic_type ||
tag->tag == DW_TAG_LLVM_annotation;
}

Expand Down
1 change: 1 addition & 0 deletions dwarves_emit.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ static int tag__emit_definitions(struct tag *tag, struct cu *cu,
case DW_TAG_array_type:
case DW_TAG_const_type:
case DW_TAG_volatile_type:
case DW_TAG_atomic_type:
type = cu__type(cu, type->type);
if (type == NULL)
return 0;
Expand Down
3 changes: 3 additions & 0 deletions dwarves_fprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ static const char *dwarf_tag_names[] = {
[DW_TAG_skeleton_unit] = "skeleton_unit",
[DW_TAG_immutable_type] = "immutable_type",
#endif
[DW_TAG_atomic_type] = "atomic_type",
};

static const char *dwarf_gnu_tag_names[] = {
Expand Down Expand Up @@ -562,6 +563,7 @@ static const char *__tag__name(const struct tag *tag, const struct cu *cu,
case DW_TAG_volatile_type:
case DW_TAG_const_type:
case DW_TAG_restrict_type:
case DW_TAG_atomic_type:
case DW_TAG_unspecified_type:
type = cu__type(cu, tag->type);
if (type == NULL && tag->type != 0)
Expand All @@ -576,6 +578,7 @@ static const char *__tag__name(const struct tag *tag, const struct cu *cu,
case DW_TAG_volatile_type: prefix = "volatile "; break;
case DW_TAG_const_type: prefix = "const "; break;
case DW_TAG_restrict_type: suffix = " restrict"; break;
case DW_TAG_atomic_type: prefix = "_Atomic "; break;
}
snprintf(bf, len, "%s%s%s ", prefix, type_str, suffix);
}
Expand Down