event-tracing-gap.exp revision 1.1 1 # This testcase is part of GDB, the GNU debugger.
2 #
3 # Copyright 2024 Free Software Foundation, Inc.
4 #
5 # This program 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 # This program is distributed in the hope that it will be useful,
11 # but 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 # Test event tracing with gaps.
19
20 require allow_btrace_pt_event_trace_tests
21
22 standard_testfile
23
24 if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
25 return -1
26 }
27
28 if {![runto_main]} {
29 return -1
30 }
31
32 gdb_test_no_output "set record btrace pt event-tracing on"
33 gdb_test_no_output "record btrace pt"
34
35 set bp_1 [gdb_get_line_number "bp1"]
36 set bp_2 [gdb_get_line_number "bp2"]
37 gdb_breakpoint $bp_1
38 gdb_breakpoint $bp_2
39
40 gdb_test "next"
41
42 # Inferior calls and return commands will create gaps in the recording.
43 gdb_test "call square (3)" [multi_line \
44 "" \
45 "Breakpoint $decimal, square \\(num=3\\) at \[^\r\n\]+:$bp_1" \
46 "$decimal.*bp1.*" \
47 "The program being debugged stopped while in a function called from GDB\\." \
48 "Evaluation of the expression containing the function" \
49 "\\(square\\) will be abandoned\\." \
50 "When the function is done executing, GDB will silently stop\\."]
51
52 gdb_test "return 9" "0.*main.*" \
53 "return" \
54 "Make.*return now\\? \\(y or n\\) " "y"
55
56 gdb_continue_to_breakpoint "break at bp_1" ".*$srcfile:$bp_1.*"
57 gdb_continue_to_breakpoint "break at bp_2" ".*$srcfile:$bp_2.*"
58
59 # We should have 2 gaps and events for each breakpoint we hit.
60 # Note that due to the asynchronous nature of certain events, we use
61 # gdb_test_sequence and check only for events that we can control.
62 gdb_test_sequence "record function-call-history" "function-call-history" {
63 "\[0-9\]+\tmain"
64 "\\\[iret(: ip = $hex)?\\\]"
65 "\[0-9\]+\t\\\[non-contiguous\\\]"
66 "\[0-9\]+\tsquare"
67 "\\\[interrupt: vector = 0x3 \\\(#bp\\\)(, ip = 0x\[0-9a-fA-F\]+)?\\\]"
68 "\\\[iret(: ip = $hex)?\\\]"
69 "\[0-9\]+\t\\\[non-contiguous\\\]"
70 "\[0-9\]+\tmain"
71 "\[0-9\]+\tsquare"
72 "\\\[interrupt: vector = 0x3 \\\(#bp\\\)(, ip = 0x\[0-9a-fA-F\]+)?\\\]"
73 "\\\[iret(: ip = $hex)?\\\]"
74 "\[0-9\]+\tmain"
75 }
76