[LIB]: Support DW_AT_accessibility and DW_AT_virtuality

So that in DW_TAG_inheritance we can should "virtual", "virtual public", etc.

This has yet to be supported for normal class members, constructors, etc.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
This commit is contained in:
Arnaldo Carvalho de Melo 2007-05-24 13:57:08 -03:00
parent 25c2b7a095
commit 5463bc5419
2 changed files with 19 additions and 0 deletions

View File

@ -1016,6 +1016,8 @@ static struct class_member *class_member__new(Dwarf_Die *die)
self->offset = attr_offset(die);
self->bit_size = attr_numeric(die, DW_AT_bit_size);
self->bit_offset = attr_numeric(die, DW_AT_bit_offset);
self->accessibility = attr_numeric(die, DW_AT_accessibility);
self->virtuality = attr_numeric(die, DW_AT_virtuality);
self->name = strings__add(attr_string(die, DW_AT_name));
}
@ -2016,6 +2018,7 @@ size_t class__fprintf(const struct class *self, const struct cu *cu,
/* First look if we have DW_TAG_inheritance */
type__for_each_tag(tself, tag_pos) {
struct tag *type;
if (tag_pos->tag != DW_TAG_inheritance)
continue;
@ -2025,6 +2028,20 @@ size_t class__fprintf(const struct class *self, const struct cu *cu,
} else
printed += fprintf(fp, ",");
pos = tag__class_member(tag_pos);
if (pos->virtuality == DW_VIRTUALITY_virtual)
printed += fprintf(fp, " virtual");
switch (pos->accessibility) {
case DW_ACCESS_public:
printed += fprintf(fp, " public"); break;
case DW_ACCESS_private:
printed += fprintf(fp, " private"); break;
case DW_ACCESS_protected:
printed += fprintf(fp, " protected"); break;
}
type = cu__find_tag_by_id(cu, tag_pos->type);
printed += fprintf(fp, " %s", type__name(tag__type(type)));
}

View File

@ -211,6 +211,8 @@ struct class_member {
uint8_t bit_hole; /* If there is a bit hole before the next
one (or the end of the struct) */
uint8_t visited:1;
uint8_t accessibility:2; /* DW_ACCESS_{public,protected,private} */
uint8_t virtuality:2; /* DW_VIRTUALITY_{none,virtual,pure_virtual} */
uint16_t hole; /* If there is a hole before the next
one (or the end of the struct) */
};