xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.btrace/unknown_functions.exp (revision 8b657b0747480f8989760d71343d6dd33f8d4cf9)
1# This testcase is part of GDB, the GNU debugger.
2#
3# Copyright 2013-2023 Free Software Foundation, Inc.
4#
5# Contributed by Intel Corp. <markus.t.metzger@intel.com>
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20if { [skip_btrace_tests] } {
21    unsupported "target does not support record-btrace"
22    return -1
23}
24
25standard_testfile
26
27# We expect a specific function call history.  This gets messed up with
28# PIE on 32-bit.
29#
30# Also discard local symbols.
31if [prepare_for_testing "failed to prepare" $testfile $srcfile \
32	{ldflags=-Wl,-x nopie}] {
33    return -1
34}
35
36if ![runto test] {
37    return -1
38}
39
40# we want to see the full trace for this test
41gdb_test_no_output "set record function-call-history-size 0"
42
43# trace from one call of test to the next
44gdb_test_no_output "record btrace"
45gdb_continue_to_breakpoint "cont to test" ".*test.*"
46
47# show the flat branch trace
48gdb_test "record function-call-history 1" [multi_line \
49  "1\ttest" \
50  "2\t\\\?\\\?" \
51  "3\t\\\?\\\?" \
52  "4\t\\\?\\\?" \
53  "5\ttest" \
54  "6\tmain" \
55  "7\ttest" \
56  ] "flat"
57
58# show the branch trace with calls indented
59gdb_test "record function-call-history /c 1" [multi_line \
60  "1\t  test" \
61  "2\t    \\\?\\\?" \
62  "3\t      \\\?\\\?" \
63  "4\t    \\\?\\\?" \
64  "5\t  test" \
65  "6\tmain" \
66  "7\t  test" \
67  ] "indented"
68