1#! /bin/sh 2# Copyright (C) 2013 Red Hat, Inc. 3# Copyright (C) 2023 Mark J. Wielaard <[email protected]> 4# This file is part of elfutils. 5# 6# This file is free software; you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation; either version 3 of the License, or 9# (at your option) any later version. 10# 11# elfutils is distributed in the hope that it will be useful, but 12# WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License 17# along with this program. If not, see <http://www.gnu.org/licenses/>. 18 19. $srcdir/test-subr.sh 20 21if test -n "$ELFUTILS_DISABLE_DEMANGLE"; then 22 echo "demangler unsupported" 23 exit 77 24fi 25 26# See run-addr2line-i-test.sh 27testfiles testfile-inlines 28 29# Three variants -Cfi, -fCi -fiC all the same (with demangle) 30testrun_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 310x00000000000005a0: foobar at /tmp/x.cpp:5 320x00000000000005a1: foobar at /tmp/x.cpp:6 330x00000000000005b0: fubar at /tmp/x.cpp:10 340x00000000000005b1: fubar at /tmp/x.cpp:11 350x00000000000005c0: foobar at /tmp/x.cpp:5 36 (inlined by) bar at /tmp/x.cpp:15 370x00000000000005d0: fubar at /tmp/x.cpp:10 38 (inlined by) baz at /tmp/x.cpp:20 390x00000000000005e0: foobar at /tmp/x.cpp:5 40 (inlined by) bar at /tmp/x.cpp:15 41 (inlined by) foo() at /tmp/x.cpp:25 420x00000000000005e1: fubar at /tmp/x.cpp:10 43 (inlined by) baz at /tmp/x.cpp:20 44 (inlined by) foo() at /tmp/x.cpp:26 450x00000000000005f0: fu() at /tmp/x.cpp:31 460x00000000000005f1: fubar at /tmp/x.cpp:10 47 (inlined by) fu() at /tmp/x.cpp:32 480x00000000000005f2: foobar at /tmp/x.cpp:5 49 (inlined by) fu() at /tmp/x.cpp:33 50EOF 51 52testrun_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 530x00000000000005a0: foobar at /tmp/x.cpp:5 540x00000000000005a1: foobar at /tmp/x.cpp:6 550x00000000000005b0: fubar at /tmp/x.cpp:10 560x00000000000005b1: fubar at /tmp/x.cpp:11 570x00000000000005c0: foobar at /tmp/x.cpp:5 58 (inlined by) bar at /tmp/x.cpp:15 590x00000000000005d0: fubar at /tmp/x.cpp:10 60 (inlined by) baz at /tmp/x.cpp:20 610x00000000000005e0: foobar at /tmp/x.cpp:5 62 (inlined by) bar at /tmp/x.cpp:15 63 (inlined by) foo() at /tmp/x.cpp:25 640x00000000000005e1: fubar at /tmp/x.cpp:10 65 (inlined by) baz at /tmp/x.cpp:20 66 (inlined by) foo() at /tmp/x.cpp:26 670x00000000000005f0: fu() at /tmp/x.cpp:31 680x00000000000005f1: fubar at /tmp/x.cpp:10 69 (inlined by) fu() at /tmp/x.cpp:32 700x00000000000005f2: foobar at /tmp/x.cpp:5 71 (inlined by) fu() at /tmp/x.cpp:33 72EOF 73 74testrun_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 750x00000000000005a0: foobar at /tmp/x.cpp:5 760x00000000000005a1: foobar at /tmp/x.cpp:6 770x00000000000005b0: fubar at /tmp/x.cpp:10 780x00000000000005b1: fubar at /tmp/x.cpp:11 790x00000000000005c0: foobar at /tmp/x.cpp:5 80 (inlined by) bar at /tmp/x.cpp:15 810x00000000000005d0: fubar at /tmp/x.cpp:10 82 (inlined by) baz at /tmp/x.cpp:20 830x00000000000005e0: foobar at /tmp/x.cpp:5 84 (inlined by) bar at /tmp/x.cpp:15 85 (inlined by) foo() at /tmp/x.cpp:25 860x00000000000005e1: fubar at /tmp/x.cpp:10 87 (inlined by) baz at /tmp/x.cpp:20 88 (inlined by) foo() at /tmp/x.cpp:26 890x00000000000005f0: fu() at /tmp/x.cpp:31 900x00000000000005f1: fubar at /tmp/x.cpp:10 91 (inlined by) fu() at /tmp/x.cpp:32 920x00000000000005f2: foobar at /tmp/x.cpp:5 93 (inlined by) fu() at /tmp/x.cpp:33 94EOF 95 96exit 0 97