Commit | Line | Data |
---|---|---|
8710b709 MM |
1 | # This testcase is part of GDB, the GNU debugger. |
2 | # | |
88b9d363 | 3 | # Copyright 2013-2022 Free Software Foundation, Inc. |
8710b709 MM |
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 | ||
b5ac99b0 MM |
20 | if { [skip_btrace_tests] } { |
21 | unsupported "target does not support record-btrace" | |
22 | return -1 | |
23 | } | |
8710b709 | 24 | |
8710b709 MM |
25 | standard_testfile |
26 | ||
0fe69a94 MM |
27 | # We expect a specific function call history. This gets messed up with |
28 | # PIE on 32-bit. | |
29 | # | |
30 | # Also discard local symbols. | |
31 | if [prepare_for_testing "failed to prepare" $testfile $srcfile \ | |
c7c7253a | 32 | {ldflags=-Wl,-x nopie}] { |
8710b709 MM |
33 | return -1 |
34 | } | |
b5ac99b0 | 35 | |
8710b709 | 36 | if ![runto test] { |
b5ac99b0 | 37 | untested "failed to run to main" |
8710b709 MM |
38 | return -1 |
39 | } | |
40 | ||
41 | # we want to see the full trace for this test | |
42 | gdb_test_no_output "set record function-call-history-size 0" | |
43 | ||
44 | # trace from one call of test to the next | |
45 | gdb_test_no_output "record btrace" | |
46 | gdb_continue_to_breakpoint "cont to test" ".*test.*" | |
47 | ||
48 | # show the flat branch trace | |
3c724c8c | 49 | gdb_test "record function-call-history 1" [multi_line \ |
6e07b1d2 | 50 | "1\ttest" \ |
8710b709 MM |
51 | "2\t\\\?\\\?" \ |
52 | "3\t\\\?\\\?" \ | |
6e07b1d2 MM |
53 | "4\t\\\?\\\?" \ |
54 | "5\ttest" \ | |
55 | "6\tmain" \ | |
56 | "7\ttest" \ | |
3c724c8c | 57 | ] "flat" |
8710b709 MM |
58 | |
59 | # show the branch trace with calls indented | |
3c724c8c | 60 | gdb_test "record function-call-history /c 1" [multi_line \ |
6e07b1d2 MM |
61 | "1\t test" \ |
62 | "2\t \\\?\\\?" \ | |
63 | "3\t \\\?\\\?" \ | |
64 | "4\t \\\?\\\?" \ | |
65 | "5\t test" \ | |
66 | "6\tmain" \ | |
67 | "7\t test" \ | |
3c724c8c | 68 | ] "indented" |