]>
Commit | Line | Data |
---|---|---|
8710b709 MM |
1 | # This testcase is part of GDB, the GNU debugger. |
2 | # | |
b811d2c2 | 3 | # Copyright 2013-2020 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 | 25 | standard_testfile exception.cc |
5b362f04 | 26 | if [prepare_for_testing "failed to prepare" $testfile $srcfile {c++ debug}] { |
8710b709 MM |
27 | return -1 |
28 | } | |
b5ac99b0 | 29 | |
8710b709 | 30 | if ![runto_main] { |
b5ac99b0 | 31 | untested "failed to run to main" |
8710b709 MM |
32 | return -1 |
33 | } | |
34 | ||
35 | # we want to see the full trace for this test | |
36 | gdb_test_no_output "set record function-call-history-size 0" | |
37 | ||
38 | # set bp | |
39 | set bp_1 [gdb_get_line_number "bp.1" $srcfile] | |
40 | set bp_2 [gdb_get_line_number "bp.2" $srcfile] | |
41 | gdb_breakpoint $bp_1 | |
42 | gdb_breakpoint $bp_2 | |
43 | ||
44 | # trace the code between the two breakpoints | |
45 | gdb_continue_to_breakpoint "cont to bp.1" ".*$srcfile:$bp_1\r\n.*" | |
11cc1b74 MM |
46 | # increase the BTS buffer size - the trace can be quite big |
47 | gdb_test_no_output "set record btrace bts buffer-size 128000" | |
8710b709 MM |
48 | gdb_test_no_output "record btrace" |
49 | gdb_continue_to_breakpoint "cont to bp.2" ".*$srcfile:$bp_2\r\n.*" | |
50 | ||
51 | # show the flat branch trace | |
52 | send_gdb "record function-call-history 1\n" | |
53 | gdb_expect_list "flat" "\r\n$gdb_prompt $" [list \ | |
3c724c8c | 54 | [multi_line \ |
6e07b1d2 MM |
55 | "1\tmain\\(\\)" \ |
56 | "2\ttest\\(\\)" \ | |
57 | "3\tfoo\\(\\)" \ | |
58 | "4\tbar\\(\\)" \ | |
59 | "5\tbad\\(\\)\r" \ | |
3c724c8c | 60 | ] \ |
8710b709 MM |
61 | "" \ |
62 | "\[0-9\]*\ttest\\(\\)"] | |
63 | ||
64 | # show the branch trace with calls indented | |
65 | send_gdb "record function-call-history /c 1\n" | |
66 | gdb_expect_list "indented" "\r\n$gdb_prompt $" [list \ | |
3c724c8c | 67 | [multi_line \ |
6e07b1d2 MM |
68 | "1\tmain\\(\\)" \ |
69 | "2\t test\\(\\)" \ | |
70 | "3\t foo\\(\\)" \ | |
71 | "4\t bar\\(\\)" \ | |
72 | "5\t bad\\(\\)\r" \ | |
3c724c8c | 73 | ] \ |
8710b709 | 74 | "" \ |
6e07b1d2 | 75 | "\[0-9\]*\t test\\(\\)"] |