2 # Copyright (C) 2012 Red Hat, Inc.
3 # This file is part of elfutils.
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.
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.
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/>.
18 . $srcdir/test-subr.sh
30 # extern int call_foo(struct foobar *foobar_struct_ptr);
36 # int main(int argc, char ** argv)
42 # return call_foo(b.bar);
49 # int call_foo(struct foobar *fb)
51 # return fb->bar->foo - 42;
54 # gcc -fPIC -g -c -Wall shared.c
55 # gcc -shared -o libtestfile_multi_shared.so shared.o
56 # gcc -g -o testfile_multi_main -L. -ltestfile_multi_shared main.c -Wl,-rpath,.
57 # dwz -m testfile_multi.dwz testfile_multi_main libtestfile_multi_shared.so
59 testfiles libtestfile_multi_shared.so testfile_multi_main testfile_multi.dwz
61 testrun_compare ../src/readelf --debug-dump=info testfile_multi_main <<\EOF
63 DWARF section [28] '.debug_info' at offset 0x1078:
65 Compilation unit at offset 0:
66 Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4
68 producer (strp) "GNU C 4.7.0 20120507 (Red Hat 4.7.0-5) -mtune=generic -march=x86-64 -g"
69 language (data1) C89 (1)
71 comp_dir (GNU_strp_alt) "/home/mark/src/tests/dwz"
72 low_pc (addr) 0x00000000004006ac <main>
74 stmt_list (sec_offset) 0
76 import (GNU_ref_alt) [ b]
79 type (GNU_ref_alt) [ 53]
81 external (flag_present)
85 prototyped (flag_present)
86 type (GNU_ref_alt) [ 3e]
87 low_pc (addr) 0x00000000004006ac <main>
91 GNU_all_tail_call_sites (flag_present)
92 sibling (ref_udata) [ 6e]
93 [ 48] formal_parameter
97 type (GNU_ref_alt) [ 3e]
100 [ 56] formal_parameter
104 type (ref_udata) [ 6e]
111 type (GNU_ref_alt) [ 5a]
116 type (ref_udata) [ 2b]
119 testrun_compare ../src/readelf --debug-dump=info libtestfile_multi_shared.so <<\EOF
121 DWARF section [25] '.debug_info' at offset 0x106c:
123 Compilation unit at offset 0:
124 Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4
126 producer (strp) "GNU C 4.7.0 20120507 (Red Hat 4.7.0-5) -fpreprocessed -mtune=generic -march=x86-64 -g -fPIC"
127 language (data1) C89 (1)
128 name (strp) "shared.c"
129 comp_dir (GNU_strp_alt) "/home/mark/src/tests/dwz"
130 low_pc (addr) +0x0000000000000670 <call_foo>
132 stmt_list (sec_offset) 0
134 import (GNU_ref_alt) [ b]
136 external (flag_present)
137 name (strp) "call_foo"
140 prototyped (flag_present)
141 type (GNU_ref_alt) [ 3e]
142 low_pc (addr) +0x0000000000000670 <call_foo>
146 GNU_all_call_sites (flag_present)
147 [ 41] formal_parameter
151 type (GNU_ref_alt) [ 76]