core: Make label->name a real string
For the threaded code we want to access strings in tags at the same time that the string table may grow in another thread making the previous pointer invalid, so, to avoid excessive locking, use plain strings. The way the tools work will either consume the just produced CU straight away or keep just one copy of each data structure when we keep all CUs in memory, so lets try stopping using strings_t for strings. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
e974d1b240
commit
b5694280ec
|
@ -969,7 +969,7 @@ static struct label *label__new(Dwarf_Die *die, struct cu *cu)
|
|||
|
||||
if (label != NULL) {
|
||||
tag__init(&label->ip.tag, cu, die);
|
||||
label->name = strings__add(strings, attr_string(die, DW_AT_name));
|
||||
label->name = strdup_attr_string(die, DW_AT_name);
|
||||
if (!cu->has_addr_info || dwarf_lowpc(die, &label->ip.addr))
|
||||
label->ip.addr = 0;
|
||||
}
|
||||
|
|
|
@ -638,7 +638,7 @@ static inline struct inline_expansion *
|
|||
|
||||
struct label {
|
||||
struct ip_tag ip;
|
||||
strings_t name;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
static inline struct label *tag__label(const struct tag *tag)
|
||||
|
@ -646,10 +646,9 @@ static inline struct label *tag__label(const struct tag *tag)
|
|||
return (struct label *)tag;
|
||||
}
|
||||
|
||||
static inline const char *label__name(const struct label *label,
|
||||
const struct cu *cu)
|
||||
static inline const char *label__name(const struct label *label)
|
||||
{
|
||||
return cu__string(cu, label->name);
|
||||
return label->name;
|
||||
}
|
||||
|
||||
enum vscope {
|
||||
|
|
|
@ -1173,7 +1173,7 @@ static size_t function__tag_fprintf(const struct tag *tag, const struct cu *cu,
|
|||
printed = fprintf(fp, "%.*s", indent, tabs);
|
||||
fputc('\n', fp);
|
||||
++printed;
|
||||
c = fprintf(fp, "%s:", label__name(label, cu));
|
||||
c = fprintf(fp, "%s:", label__name(label));
|
||||
printed += c;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue