diff --git a/ctracer.c b/ctracer.c index 10ecac6..1345946 100644 --- a/ctracer.c +++ b/ctracer.c @@ -612,7 +612,7 @@ static void emit_list_of_types(struct list_head *list) * Lets look at the other CUs, perhaps we have already * emmited this one */ - if (type_emissions__find_definition(&emissions, structure__name(pos))) { + if (type_emissions__find_definition(&emissions, type__tag(type)->tag, structure__name(pos))) { type->definition_emitted = 1; continue; } diff --git a/dwarves_emit.c b/dwarves_emit.c index deb8c69..a148198 100644 --- a/dwarves_emit.c +++ b/dwarves_emit.c @@ -37,7 +37,7 @@ static void type_emissions__add_fwd_decl(struct type_emissions *emissions, } struct type *type_emissions__find_definition(const struct type_emissions *emissions, - const char *name) + uint16_t tag, const char *name) { struct type *pos; @@ -45,7 +45,8 @@ struct type *type_emissions__find_definition(const struct type_emissions *emissi return NULL; list_for_each_entry(pos, &emissions->definitions, node) - if (type__name(pos) != NULL && + if (type__tag(pos)->tag == tag && + type__name(pos) != NULL && strcmp(type__name(pos), name) == 0) return pos; @@ -82,7 +83,7 @@ static int enumeration__emit_definitions(struct tag *tag, return 0; /* Ok, lets look at the previous CUs: */ - if (type_emissions__find_definition(emissions, type__name(etype)) != NULL) { + if (type_emissions__find_definition(emissions, DW_TAG_enumeration_type, type__name(etype)) != NULL) { /* * Yes, so lets mark it visited on this CU too, * to speed up the lookup. @@ -111,7 +112,7 @@ static int typedef__emit_definitions(struct tag *tdef, struct cu *cu, return 0; /* Ok, lets look at the previous CUs: */ - if (type_emissions__find_definition(emissions, type__name(def)) != NULL) { + if (type_emissions__find_definition(emissions, DW_TAG_typedef, type__name(def)) != NULL) { /* * Yes, so lets mark it visited on this CU too, * to speed up the lookup. @@ -298,7 +299,7 @@ int type__emit_definitions(struct tag *tag, struct cu *cu, return 0; /* Ok, lets look at the previous CUs: */ - if (type_emissions__find_definition(emissions, type__name(ctype)) != NULL) { + if (type_emissions__find_definition(emissions, tag->tag, type__name(ctype)) != NULL) { ctype->definition_emitted = 1; return 0; } diff --git a/dwarves_emit.h b/dwarves_emit.h index be02acd..b153cdb 100644 --- a/dwarves_emit.h +++ b/dwarves_emit.h @@ -9,6 +9,7 @@ */ #include +#include #include "list.h" struct cu; @@ -30,6 +31,6 @@ int type__emit_definitions(struct tag *tag, struct cu *cu, void type__emit(struct tag *tag_type, struct cu *cu, const char *prefix, const char *suffix, FILE *fp); struct type *type_emissions__find_definition(const struct type_emissions *temissions, - const char *name); + uint16_t tag, const char *name); #endif /* _DWARVES_EMIT_H_ */