[LIB]: Fix breakage introduced when supporting DW_AT_specification in structs

Heck, anonymous structs are nothing new, things like:

typedef struct {
	int bar;
} baz;

Are ugly, but valid. So if ->name is NULL and ->specification is 0, its an
anonymous struct, don't go looking for dwarf offset 0, that is "void", not
something a DW_AT_specification is supposed to point to 8)

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
This commit is contained in:
Arnaldo Carvalho de Melo 2007-05-26 15:47:39 -03:00
parent c15d8d700c
commit 904b882c62
1 changed files with 4 additions and 2 deletions

View File

@ -432,8 +432,10 @@ static struct type *type__new(Dwarf_Die *die)
const char *type__name(struct type *self, const struct cu *cu)
{
/* Check if the tag doesn't comes with a DW_AT_name attribute... */
if (self->namespace.name == NULL && cu != NULL) {
/* No? So it must have a DW_TAG_specification... */
if (self->namespace.name == NULL &&
/* No? So it can have a DW_TAG_specification... */
self->specification != 0 &&
cu != NULL) {
struct tag *tag = cu__find_tag_by_id(cu, self->specification);
if (tag == NULL) {
tag__id_not_found(&self->namespace.tag, self->specification);