diff --git a/dwarf_loader.c b/dwarf_loader.c index 7148176..40ac80b 100644 --- a/dwarf_loader.c +++ b/dwarf_loader.c @@ -777,7 +777,7 @@ static int tag__recode_dwarf_bitfield(struct tag *tag, struct cu *cu, uint16_t b * the dwarf_cu as in dwarf there are no such things * as base_types of less than 8 bits, etc. */ - recoded = cu__find_base_type_by_sname_and_size(cu, sname, bit_size, &short_id); + recoded = cu__find_base_type_by_name_and_size(cu, name, bit_size, &short_id); if (recoded != NULL) return short_id; diff --git a/dwarves.c b/dwarves.c index ff66c93..2b913c6 100644 --- a/dwarves.c +++ b/dwarves.c @@ -731,23 +731,22 @@ struct tag *cu__find_base_type_by_name(const struct cu *cu, return NULL; } -struct tag *cu__find_base_type_by_sname_and_size(const struct cu *cu, - strings_t sname, - uint16_t bit_size, - type_id_t *idp) +struct tag *cu__find_base_type_by_name_and_size(const struct cu *cu, const char *name, + uint16_t bit_size, type_id_t *idp) { uint32_t id; struct tag *pos; - if (sname == 0) + if (name == NULL) return NULL; cu__for_each_type(cu, id, pos) { if (pos->tag == DW_TAG_base_type) { const struct base_type *bt = tag__base_type(pos); + char bf[64]; if (bt->bit_size == bit_size && - bt->name == sname) { + strcmp(base_type__name(bt, cu, bf, sizeof(bf)), name) == 0) { if (idp != NULL) *idp = id; return pos; diff --git a/dwarves.h b/dwarves.h index 37ddb43..88a754c 100644 --- a/dwarves.h +++ b/dwarves.h @@ -351,10 +351,8 @@ int cu__table_add_tag_with_id(struct cu *cu, struct tag *tag, uint32_t id); int cu__table_nullify_type_entry(struct cu *cu, uint32_t id); struct tag *cu__find_base_type_by_name(const struct cu *cu, const char *name, type_id_t *id); -struct tag *cu__find_base_type_by_sname_and_size(const struct cu *cu, - strings_t name, - uint16_t bit_size, - type_id_t *idp); +struct tag *cu__find_base_type_by_name_and_size(const struct cu *cu, const char* name, + uint16_t bit_size, type_id_t *idp); struct tag *cu__find_enumeration_by_name(const struct cu *cu, const char *name, type_id_t *idp); struct tag *cu__find_enumeration_by_name_and_size(const struct cu *cu, const char* name, uint16_t bit_size, type_id_t *idp);