dwarf_loader: Ignore entries in a DW_TAG_partial_unit, for now

We will have to keep all CUs in memory and do lookups in imported units,
for now, just don't segfault.

Reported-by: Tom de Vries
Bugtracker: https://github.com/acmel/dwarves/issues/10
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2020-09-18 13:53:01 -03:00
parent 4cfd420f7e
commit 8c92fd2981
1 changed files with 13 additions and 1 deletions

View File

@ -2085,7 +2085,19 @@ static int die__process(Dwarf_Die *die, struct cu *cu)
Dwarf_Die child;
const uint16_t tag = dwarf_tag(die);
if (tag != DW_TAG_compile_unit && tag != DW_TAG_type_unit && tag != DW_TAG_partial_unit) {
if (tag == DW_TAG_partial_unit) {
static bool warned;
if (!warned) {
fprintf(stderr, "WARNING: DW_TAG_partial_unit used, some types will not be considered!\n"
" Probably this was optimized using a tool like 'dwz'\n"
" A future version of pahole will take support this.\n");
warned = true;
}
return 0; // so that other units can be processed
}
if (tag != DW_TAG_compile_unit && tag != DW_TAG_type_unit) {
fprintf(stderr, "%s: DW_TAG_compile_unit, DW_TAG_type_unit or DW_TAG_partial_unit expected got %s!\n",
__FUNCTION__, dwarf_tag_name(tag));
return -EINVAL;