blob: 2d09ec0d7ff67e037ee1d4a587ba3b988a9c8ff2 [file] [log] [blame]
Elliott Hughes03333822015-02-18 22:19:45 -08001#! /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# See run-stack-d-test.sh for dwarfinlines.cpp source.
21testfiles testfiledwarfinlines testfiledwarfinlines.core
22
23# Depending on whether we are running make check or make installcheck
24# the actual binary name under test might be different. It is used in
25# the error message, which we also try to match.
26if test "$elfutils_testrun" = "installed"; then
27STACKCMD=${bindir}/`program_transform stack`
28else
29STACKCMD=${abs_top_builddir}/src/stack
30fi
31
32# Compare with run-stack-d-test.sh to see the output without --inlines.
33# Only two call frames are visible (there is a jump from main to fu or
34# fubar).
35
36# With --inlines we get all inlined calls. Note they share the same
37# address.
38testrun_compare ${abs_top_builddir}/src/stack -n 6 -i -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
39PID 13654 - core
40TID 13654:
41#0 0x00000000004006c8 fubar
42#1 0x00000000004006c8 foobar
43#2 0x00000000004006c8 bar
44#3 0x00000000004006c8 foo
45#4 0x00000000004006c8 fu(int)
46#5 0x00000000004004c5 main
47$STACKCMD: tid 13654: shown max number of frames (6, use -n 0 for unlimited)
48EOF
49
50# With --source we can also see where in the source the inlined frames
51# where originally called from.
52testrun_compare ${abs_top_builddir}/src/stack -n 6 -s -i -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
53PID 13654 - core
54TID 13654:
55#0 0x00000000004006c8 fubar
56 /home/mark/src/tests/dwarfinlines.cpp:6
57#1 0x00000000004006c8 foobar
58 /home/mark/src/tests/dwarfinlines.cpp:14
59#2 0x00000000004006c8 bar
60 /home/mark/src/tests/dwarfinlines.cpp:21
61#3 0x00000000004006c8 foo
62 /home/mark/src/tests/dwarfinlines.cpp:27
63#4 0x00000000004006c8 fu(int)
64 /home/mark/src/tests/dwarfinlines.cpp:33
65#5 0x00000000004004c5 main
66 /home/mark/src/tests/dwarfinlines.cpp:39
67$STACKCMD: tid 13654: shown max number of frames (6, use -n 0 for unlimited)
68EOF
69
70exit 0