enumeration: type->size for enumerations is in bits, not in bytes

I have to normalize this so that we don't have this special case, but
since we can have enum bitfields....

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2009-03-18 23:01:32 -03:00
parent bcf24ef40f
commit eb0284c619
3 changed files with 5 additions and 3 deletions

View File

@ -600,7 +600,7 @@ static int create_new_enumeration(struct ctf_state *sp, void *ptr,
struct type *enumeration = type__new(DW_TAG_enumeration_type,
ctf_string(ctf__get32(sp->ctf,
&tp->base.ctf_name), sp),
sizeof(int)); /* FIXME: is this always the case? */
sizeof(int) * 8); /* FIXME: is this always the case? */
if (enumeration == NULL)
oom("enumeration");

View File

@ -1033,6 +1033,8 @@ static struct tag *die__create_new_enumeration(Dwarf_Die *die)
if (enumeration->size == 0)
enumeration->size = sizeof(int) * 8;
else
enumeration->size *= 8;
if (!dwarf_haschildren(die) || dwarf_child(die, &child) != 0) {
/* Seen on libQtCore.so.4.3.4.debug,

View File

@ -344,7 +344,7 @@ reevaluate:
}
goto reevaluate;
case DW_TAG_enumeration_type:
member_size = tag__type(type)->size;
member_size = tag__type(type)->size / 8;
break;
}
@ -924,7 +924,7 @@ size_t tag__size(const struct tag *self, const struct cu *cu)
case DW_TAG_pointer_type:
case DW_TAG_reference_type: return cu->addr_size;
case DW_TAG_base_type: return base_type__size(self);
case DW_TAG_enumeration_type: return tag__type(self)->size;
case DW_TAG_enumeration_type: return tag__type(self)->size / 8;
}
if (self->type == 0) { /* struct class: unions, structs */