dwarf_loader: Make attr_suffix() handle kabi_prefix

Since we're going to get rid of strings.c.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2021-06-28 14:50:14 -03:00
parent daaafeb35f
commit 2b9bd83e63
2 changed files with 13 additions and 4 deletions

View File

@ -372,10 +372,17 @@ static Dwarf_Off attr_offset(Dwarf_Die *die, const uint32_t name)
static const char *attr_string(Dwarf_Die *die, uint32_t name, struct conf_load *conf __maybe_unused)
{
const char *str = NULL;
Dwarf_Attribute attr;
if (dwarf_attr(die, name, &attr) != NULL)
return dwarf_formstring(&attr);
return NULL;
if (dwarf_attr(die, name, &attr) != NULL) {
str = dwarf_formstring(&attr);
if (conf && conf->kabi_prefix && str && strncmp(str, conf->kabi_prefix, conf->kabi_prefix_len) == 0)
return conf->kabi_prefix;
}
return str;
}
static struct dwarf_off_ref attr_type(Dwarf_Die *die, uint32_t attr_name)

View File

@ -48,10 +48,12 @@ struct conf_load {
struct conf_load *conf);
void *cookie;
char *format_path;
int nr_jobs;
bool extra_dbg_info;
bool fixup_silly_bitfields;
bool get_addr_info;
int nr_jobs;
uint16_t kabi_prefix_len;
const char *kabi_prefix;
struct btf *base_btf;
struct conf_fprintf *conf_fprintf;
};