xref: /aosp_15_r20/external/elfutils/tests/run-addr2line-C-test.sh (revision 7304104da70ce23c86437a01be71edd1a2d7f37e)
1*7304104dSAndroid Build Coastguard Worker#! /bin/sh
2*7304104dSAndroid Build Coastguard Worker# Copyright (C) 2013 Red Hat, Inc.
3*7304104dSAndroid Build Coastguard Worker# Copyright (C) 2023 Mark J. Wielaard <[email protected]>
4*7304104dSAndroid Build Coastguard Worker# This file is part of elfutils.
5*7304104dSAndroid Build Coastguard Worker#
6*7304104dSAndroid Build Coastguard Worker# This file is free software; you can redistribute it and/or modify
7*7304104dSAndroid Build Coastguard Worker# it under the terms of the GNU General Public License as published by
8*7304104dSAndroid Build Coastguard Worker# the Free Software Foundation; either version 3 of the License, or
9*7304104dSAndroid Build Coastguard Worker# (at your option) any later version.
10*7304104dSAndroid Build Coastguard Worker#
11*7304104dSAndroid Build Coastguard Worker# elfutils is distributed in the hope that it will be useful, but
12*7304104dSAndroid Build Coastguard Worker# WITHOUT ANY WARRANTY; without even the implied warranty of
13*7304104dSAndroid Build Coastguard Worker# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*7304104dSAndroid Build Coastguard Worker# GNU General Public License for more details.
15*7304104dSAndroid Build Coastguard Worker#
16*7304104dSAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License
17*7304104dSAndroid Build Coastguard Worker# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18*7304104dSAndroid Build Coastguard Worker
19*7304104dSAndroid Build Coastguard Worker. $srcdir/test-subr.sh
20*7304104dSAndroid Build Coastguard Worker
21*7304104dSAndroid Build Coastguard Workerif test -n "$ELFUTILS_DISABLE_DEMANGLE"; then
22*7304104dSAndroid Build Coastguard Worker  echo "demangler unsupported"
23*7304104dSAndroid Build Coastguard Worker  exit 77
24*7304104dSAndroid Build Coastguard Workerfi
25*7304104dSAndroid Build Coastguard Worker
26*7304104dSAndroid Build Coastguard Worker# See run-addr2line-i-test.sh
27*7304104dSAndroid Build Coastguard Workertestfiles testfile-inlines
28*7304104dSAndroid Build Coastguard Worker
29*7304104dSAndroid Build Coastguard Worker# Three variants -Cfi, -fCi -fiC all the same (with demangle)
30*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/src/addr2line --pretty-print -a -Cfi -e testfile-inlines 0x00000000000005a0 0x00000000000005a1 0x00000000000005b0 0x00000000000005b1 0x00000000000005c0 0x00000000000005d0 0x00000000000005e0 0x00000000000005e1 0x00000000000005f0 0x00000000000005f1 0x00000000000005f2 <<\EOF
31*7304104dSAndroid Build Coastguard Worker0x00000000000005a0: foobar at /tmp/x.cpp:5
32*7304104dSAndroid Build Coastguard Worker0x00000000000005a1: foobar at /tmp/x.cpp:6
33*7304104dSAndroid Build Coastguard Worker0x00000000000005b0: fubar at /tmp/x.cpp:10
34*7304104dSAndroid Build Coastguard Worker0x00000000000005b1: fubar at /tmp/x.cpp:11
35*7304104dSAndroid Build Coastguard Worker0x00000000000005c0: foobar at /tmp/x.cpp:5
36*7304104dSAndroid Build Coastguard Worker (inlined by) bar at /tmp/x.cpp:15
37*7304104dSAndroid Build Coastguard Worker0x00000000000005d0: fubar at /tmp/x.cpp:10
38*7304104dSAndroid Build Coastguard Worker (inlined by) baz at /tmp/x.cpp:20
39*7304104dSAndroid Build Coastguard Worker0x00000000000005e0: foobar at /tmp/x.cpp:5
40*7304104dSAndroid Build Coastguard Worker (inlined by) bar at /tmp/x.cpp:15
41*7304104dSAndroid Build Coastguard Worker (inlined by) foo() at /tmp/x.cpp:25
42*7304104dSAndroid Build Coastguard Worker0x00000000000005e1: fubar at /tmp/x.cpp:10
43*7304104dSAndroid Build Coastguard Worker (inlined by) baz at /tmp/x.cpp:20
44*7304104dSAndroid Build Coastguard Worker (inlined by) foo() at /tmp/x.cpp:26
45*7304104dSAndroid Build Coastguard Worker0x00000000000005f0: fu() at /tmp/x.cpp:31
46*7304104dSAndroid Build Coastguard Worker0x00000000000005f1: fubar at /tmp/x.cpp:10
47*7304104dSAndroid Build Coastguard Worker (inlined by) fu() at /tmp/x.cpp:32
48*7304104dSAndroid Build Coastguard Worker0x00000000000005f2: foobar at /tmp/x.cpp:5
49*7304104dSAndroid Build Coastguard Worker (inlined by) fu() at /tmp/x.cpp:33
50*7304104dSAndroid Build Coastguard WorkerEOF
51*7304104dSAndroid Build Coastguard Worker
52*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/src/addr2line --pretty-print -a -fCi -e testfile-inlines 0x00000000000005a0 0x00000000000005a1 0x00000000000005b0 0x00000000000005b1 0x00000000000005c0 0x00000000000005d0 0x00000000000005e0 0x00000000000005e1 0x00000000000005f0 0x00000000000005f1 0x00000000000005f2 <<\EOF
53*7304104dSAndroid Build Coastguard Worker0x00000000000005a0: foobar at /tmp/x.cpp:5
54*7304104dSAndroid Build Coastguard Worker0x00000000000005a1: foobar at /tmp/x.cpp:6
55*7304104dSAndroid Build Coastguard Worker0x00000000000005b0: fubar at /tmp/x.cpp:10
56*7304104dSAndroid Build Coastguard Worker0x00000000000005b1: fubar at /tmp/x.cpp:11
57*7304104dSAndroid Build Coastguard Worker0x00000000000005c0: foobar at /tmp/x.cpp:5
58*7304104dSAndroid Build Coastguard Worker (inlined by) bar at /tmp/x.cpp:15
59*7304104dSAndroid Build Coastguard Worker0x00000000000005d0: fubar at /tmp/x.cpp:10
60*7304104dSAndroid Build Coastguard Worker (inlined by) baz at /tmp/x.cpp:20
61*7304104dSAndroid Build Coastguard Worker0x00000000000005e0: foobar at /tmp/x.cpp:5
62*7304104dSAndroid Build Coastguard Worker (inlined by) bar at /tmp/x.cpp:15
63*7304104dSAndroid Build Coastguard Worker (inlined by) foo() at /tmp/x.cpp:25
64*7304104dSAndroid Build Coastguard Worker0x00000000000005e1: fubar at /tmp/x.cpp:10
65*7304104dSAndroid Build Coastguard Worker (inlined by) baz at /tmp/x.cpp:20
66*7304104dSAndroid Build Coastguard Worker (inlined by) foo() at /tmp/x.cpp:26
67*7304104dSAndroid Build Coastguard Worker0x00000000000005f0: fu() at /tmp/x.cpp:31
68*7304104dSAndroid Build Coastguard Worker0x00000000000005f1: fubar at /tmp/x.cpp:10
69*7304104dSAndroid Build Coastguard Worker (inlined by) fu() at /tmp/x.cpp:32
70*7304104dSAndroid Build Coastguard Worker0x00000000000005f2: foobar at /tmp/x.cpp:5
71*7304104dSAndroid Build Coastguard Worker (inlined by) fu() at /tmp/x.cpp:33
72*7304104dSAndroid Build Coastguard WorkerEOF
73*7304104dSAndroid Build Coastguard Worker
74*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/src/addr2line --pretty-print -a -fiC -e testfile-inlines 0x00000000000005a0 0x00000000000005a1 0x00000000000005b0 0x00000000000005b1 0x00000000000005c0 0x00000000000005d0 0x00000000000005e0 0x00000000000005e1 0x00000000000005f0 0x00000000000005f1 0x00000000000005f2 <<\EOF
75*7304104dSAndroid Build Coastguard Worker0x00000000000005a0: foobar at /tmp/x.cpp:5
76*7304104dSAndroid Build Coastguard Worker0x00000000000005a1: foobar at /tmp/x.cpp:6
77*7304104dSAndroid Build Coastguard Worker0x00000000000005b0: fubar at /tmp/x.cpp:10
78*7304104dSAndroid Build Coastguard Worker0x00000000000005b1: fubar at /tmp/x.cpp:11
79*7304104dSAndroid Build Coastguard Worker0x00000000000005c0: foobar at /tmp/x.cpp:5
80*7304104dSAndroid Build Coastguard Worker (inlined by) bar at /tmp/x.cpp:15
81*7304104dSAndroid Build Coastguard Worker0x00000000000005d0: fubar at /tmp/x.cpp:10
82*7304104dSAndroid Build Coastguard Worker (inlined by) baz at /tmp/x.cpp:20
83*7304104dSAndroid Build Coastguard Worker0x00000000000005e0: foobar at /tmp/x.cpp:5
84*7304104dSAndroid Build Coastguard Worker (inlined by) bar at /tmp/x.cpp:15
85*7304104dSAndroid Build Coastguard Worker (inlined by) foo() at /tmp/x.cpp:25
86*7304104dSAndroid Build Coastguard Worker0x00000000000005e1: fubar at /tmp/x.cpp:10
87*7304104dSAndroid Build Coastguard Worker (inlined by) baz at /tmp/x.cpp:20
88*7304104dSAndroid Build Coastguard Worker (inlined by) foo() at /tmp/x.cpp:26
89*7304104dSAndroid Build Coastguard Worker0x00000000000005f0: fu() at /tmp/x.cpp:31
90*7304104dSAndroid Build Coastguard Worker0x00000000000005f1: fubar at /tmp/x.cpp:10
91*7304104dSAndroid Build Coastguard Worker (inlined by) fu() at /tmp/x.cpp:32
92*7304104dSAndroid Build Coastguard Worker0x00000000000005f2: foobar at /tmp/x.cpp:5
93*7304104dSAndroid Build Coastguard Worker (inlined by) fu() at /tmp/x.cpp:33
94*7304104dSAndroid Build Coastguard WorkerEOF
95*7304104dSAndroid Build Coastguard Worker
96*7304104dSAndroid Build Coastguard Workerexit 0
97