From fbb6c932e3ff74d4fb8bc54b72d9c9bdc4513f69 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 29 Nov 2017 16:37:50 +0100 Subject: readelf: Print CU, base address and unresolved .debug_loc entries. Also adjust the formatting for the resolved addresses to print them on separate lines so they nicely line up even when the addresses are resolved to symbol+offset names. And print the operands starting on a new line. Signed-off-by: Mark Wielaard --- tests/ChangeLog | 6 +++++ tests/run-readelf-loc.sh | 51 +++++++++++++++++++++++++++++++++-------- tests/run-readelf-zdebug-rel.sh | 17 +++++++++----- tests/run-readelf-zdebug.sh | 17 +++++++++----- 4 files changed, 70 insertions(+), 21 deletions(-) (limited to 'tests') diff --git a/tests/ChangeLog b/tests/ChangeLog index 4666dcc2..cb0c977f 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2017-11-29 Mark Wielaard + + * run-readelf-loc.sh: Adjust expected loc list output. + * run-readelf-zdebug-rel.sh: Likewise. + * run-readelf-zdebug.sh: Likewise. + 2017-11-29 Mark Wielaard * run-readelf-loc.sh: Adjust expected range list output. diff --git a/tests/run-readelf-loc.sh b/tests/run-readelf-loc.sh index 4b666cfe..e5152df8 100755 --- a/tests/run-readelf-loc.sh +++ b/tests/run-readelf-loc.sh @@ -63,9 +63,22 @@ testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=loc --debug-dump=ra testfileloc<<\EOF DWARF section [33] '.debug_loc' at offset 0xd2a: - [ 0] 0x0000000000400480
..0x000000000040048d [ 0] reg5 - [ 23] 0x0000000000400485 ..0x000000000040048d [ 0] reg5 - [ 46] 0x00000000004004b2 ..0x00000000004004ba [ 0] breg5 0 + + CU [ b] base: 0x0000000000400480
+ [ 0] range 0, d + 0x0000000000400480
.. + 0x000000000040048c + [ 0] reg5 + [ 23] range 5, d + 0x0000000000400485 .. + 0x000000000040048c + [ 0] reg5 + + CU [ e0] base: 0x00000000004004a0 + [ 46] range 12, 1a + 0x00000000004004b2 .. + 0x00000000004004b9 + [ 0] breg5 0 DWARF section [34] '.debug_ranges' at offset 0xd94: @@ -91,9 +104,22 @@ testrun_compare ${abs_top_builddir}/src/readelf -N --debug-dump=loc --debug-dump testfileloc<<\EOF DWARF section [33] '.debug_loc' at offset 0xd2a: - [ 0] 0x0000000000400480..0x000000000040048d [ 0] reg5 - [ 23] 0x0000000000400485..0x000000000040048d [ 0] reg5 - [ 46] 0x00000000004004b2..0x00000000004004ba [ 0] breg5 0 + + CU [ b] base: 0x0000000000400480 + [ 0] range 0, d + 0x0000000000400480.. + 0x000000000040048c + [ 0] reg5 + [ 23] range 5, d + 0x0000000000400485.. + 0x000000000040048c + [ 0] reg5 + + CU [ e0] base: 0x00000000004004a0 + [ 46] range 12, 1a + 0x00000000004004b2.. + 0x00000000004004b9 + [ 0] breg5 0 DWARF section [34] '.debug_ranges' at offset 0xd94: @@ -119,9 +145,16 @@ testrun_compare ${abs_top_builddir}/src/readelf -U --debug-dump=loc --debug-dump testfileloc<<\EOF DWARF section [33] '.debug_loc' at offset 0xd2a: - [ 0] 000000000000000000..0x000000000000000d [ 0] reg5 - [ 23] 0x0000000000000005..0x000000000000000d [ 0] reg5 - [ 46] 0x0000000000000012..0x000000000000001a [ 0] breg5 0 + + CU [ b] base: 0x0000000000400480 + [ 0] range 0, d + [ 0] reg5 + [ 23] range 5, d + [ 0] reg5 + + CU [ e0] base: 0x00000000004004a0 + [ 46] range 12, 1a + [ 0] breg5 0 DWARF section [34] '.debug_ranges' at offset 0xd94: diff --git a/tests/run-readelf-zdebug-rel.sh b/tests/run-readelf-zdebug-rel.sh index 2b57d058..ccccd82d 100755 --- a/tests/run-readelf-zdebug-rel.sh +++ b/tests/run-readelf-zdebug-rel.sh @@ -127,12 +127,17 @@ cat info.out | testrun_compare ${abs_top_builddir}/src/readelf -U --debug-dump=i cat > loc.out << \EOF DWARF section [ 7] '.debug_loc' at offset 0x185: - [ 0] 000000000000000000..0x0000000000000003 [ 0] reg5 - 0x0000000000000003..0x0000000000000010 [ 0] breg5 -42 - [ 2] stack_value - 0x0000000000000010..0x0000000000000018 [ 0] GNU_entry_value: - [ 0] reg5 - [ 3] stack_value + + CU [ b] base: 000000000000000000 + [ 0] range 0, 3 + [ 0] reg5 + range 3, 10 + [ 0] breg5 -42 + [ 2] stack_value + range 10, 18 + [ 0] GNU_entry_value: + [ 0] reg5 + [ 3] stack_value EOF cat loc.out | testrun_compare ${abs_top_builddir}/src/readelf -U --debug-dump=loc testfile-debug-rel.o diff --git a/tests/run-readelf-zdebug.sh b/tests/run-readelf-zdebug.sh index 7be9beee..28128ad9 100755 --- a/tests/run-readelf-zdebug.sh +++ b/tests/run-readelf-zdebug.sh @@ -46,12 +46,17 @@ tempfiles loc.out aranges.out ranges.out macro.out line.out frame.out cat > loc.out << \EOF DWARF section [30] '.debug_loc' at offset 0xa17: - [ 0] 0x00000000004003c0..0x00000000004003c3 [ 0] reg5 - 0x00000000004003c3..0x00000000004003d6 [ 0] breg5 -42 - [ 2] stack_value - 0x00000000004003d6..0x00000000004003d9 [ 0] GNU_entry_value: - [ 0] reg5 - [ 3] stack_value + + CU [ b] base: 000000000000000000 + [ 0] range 4003c0, 4003c3 + [ 0] reg5 + range 4003c3, 4003d6 + [ 0] breg5 -42 + [ 2] stack_value + range 4003d6, 4003d9 + [ 0] GNU_entry_value: + [ 0] reg5 + [ 3] stack_value EOF cat loc.out | testrun_compare ${abs_top_builddir}/src/readelf -U --debug-dump=loc testfile-debug -- cgit v1.2.3