libdw: handle DW_FORM_indirect when reading attributes
authorOmar Sandoval <osandov@fb.com>
Fri, 23 Apr 2021 23:36:15 +0000 (16:36 -0700)
committerMark Wielaard <mark@klomp.org>
Sat, 1 May 2021 14:49:48 +0000 (16:49 +0200)
commitd63b26b8d21fb554049789290cd245cbe0446735
tree7df73b0070538294d2d09f32a9dfd600139d72c4
parent6c8b68b0245c8754997b4c4b0ff4ba24974e3fdd
libdw: handle DW_FORM_indirect when reading attributes

Whenever we encounter an attribute with DW_FORM_indirect, we need to
read its true form from the DIE data. Then, we can continue normally.
This adds support to the most obvious places: __libdw_find_attr() and
dwarf_getattrs(). There may be more places that need to be updated.

I encountered this when inspecting a file that was processed by our BOLT
tool: https://github.com/facebookincubator/BOLT. This also adds a couple
of test cases using a file generated by that tool.

Signed-off-by: Omar Sandoval <osandov@fb.com>
libdw/ChangeLog
libdw/dwarf_child.c
libdw/dwarf_getattrs.c
tests/ChangeLog
tests/Makefile.am
tests/run-low_high_pc-dw-form-indirect.sh [new file with mode: 0755]
tests/run-readelf-dw-form-indirect.sh [new file with mode: 0755]
tests/testfile-dw-form-indirect.bz2 [new file with mode: 0755]