summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2018-05-29 00:59:28 +0200
committerMark Wielaard <[email protected]>2018-05-31 14:42:27 +0200
commitb37feac1a8ceebb0748cb28d219aa8387d0885dd (patch)
tree33beb2c916d4bd0d94fcb94ceb5cdef0d809c9a5 /tests
parentc7fc54a27c0eac667f0060f277606df8208f05d7 (diff)
readelf, libdw: Add GNU DebugFission .debug_loc support.
GNU DebugFission .debug_loc location lists uses the .debug_loc section in the split dwarf .dwo file. The encoding is a mix of old style DWARF .debug_loc and new style .debug_loclists. Add two testcases for the readelf and libdw decoders. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog5
-rwxr-xr-xtests/run-readelf-loc.sh141
-rwxr-xr-xtests/run-varlocs.sh74
3 files changed, 220 insertions, 0 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 682fffcd..2b255c72 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,10 @@
2018-05-29 Mark Wielaard <[email protected]>
+ * run-readelf-loc.sh: Add GNU DebugFission split-dwarf variant.
+ * run-varlocs.sh: Likewise.
+
+2018-05-29 Mark Wielaard <[email protected]>
+
* run-readelf-twofiles.sh: Add --debug-dump=loc testcase.
2018-05-28 Mark Wielaard <[email protected]>
diff --git a/tests/run-readelf-loc.sh b/tests/run-readelf-loc.sh
index 622cc196..484db466 100755
--- a/tests/run-readelf-loc.sh
+++ b/tests/run-readelf-loc.sh
@@ -727,4 +727,145 @@ Table at Offset 0x0:
EOF
+# GNU DebugFission split-dwarf variant. Still uses .debug_loc, but now in
+# .dwo file, with somewhat similar, but different encoding from DWARF5.
+testfiles testfile-splitdwarf-4 testfile-hello4.dwo testfile-world4.dwo
+testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=loc --dwarf-skeleton=testfile-splitdwarf-4 testfile-hello4.dwo testfile-world4.dwo <<\EOF
+
+testfile-hello4.dwo:
+
+
+DWARF section [ 3] '.debug_loc.dwo' at offset 0x253:
+
+ CU [ b] base: 0x0000000000401160 <foo>
+ [ 0] range 401160, 40116a
+ 0x0000000000401160 <foo>..
+ 0x0000000000401169 <foo+0x9>
+ [ 0] reg5
+ range 40116a, 401194
+ 0x000000000040116a <foo+0xa>..
+ 0x0000000000401193 <foo+0x33>
+ [ 0] GNU_entry_value:
+ [ 0] reg5
+ [ 3] stack_value
+ [ 16] range 40117b, 40118d
+ 0x000000000040117b <foo+0x1b>..
+ 0x000000000040118c <foo+0x2c>
+ [ 0] GNU_addr_index [18] 0x404038 <m>
+ [ 21] range 40117b, 401181
+ 0x000000000040117b <foo+0x1b>..
+ 0x0000000000401180 <foo+0x20>
+ [ 0] reg5
+ [ 2b] range 40117b, 401187
+ 0x000000000040117b <foo+0x1b>..
+ 0x0000000000401186 <foo+0x26>
+ [ 0] reg5
+ range 401189, 40118d
+ 0x0000000000401189 <foo+0x29>..
+ 0x000000000040118c <foo+0x2c>
+ [ 0] reg5
+ [ 3e] range 401181, 401187
+ 0x0000000000401181 <foo+0x21>..
+ 0x0000000000401186 <foo+0x26>
+ [ 0] reg5
+ range 401189, 40118d
+ 0x0000000000401189 <foo+0x29>..
+ 0x000000000040118c <foo+0x2c>
+ [ 0] reg5
+ [ 51] range 401181, 40118d
+ 0x0000000000401181 <foo+0x21>..
+ 0x000000000040118c <foo+0x2c>
+ [ 0] reg5
+ [ 5b] range 40118d, 401193
+ 0x000000000040118d <foo+0x2d>..
+ 0x0000000000401192 <foo+0x32>
+ [ 0] reg5
+ [ 65] range 4011a0, 4011af
+ 0x00000000004011a0 <baz>..
+ 0x00000000004011ae <baz+0xe>
+ [ 0] reg5
+ range 4011af, 4011b1
+ 0x00000000004011af <baz+0xf>..
+ 0x00000000004011b0 <baz+0x10>
+ [ 0] GNU_entry_value:
+ [ 0] reg5
+ [ 3] stack_value
+ [ 7b] range 4011a0, 4011b0
+ 0x00000000004011a0 <baz>..
+ 0x00000000004011af <baz+0xf>
+ [ 0] reg5
+
+testfile-world4.dwo:
+
+
+DWARF section [ 3] '.debug_loc.dwo' at offset 0x225:
+
+ CU [ b] base: 000000000000000000
+ [ 0] range 401060, 401074
+ 0x0000000000401060 <main>..
+ 0x0000000000401073 <main+0x13>
+ [ 0] reg5
+ range 401074, 401080
+ 0x0000000000401074 <main+0x14>..
+ 0x000000000040107f <main+0x1f>
+ [ 0] GNU_entry_value:
+ [ 0] reg5
+ [ 3] stack_value
+ [ 16] range 401060, 401078
+ 0x0000000000401060 <main>..
+ 0x0000000000401077 <main+0x17>
+ [ 0] reg4
+ range 401078, 40107e
+ 0x0000000000401078 <main+0x18>..
+ 0x000000000040107d <main+0x1d>
+ [ 0] GNU_entry_value:
+ [ 0] reg4
+ [ 3] stack_value
+ [ 2c] range 401071, 401078
+ 0x0000000000401071 <main+0x11>..
+ 0x0000000000401077 <main+0x17>
+ [ 0] reg0
+ [ 36] range 4011c0, 4011c8
+ 0x00000000004011c0 <calc>..
+ 0x00000000004011c7 <calc+0x7>
+ [ 0] reg5
+ range 4011c8, 4011eb
+ 0x00000000004011c8 <calc+0x8>..
+ 0x00000000004011ea <calc+0x2a>
+ [ 0] GNU_entry_value:
+ [ 0] reg5
+ [ 3] stack_value
+ [ 4c] range 4011d8, 4011e3
+ 0x00000000004011d8 <calc+0x18>..
+ 0x00000000004011e2 <calc+0x22>
+ [ 0] reg0
+ [ 56] range 4011d8, 4011da
+ 0x00000000004011d8 <calc+0x18>..
+ 0x00000000004011d9 <calc+0x19>
+ [ 0] reg1
+ range 4011da, 4011df
+ 0x00000000004011da <calc+0x1a>..
+ 0x00000000004011de <calc+0x1e>
+ [ 0] reg5
+ range 4011df, 4011e3
+ 0x00000000004011df <calc+0x1f>..
+ 0x00000000004011e2 <calc+0x22>
+ [ 0] GNU_entry_value:
+ [ 0] reg5
+ [ 3] deref_size 1
+ [ 5] const1u 56
+ [ 7] shl
+ [ 8] const1u 56
+ [10] shra
+ [11] stack_value
+ [ 7d] range 4011d8, 4011da
+ 0x00000000004011d8 <calc+0x18>..
+ 0x00000000004011d9 <calc+0x19>
+ [ 0] reg1
+ range 4011da, 4011e3
+ 0x00000000004011da <calc+0x1a>..
+ 0x00000000004011e2 <calc+0x22>
+ [ 0] reg5
+EOF
+
exit 0
diff --git a/tests/run-varlocs.sh b/tests/run-varlocs.sh
index 8426d20d..e98d8e94 100755
--- a/tests/run-varlocs.sh
+++ b/tests/run-varlocs.sh
@@ -277,6 +277,80 @@ module 'testfilesplitranges5.debug'
[4011c0,4011d0) {reg4}
EOF
+# GNU DebugFissuon Multi CU Split DWARF. See run-dwarf-ranges.sh.
+testfiles testfilesplitranges4.debug
+testfiles testfile-ranges-hello.dwo testfile-ranges-world.dwo
+testrun_compare ${abs_top_builddir}/tests/varlocs --debug -e testfilesplitranges4.debug <<\EOF
+module 'testfilesplitranges4.debug'
+[b] CU 'hello.c'
+ [18] function 'no_say'@4004f0
+ frame_base: {call_frame_cfa {...}}
+ [2f] parameter 'prefix'
+ [4004f0,4004fa) {reg5}
+ [4004fa,4004ff) {GNU_entry_value(1) {reg5}, stack_value}
+ [3b] variable 'world'
+ <no value>
+ [60] function 'main'@4003e0
+ frame_base: {call_frame_cfa {...}}
+ [77] parameter 'argc'
+ [4003e0,4003f2) {reg5}
+ [4003f2,4003f7) {GNU_entry_value(1) {reg5}, stack_value}
+ [83] parameter 'argv'
+ [4003e0,4003f6) {reg4}
+ [4003f6,1004003f5) {GNU_entry_value(1) {reg4}, stack_value}
+ [8f] inlined function 'subject'@4003e3
+ [a3] parameter 'count'
+ [4003e3,4003ef) {reg5}
+ [ac] parameter 'word'
+ [4003e3,4003ef) {reg0}
+ [e7] function 'subject'@4004e0
+ frame_base: {call_frame_cfa {...}}
+ [fb] parameter 'word'
+ [4004e0,4004f0) {reg5}
+ [102] parameter 'count'
+ [4004e0,4004f0) {reg4}
+module 'testfilesplitranges4.debug'
+[b] CU 'world.c'
+ [18] function 'no_main'@400550
+ frame_base: {call_frame_cfa {...}}
+ [2f] parameter 'argc'
+ [400550,400562) {reg5}
+ [400562,400567) {GNU_entry_value(1) {reg5}, stack_value}
+ [3b] parameter 'argv'
+ [400550,400566) {reg4}
+ [400566,100400565) {GNU_entry_value(1) {reg4}, stack_value}
+ [47] inlined function 'no_subject'@400553
+ [5b] parameter 'count'
+ [400553,40055f) {reg5}
+ [64] parameter 'word'
+ [400553,40055f) {reg0}
+ [af] function 'say'@400500
+ frame_base: {call_frame_cfa {...}}
+ [c9] parameter 'prefix'
+ [400500,40050e) {reg5}
+ [40050e,40051c) {reg3}
+ [40051c,400527) {GNU_entry_value(1) {reg5}, stack_value}
+ [400527,400535) {reg3}
+ [400535,400540) {GNU_entry_value(1) {reg5}, stack_value}
+ [d5] variable 'world'
+ [400513,40051b) {reg0}
+ [400527,400534) {reg0}
+ [e1] inlined function 'happy'@40051c
+ [f1] parameter 'w'
+ [400527,400534) {reg0}
+ [fa] inlined function 'sad'@40051c
+ [106] parameter 'c'
+ [40051b,400526) {reg0}
+ [400526,400527) {GNU_entry_value(1) {reg5}}
+ [400534,40053f) {reg0}
+ [15c] function 'no_subject'@400540
+ frame_base: {call_frame_cfa {...}}
+ [170] parameter 'word'
+ [400540,400550) {reg5}
+ [177] parameter 'count'
+ [400540,400550) {reg4}
+EOF
+
# DW_OP_addrx and DW_OP_constx testcases.
#
# int i, j, k;