|
Packit Service |
97d2fb |
#! /bin/sh
|
|
Packit Service |
97d2fb |
# Copyright (C) 2018 Red Hat, Inc.
|
|
Packit Service |
97d2fb |
# This file is part of elfutils.
|
|
Packit Service |
97d2fb |
#
|
|
Packit Service |
97d2fb |
# This file is free software; you can redistribute it and/or modify
|
|
Packit Service |
97d2fb |
# it under the terms of the GNU General Public License as published by
|
|
Packit Service |
97d2fb |
# the Free Software Foundation; either version 3 of the License, or
|
|
Packit Service |
97d2fb |
# (at your option) any later version.
|
|
Packit Service |
97d2fb |
#
|
|
Packit Service |
97d2fb |
# elfutils is distributed in the hope that it will be useful, but
|
|
Packit Service |
97d2fb |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
97d2fb |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
97d2fb |
# GNU General Public License for more details.
|
|
Packit Service |
97d2fb |
#
|
|
Packit Service |
97d2fb |
# You should have received a copy of the GNU General Public License
|
|
Packit Service |
97d2fb |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
. $srcdir/test-subr.sh
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
# See run-readelf-loc.sh
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
testfiles testfileloc
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
# Process values as offsets from base addresses and resolve to symbols.
|
|
Packit Service |
97d2fb |
testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=ranges testfileloc<<\EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
DWARF section [34] '.debug_ranges' at offset 0xd94:
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
CU [ b] base: 0x0000000000400480 <main>
|
|
Packit Service |
97d2fb |
[ 0] range 0, 2
|
|
Packit Service |
97d2fb |
0x0000000000400480 <main>..
|
|
Packit Service |
97d2fb |
0x0000000000400481 <main+0x1>
|
|
Packit Service |
97d2fb |
range 5, d
|
|
Packit Service |
97d2fb |
0x0000000000400485 <main+0x5>..
|
|
Packit Service |
97d2fb |
0x000000000040048c <main+0xc>
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
CU [ e0] base: 0x00000000004004a0 <say>
|
|
Packit Service |
97d2fb |
[ 30] range d, f
|
|
Packit Service |
97d2fb |
0x00000000004004ad <say+0xd>..
|
|
Packit Service |
97d2fb |
0x00000000004004ae <say+0xe>
|
|
Packit Service |
97d2fb |
range 12, 1a
|
|
Packit Service |
97d2fb |
0x00000000004004b2 <say+0x12>..
|
|
Packit Service |
97d2fb |
0x00000000004004b9 <say+0x19>
|
|
Packit Service |
97d2fb |
EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
# Don't resolve addresses to symbols.
|
|
Packit Service |
97d2fb |
testrun_compare ${abs_top_builddir}/src/readelf -N --debug-dump=ranges testfileloc<<\EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
DWARF section [34] '.debug_ranges' at offset 0xd94:
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
CU [ b] base: 0x0000000000400480
|
|
Packit Service |
97d2fb |
[ 0] range 0, 2
|
|
Packit Service |
97d2fb |
0x0000000000400480..
|
|
Packit Service |
97d2fb |
0x0000000000400481
|
|
Packit Service |
97d2fb |
range 5, d
|
|
Packit Service |
97d2fb |
0x0000000000400485..
|
|
Packit Service |
97d2fb |
0x000000000040048c
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
CU [ e0] base: 0x00000000004004a0
|
|
Packit Service |
97d2fb |
[ 30] range d, f
|
|
Packit Service |
97d2fb |
0x00000000004004ad..
|
|
Packit Service |
97d2fb |
0x00000000004004ae
|
|
Packit Service |
97d2fb |
range 12, 1a
|
|
Packit Service |
97d2fb |
0x00000000004004b2..
|
|
Packit Service |
97d2fb |
0x00000000004004b9
|
|
Packit Service |
97d2fb |
EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
# Produce "raw" unprocessed content.
|
|
Packit Service |
97d2fb |
testrun_compare ${abs_top_builddir}/src/readelf -U --debug-dump=ranges testfileloc<<\EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
DWARF section [34] '.debug_ranges' at offset 0xd94:
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
CU [ b] base: 0x0000000000400480
|
|
Packit Service |
97d2fb |
[ 0] range 0, 2
|
|
Packit Service |
97d2fb |
range 5, d
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
CU [ e0] base: 0x00000000004004a0
|
|
Packit Service |
97d2fb |
[ 30] range d, f
|
|
Packit Service |
97d2fb |
range 12, 1a
|
|
Packit Service |
97d2fb |
EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
# .debug_rnglists (DWARF5), see tests/testfile-dwarf-45.source
|
|
Packit Service |
97d2fb |
testfiles testfile-dwarf-5
|
|
Packit Service |
97d2fb |
testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=ranges testfile-dwarf-5<<\EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
DWARF section [33] '.debug_rnglists' at offset 0x1d9a:
|
|
Packit Service |
97d2fb |
Table at Offset 0x0:
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
Length: 45
|
|
Packit Service |
97d2fb |
DWARF version: 5
|
|
Packit Service |
97d2fb |
Address size: 8
|
|
Packit Service |
97d2fb |
Segment size: 0
|
|
Packit Service |
97d2fb |
Offset entries: 0
|
|
Packit Service |
97d2fb |
CU [ 218] base: 000000000000000000
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
Offset: c, Index: 0
|
|
Packit Service |
97d2fb |
base_address 0x400583
|
|
Packit Service |
97d2fb |
0x0000000000400583 <calc+0x13>
|
|
Packit Service |
97d2fb |
offset_pair 0, 2
|
|
Packit Service |
97d2fb |
0x0000000000400583 <calc+0x13>..
|
|
Packit Service |
97d2fb |
0x0000000000400584 <calc+0x14>
|
|
Packit Service |
97d2fb |
offset_pair 5, 15
|
|
Packit Service |
97d2fb |
0x0000000000400588 <calc+0x18>..
|
|
Packit Service |
97d2fb |
0x0000000000400597 <calc+0x27>
|
|
Packit Service |
97d2fb |
end_of_list
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
Offset: 1c, Index: 10
|
|
Packit Service |
97d2fb |
start_length 0x400570, 2b
|
|
Packit Service |
97d2fb |
0x0000000000400570 <calc>..
|
|
Packit Service |
97d2fb |
0x000000000040059a <calc+0x2a>
|
|
Packit Service |
97d2fb |
start_length 0x400410, 20
|
|
Packit Service |
97d2fb |
0x0000000000400410 <main>..
|
|
Packit Service |
97d2fb |
0x000000000040042f <main+0x1f>
|
|
Packit Service |
97d2fb |
end_of_list
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
# Same as above, but for DWARF4, note no header, and base address is not
|
|
Packit Service |
97d2fb |
# given, but ranges are the same.
|
|
Packit Service |
97d2fb |
testfiles testfile-dwarf-4
|
|
Packit Service |
97d2fb |
testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=ranges testfile-dwarf-4<<\EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
DWARF section [32] '.debug_ranges' at offset 0x1f96:
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
CU [ 21c] base: 000000000000000000
|
|
Packit Service |
97d2fb |
[ 0] range 400583, 400585
|
|
Packit Service |
97d2fb |
0x0000000000400583 <calc+0x13>..
|
|
Packit Service |
97d2fb |
0x0000000000400584 <calc+0x14>
|
|
Packit Service |
97d2fb |
range 400588, 400598
|
|
Packit Service |
97d2fb |
0x0000000000400588 <calc+0x18>..
|
|
Packit Service |
97d2fb |
0x0000000000400597 <calc+0x27>
|
|
Packit Service |
97d2fb |
[ 30] range 400570, 40059b
|
|
Packit Service |
97d2fb |
0x0000000000400570 <calc>..
|
|
Packit Service |
97d2fb |
0x000000000040059a <calc+0x2a>
|
|
Packit Service |
97d2fb |
range 400410, 400430
|
|
Packit Service |
97d2fb |
0x0000000000400410 <main>..
|
|
Packit Service |
97d2fb |
0x000000000040042f <main+0x1f>
|
|
Packit Service |
97d2fb |
EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
# Now with split dwarf. See tests/testfile-dwarf-45.source.
|
|
Packit Service |
97d2fb |
# Note that this will have an offsets table that the .dwo can refer to.
|
|
Packit Service |
97d2fb |
testfiles testfile-splitdwarf-5 testfile-hello5.dwo testfile-world5.dwo
|
|
Packit Service |
97d2fb |
testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=ranges testfile-splitdwarf-5<<\EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
DWARF section [35] '.debug_rnglists' at offset 0x393a:
|
|
Packit Service |
97d2fb |
Table at Offset 0x0:
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
Length: 53
|
|
Packit Service |
97d2fb |
DWARF version: 5
|
|
Packit Service |
97d2fb |
Address size: 8
|
|
Packit Service |
97d2fb |
Segment size: 0
|
|
Packit Service |
97d2fb |
Offset entries: 2
|
|
Packit Service |
97d2fb |
CU [ 49] base: 000000000000000000
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
Offsets starting at 0xc:
|
|
Packit Service |
97d2fb |
[ 0] 0x8
|
|
Packit Service |
97d2fb |
[ 1] 0x18
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
Offset: 14, Index: 8
|
|
Packit Service |
97d2fb |
base_address 0x4011d3
|
|
Packit Service |
97d2fb |
0x00000000004011d3 <calc+0x13>
|
|
Packit Service |
97d2fb |
offset_pair 0, 2
|
|
Packit Service |
97d2fb |
0x00000000004011d3 <calc+0x13>..
|
|
Packit Service |
97d2fb |
0x00000000004011d4 <calc+0x14>
|
|
Packit Service |
97d2fb |
offset_pair 5, 15
|
|
Packit Service |
97d2fb |
0x00000000004011d8 <calc+0x18>..
|
|
Packit Service |
97d2fb |
0x00000000004011e7 <calc+0x27>
|
|
Packit Service |
97d2fb |
end_of_list
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
Offset: 24, Index: 18
|
|
Packit Service |
97d2fb |
start_length 0x4011c0, 2b
|
|
Packit Service |
97d2fb |
0x00000000004011c0 <calc>..
|
|
Packit Service |
97d2fb |
0x00000000004011ea <calc+0x2a>
|
|
Packit Service |
97d2fb |
start_length 0x401060, 20
|
|
Packit Service |
97d2fb |
0x0000000000401060 <main>..
|
|
Packit Service |
97d2fb |
0x000000000040107f <main+0x1f>
|
|
Packit Service |
97d2fb |
end_of_list
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
# Note that the rnglist_base attribute of the second CU points to the offsets
|
|
Packit Service |
97d2fb |
# above 0xc [c].
|
|
Packit Service |
97d2fb |
testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=info testfile-splitdwarf-5<<\EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
DWARF section [28] '.debug_info' at offset 0x3102:
|
|
Packit Service |
97d2fb |
[Offset]
|
|
Packit Service |
97d2fb |
Compilation unit at offset 0:
|
|
Packit Service |
97d2fb |
Version: 5, Abbreviation section offset: 0, Address size: 8, Offset size: 4
|
|
Packit Service |
97d2fb |
Unit type: skeleton (4), Unit id: 0xc422aa5c31fec205
|
|
Packit Service |
97d2fb |
[ 14] skeleton_unit abbrev: 1
|
|
Packit Service |
97d2fb |
low_pc (addr) 0x0000000000401160 <foo>
|
|
Packit Service |
97d2fb |
high_pc (data8) 81 (0x00000000004011b1)
|
|
Packit Service |
97d2fb |
stmt_list (sec_offset) 0
|
|
Packit Service |
97d2fb |
dwo_name (strp) "testfile-hello5.dwo"
|
|
Packit Service |
97d2fb |
comp_dir (strp) "/home/mark/src/elfutils/tests"
|
|
Packit Service |
97d2fb |
GNU_pubnames (flag_present) yes
|
|
Packit Service |
97d2fb |
addr_base (sec_offset) address base [ 8]
|
|
Packit Service |
97d2fb |
Compilation unit at offset 53:
|
|
Packit Service |
97d2fb |
Version: 5, Abbreviation section offset: 21, Address size: 8, Offset size: 4
|
|
Packit Service |
97d2fb |
Unit type: skeleton (4), Unit id: 0xb6c8b9d97e6dfdfe
|
|
Packit Service |
97d2fb |
[ 49] skeleton_unit abbrev: 1
|
|
Packit Service |
97d2fb |
ranges (sec_offset) range list [ 24]
|
|
Packit Service |
97d2fb |
low_pc (addr) 000000000000000000
|
|
Packit Service |
97d2fb |
stmt_list (sec_offset) 655
|
|
Packit Service |
97d2fb |
dwo_name (strp) "testfile-world5.dwo"
|
|
Packit Service |
97d2fb |
comp_dir (strp) "/home/mark/src/elfutils/tests"
|
|
Packit Service |
97d2fb |
GNU_pubnames (flag_present) yes
|
|
Packit Service |
97d2fb |
addr_base (sec_offset) address base [ a8]
|
|
Packit Service |
97d2fb |
rnglists_base (sec_offset) range list [ c]
|
|
Packit Service |
97d2fb |
EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
# Same for DWARF4 GNU DebugFission. But now we need to scan the .dwo
|
|
Packit Service |
97d2fb |
# explicitly to know it will use the first ranges.
|
|
Packit Service |
97d2fb |
testfiles testfile-splitdwarf-4 testfile-hello4.dwo testfile-world4.dwo
|
|
Packit Service |
97d2fb |
testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=ranges testfile-splitdwarf-4<<\EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
DWARF section [32] '.debug_ranges' at offset 0x3611:
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
CU [ b] base: 000000000000000000
|
|
Packit Service |
97d2fb |
[ 0] range 4011d3, 4011d5
|
|
Packit Service |
97d2fb |
0x00000000004011d3 <calc+0x13>..
|
|
Packit Service |
97d2fb |
0x00000000004011d4 <calc+0x14>
|
|
Packit Service |
97d2fb |
range 4011d8, 4011e8
|
|
Packit Service |
97d2fb |
0x00000000004011d8 <calc+0x18>..
|
|
Packit Service |
97d2fb |
0x00000000004011e7 <calc+0x27>
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
CU [ 3f] base: 000000000000000000
|
|
Packit Service |
97d2fb |
[ 30] range 4011c0, 4011eb
|
|
Packit Service |
97d2fb |
0x00000000004011c0 <calc>..
|
|
Packit Service |
97d2fb |
0x00000000004011ea <calc+0x2a>
|
|
Packit Service |
97d2fb |
range 401060, 401080
|
|
Packit Service |
97d2fb |
0x0000000000401060 <main>..
|
|
Packit Service |
97d2fb |
0x000000000040107f <main+0x1f>
|
|
Packit Service |
97d2fb |
EOF
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
exit 0
|