diff options
author | Daniel Jacobowitz <drow@false.org> | 2009-11-12 19:05:28 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2009-11-12 19:05:28 +0000 |
commit | 7d0ccb613385c0bbba25479f37003944772d3b90 (patch) | |
tree | 6524415ea9fff4f7c33b8165867cd37c0970183a /gdb/dwarf2read.c | |
parent | 328c9494f5b05541265b4cb8db8702479299c24e (diff) | |
download | gdb-7d0ccb613385c0bbba25479f37003944772d3b90.zip gdb-7d0ccb613385c0bbba25479f37003944772d3b90.tar.gz gdb-7d0ccb613385c0bbba25479f37003944772d3b90.tar.bz2 |
2009-11-12 Paul Brook <paul@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* dwarf2read.c (struct field_info): Add baseclasses.
(dwarf2_add_field): Add base classes to a separate list.
(dwarf2_attach_fields_to_type): Merge base classes and fields.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index e856a4b..8ba61b1 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -639,9 +639,9 @@ struct field_info int virtuality; struct field field; } - *fields; + *fields, *baseclasses; - /* Number of fields. */ + /* Number of fields (including baseclasses). */ int nfields; /* Number of baseclasses. */ @@ -4357,8 +4357,17 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, new_field = (struct nextfield *) xmalloc (sizeof (struct nextfield)); make_cleanup (xfree, new_field); memset (new_field, 0, sizeof (struct nextfield)); - new_field->next = fip->fields; - fip->fields = new_field; + + if (die->tag == DW_TAG_inheritance) + { + new_field->next = fip->baseclasses; + fip->baseclasses = new_field; + } + else + { + new_field->next = fip->fields; + fip->fields = new_field; + } fip->nfields++; /* Handle accessibility and virtuality of field. @@ -4581,8 +4590,21 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type, up in the same order in the array in which they were added to the list. */ while (nfields-- > 0) { - TYPE_FIELD (type, nfields) = fip->fields->field; - switch (fip->fields->accessibility) + struct nextfield *fieldp; + + if (fip->fields) + { + fieldp = fip->fields; + fip->fields = fieldp->next; + } + else + { + fieldp = fip->baseclasses; + fip->baseclasses = fieldp->next; + } + + TYPE_FIELD (type, nfields) = fieldp->field; + switch (fieldp->accessibility) { case DW_ACCESS_private: SET_TYPE_FIELD_PRIVATE (type, nfields); @@ -4599,13 +4621,13 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type, /* Unknown accessibility. Complain and treat it as public. */ { complaint (&symfile_complaints, _("unsupported accessibility %d"), - fip->fields->accessibility); + fieldp->accessibility); } break; } if (nfields < fip->nbaseclasses) { - switch (fip->fields->virtuality) + switch (fieldp->virtuality) { case DW_VIRTUALITY_virtual: case DW_VIRTUALITY_pure_virtual: @@ -4613,7 +4635,6 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type, break; } } - fip->fields = fip->fields->next; } } |