1#!/usr/local/bin/bash
2# Copyright (C) 2018 Red Hat, Inc.
3# This file is part of elfutils.
4#
5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# elfutils is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18. $srcdir/test-subr.sh
19
20# See tests/testfile-dwarf-45.source
21testfiles testfile-splitdwarf-4 testfile-splitdwarf-5
22
23# DWARF4 GNU DebugFission No real table header.
24testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=addr testfile-splitdwarf-4<<\EOF
25
26DWARF section [33] '.debug_addr' at offset 0x3671:
27Table at offset 0 for CU [     b]:
28
29 Length:              152
30 DWARF version:         4
31 Address size:          8
32 Segment size:          0
33
34 Addresses start at offset 0x0:
35 [ 0] 0x000000000040116a <foo+0xa>
36 [ 1] 0x0000000000401189 <foo+0x29>
37 [ 2] 0x000000000040118d <foo+0x2d>
38 [ 3] 0x0000000000401194
39 [ 4] 0x0000000000401181 <foo+0x21>
40 [ 5] 0x00000000004011af <baz+0xf>
41 [ 6] 0x00000000004011b1
42 [ 7] 0x00000000004011a0 <baz>
43 [ 8] 0x0000000000401160 <foo>
44 [ 9] 0x00000000004011a0 <baz>
45 [10] 0x000000000040117b <foo+0x1b>
46 [11] 0x000000000040117b <foo+0x1b>
47 [12] 0x0000000000401181 <foo+0x21>
48 [13] 0x0000000000401181 <foo+0x21>
49 [14] 0x000000000040118d <foo+0x2d>
50 [15] 0x0000000000401160 <foo>
51 [16] 0x0000000000401060 <main>
52 [17] 0x000000000040117b <foo+0x1b>
53 [18] 0x0000000000404038 <m>
54
55Table at offset 98 for CU [    3f]:
56
57 Length:              136
58 DWARF version:         4
59 Address size:          8
60 Segment size:          0
61
62 Addresses start at offset 0x98:
63 [ 0] 0x00000000004011df <calc+0x1f>
64 [ 1] 0x00000000004011e4 <calc+0x24>
65 [ 2] 0x0000000000401060 <main>
66 [ 3] 0x0000000000401071 <main+0x11>
67 [ 4] 0x0000000000401074 <main+0x14>
68 [ 5] 0x0000000000401079 <main+0x19>
69 [ 6] 0x00000000004011d3 <calc+0x13>
70 [ 7] 0x0000000000401078 <main+0x18>
71 [ 8] 0x00000000004011a0 <baz>
72 [ 9] 0x0000000000401040
73 [10] 0x0000000000401080 <_start>
74 [11] 0x00000000004011c0 <calc>
75 [12] 0x0000000000401060 <main>
76 [13] 0x00000000004011c0 <calc>
77 [14] 0x00000000004011c8 <calc+0x8>
78 [15] 0x00000000004011d8 <calc+0x18>
79 [16] 0x00000000004011da <calc+0x1a>
80
81EOF
82
83# DWARF5 Real table header.
84testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=addr testfile-splitdwarf-5<<\EOF
85
86DWARF section [32] '.debug_addr' at offset 0x365e:
87Table at offset 0 for CU [    14]:
88
89 Length:              156
90 DWARF version:         5
91 Address size:          8
92 Segment size:          0
93
94 Addresses start at offset 0x8:
95 [ 0] 0x000000000040116a <foo+0xa>
96 [ 1] 0x0000000000401189 <foo+0x29>
97 [ 2] 0x000000000040118d <foo+0x2d>
98 [ 3] 0x0000000000401194
99 [ 4] 0x0000000000401181 <foo+0x21>
100 [ 5] 0x00000000004011af <baz+0xf>
101 [ 6] 0x00000000004011b1
102 [ 7] 0x00000000004011a0 <baz>
103 [ 8] 0x0000000000401160 <foo>
104 [ 9] 0x00000000004011a0 <baz>
105 [10] 0x000000000040117b <foo+0x1b>
106 [11] 0x000000000040117b <foo+0x1b>
107 [12] 0x0000000000401181 <foo+0x21>
108 [13] 0x0000000000401181 <foo+0x21>
109 [14] 0x000000000040118d <foo+0x2d>
110 [15] 0x0000000000401160 <foo>
111 [16] 0x0000000000401060 <main>
112 [17] 0x000000000040117b <foo+0x1b>
113 [18] 0x0000000000404038 <m>
114
115Table at offset a0 for CU [    49]:
116
117 Length:              140
118 DWARF version:         5
119 Address size:          8
120 Segment size:          0
121
122 Addresses start at offset 0xa8:
123 [ 0] 0x00000000004011df <calc+0x1f>
124 [ 1] 0x00000000004011e4 <calc+0x24>
125 [ 2] 0x0000000000401060 <main>
126 [ 3] 0x0000000000401071 <main+0x11>
127 [ 4] 0x0000000000401074 <main+0x14>
128 [ 5] 0x0000000000401079 <main+0x19>
129 [ 6] 0x00000000004011d3 <calc+0x13>
130 [ 7] 0x0000000000401078 <main+0x18>
131 [ 8] 0x00000000004011a0 <baz>
132 [ 9] 0x0000000000401040
133 [10] 0x0000000000401080 <_start>
134 [11] 0x00000000004011c0 <calc>
135 [12] 0x0000000000401060 <main>
136 [13] 0x00000000004011c0 <calc>
137 [14] 0x00000000004011c8 <calc+0x8>
138 [15] 0x00000000004011d8 <calc+0x18>
139 [16] 0x00000000004011da <calc+0x1a>
140
141EOF
142
143exit 0
144