• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2# Copyright (C) 2014 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# // g++ x.cpp -g -fPIC -olibx.so -shared -O3 -fvisibility=hidden
21#
22# void foobar()
23# {
24#   __asm__ ( "nop" ::: );
25# }
26#
27# void foo()
28# {
29#   {
30#     void (*bar) () = foobar;
31#     bar();
32#   }
33# }
34
35testfiles testfile-lex-inlines
36
37testrun_compare ${abs_top_builddir}/src/addr2line -i -e testfile-lex-inlines 0x0000000000000680 <<\EOF
38/tmp/x.cpp:5
39EOF
40
41testrun_compare ${abs_top_builddir}/src/addr2line -i -e testfile-lex-inlines 0x0000000000000681 <<\EOF
42/tmp/x.cpp:5
43EOF
44
45testrun_compare ${abs_top_builddir}/src/addr2line -i -e testfile-lex-inlines 0x0000000000000690 <<\EOF
46/tmp/x.cpp:5
47/tmp/x.cpp:12
48EOF
49
50testrun_compare ${abs_top_builddir}/src/addr2line -i -e testfile-lex-inlines 0x0000000000000691 <<\EOF
51/tmp/x.cpp:5
52/tmp/x.cpp:12
53EOF
54
55# All together now (plus function names).
56testrun_compare ${abs_top_builddir}/src/addr2line -f -i -e testfile-lex-inlines 0x0000000000000680 0x0000000000000681 0x0000000000000690 0x0000000000000691 <<\EOF
57_Z6foobarv
58/tmp/x.cpp:5
59_Z6foobarv
60/tmp/x.cpp:5
61foobar inlined at /tmp/x.cpp:12 in _Z3foov
62/tmp/x.cpp:5
63_Z3foov
64/tmp/x.cpp:12
65foobar inlined at /tmp/x.cpp:12 in _Z3foov
66/tmp/x.cpp:5
67_Z3foov
68/tmp/x.cpp:12
69EOF
70
71exit 0
72