2 # Copyright (C) 2013 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
21 tempfiles good.out stdin.nl stdin.nl.out stdin.nonl stdin.nonl.out foo.out
22 tempfiles addr2line.out
26 /home/drepper/gnu/new-bu/build/ttt/f.c:3
28 /home/drepper/gnu/new-bu/build/ttt/b.c:4
30 /home/drepper/gnu/new-bu/build/ttt/f.c:3
32 /home/drepper/gnu/new-bu/build/ttt/b.c:4
34 /home/drepper/gnu/new-bu/build/ttt/f.c:3
36 /home/drepper/gnu/new-bu/build/ttt/b.c:4
38 /home/drepper/gnu/new-bu/build/ttt/f.c:3
40 /home/drepper/gnu/new-bu/build/ttt/b.c:4
43 echo "# Everything on the command line"
44 cat good.out | testrun_compare ${abs_top_builddir}/src/addr2line -f -e testfile 0x08048468 0x0804845c foo bar foo+0x0 bar+0x0 foo-0x0 bar-0x0
57 echo "# Everything from stdin (with newlines)."
58 cat stdin.nl | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nl.out || exit 1
59 cmp good.out stdin.nl.out || exit 1
63 /home/drepper/gnu/new-bu/build/ttt/f.c:3
66 echo "# stdin without newline address, just EOF."
67 echo -n "0x08048468" | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nonl.out || exit 1
68 cmp foo.out stdin.nonl.out || exit 1
70 echo "# stdin without newline symbol, just EOF."
71 echo -n "foo" | testrun ${abs_top_builddir}/src/addr2line -f -e testfile > stdin.nl.out || exit 1
72 cmp foo.out stdin.nonl.out || exit 1
74 tempfiles good.addr.out
76 cat > good.addr.out <<\EOF
79 /home/drepper/gnu/new-bu/build/ttt/f.c:3
82 /home/drepper/gnu/new-bu/build/ttt/b.c:4
85 /home/drepper/gnu/new-bu/build/ttt/f.c:3
88 /home/drepper/gnu/new-bu/build/ttt/b.c:4
91 /home/drepper/gnu/new-bu/build/ttt/f.c:3
94 /home/drepper/gnu/new-bu/build/ttt/b.c:4
97 /home/drepper/gnu/new-bu/build/ttt/f.c:3
100 /home/drepper/gnu/new-bu/build/ttt/b.c:4
103 echo "# Everything on the command line with addresses"
104 cat good.addr.out | testrun_compare ${abs_top_builddir}/src/addr2line -a -f -e testfile 0x08048468 0x0804845c foo bar foo+0x0 bar+0x0 foo-0x0 bar-0x0
106 echo "# Everything from stdin (with newlines) with addresses."
107 cat stdin.nl | testrun ${abs_top_builddir}/src/addr2line -a -f -e testfile > stdin.nl.out || exit 1
108 cmp good.addr.out stdin.nl.out || exit 1
110 echo "# Pretty with functions and addresses."
111 testrun_compare ${abs_top_builddir}/src/addr2line --pretty -a -f -e testfile 0x08048468 0x0804845c << EOF
112 0x08048468: foo at /home/drepper/gnu/new-bu/build/ttt/f.c:3
113 0x0804845c: bar at /home/drepper/gnu/new-bu/build/ttt/b.c:4