summaryrefslogtreecommitdiff
path: root/src/readelf.c
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2021-02-12 16:42:44 +0100
committerMark Wielaard <mark@klomp.org>2021-02-17 16:55:53 +0100
commit4019aa8148b3871111b8a6687bd9f9a62cba8539 (patch)
tree110ffa6a02148e58947a69c6b11e046eb2b6a7da /src/readelf.c
parentce6a126b01b2c8951dd941a95a92be71e34f2088 (diff)
downloadelfutils-4019aa8148b3871111b8a6687bd9f9a62cba8539.tar.gz
readelf: Type DIE offset is from start of CU.
While inspecting some type units I noticed the type offset seemed off. We were printing the offset as is, but it should include the offset of the unit. There was actually a testcase for this, run-readelf-types.sh but that had the same bug in the expected output. Fixed both. Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'src/readelf.c')
-rw-r--r--src/readelf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/readelf.c b/src/readelf.c
index 9d2a25a4..715af3b3 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -7794,7 +7794,8 @@ print_debug_units (Dwfl_Module *dwflmod,
{
Dwarf_Die typedie;
Dwarf_Off dieoffset;
- dieoffset = dwarf_dieoffset (dwarf_offdie_types (dbg, subdie_off,
+ dieoffset = dwarf_dieoffset (dwarf_offdie_types (dbg, cu->start
+ + subdie_off,
&typedie));
printf (_(" Type unit at offset %" PRIu64 ":\n"
" Version: %" PRIu16