event-tracing-gap.exp revision 1.1 1 1.1 christos # This testcase is part of GDB, the GNU debugger.
2 1.1 christos #
3 1.1 christos # Copyright 2024 Free Software Foundation, Inc.
4 1.1 christos #
5 1.1 christos # This program is free software; you can redistribute it and/or modify
6 1.1 christos # it under the terms of the GNU General Public License as published by
7 1.1 christos # the Free Software Foundation; either version 3 of the License, or
8 1.1 christos # (at your option) any later version.
9 1.1 christos #
10 1.1 christos # This program is distributed in the hope that it will be useful,
11 1.1 christos # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 1.1 christos # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 1.1 christos # GNU General Public License for more details.
14 1.1 christos #
15 1.1 christos # You should have received a copy of the GNU General Public License
16 1.1 christos # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 1.1 christos
18 1.1 christos # Test event tracing with gaps.
19 1.1 christos
20 1.1 christos require allow_btrace_pt_event_trace_tests
21 1.1 christos
22 1.1 christos standard_testfile
23 1.1 christos
24 1.1 christos if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
25 1.1 christos return -1
26 1.1 christos }
27 1.1 christos
28 1.1 christos if {![runto_main]} {
29 1.1 christos return -1
30 1.1 christos }
31 1.1 christos
32 1.1 christos gdb_test_no_output "set record btrace pt event-tracing on"
33 1.1 christos gdb_test_no_output "record btrace pt"
34 1.1 christos
35 1.1 christos set bp_1 [gdb_get_line_number "bp1"]
36 1.1 christos set bp_2 [gdb_get_line_number "bp2"]
37 1.1 christos gdb_breakpoint $bp_1
38 1.1 christos gdb_breakpoint $bp_2
39 1.1 christos
40 1.1 christos gdb_test "next"
41 1.1 christos
42 1.1 christos # Inferior calls and return commands will create gaps in the recording.
43 1.1 christos gdb_test "call square (3)" [multi_line \
44 1.1 christos "" \
45 1.1 christos "Breakpoint $decimal, square \\(num=3\\) at \[^\r\n\]+:$bp_1" \
46 1.1 christos "$decimal.*bp1.*" \
47 1.1 christos "The program being debugged stopped while in a function called from GDB\\." \
48 1.1 christos "Evaluation of the expression containing the function" \
49 1.1 christos "\\(square\\) will be abandoned\\." \
50 1.1 christos "When the function is done executing, GDB will silently stop\\."]
51 1.1 christos
52 1.1 christos gdb_test "return 9" "0.*main.*" \
53 1.1 christos "return" \
54 1.1 christos "Make.*return now\\? \\(y or n\\) " "y"
55 1.1 christos
56 1.1 christos gdb_continue_to_breakpoint "break at bp_1" ".*$srcfile:$bp_1.*"
57 1.1 christos gdb_continue_to_breakpoint "break at bp_2" ".*$srcfile:$bp_2.*"
58 1.1 christos
59 1.1 christos # We should have 2 gaps and events for each breakpoint we hit.
60 1.1 christos # Note that due to the asynchronous nature of certain events, we use
61 1.1 christos # gdb_test_sequence and check only for events that we can control.
62 1.1 christos gdb_test_sequence "record function-call-history" "function-call-history" {
63 1.1 christos "\[0-9\]+\tmain"
64 1.1 christos "\\\[iret(: ip = $hex)?\\\]"
65 1.1 christos "\[0-9\]+\t\\\[non-contiguous\\\]"
66 1.1 christos "\[0-9\]+\tsquare"
67 1.1 christos "\\\[interrupt: vector = 0x3 \\\(#bp\\\)(, ip = 0x\[0-9a-fA-F\]+)?\\\]"
68 1.1 christos "\\\[iret(: ip = $hex)?\\\]"
69 1.1 christos "\[0-9\]+\t\\\[non-contiguous\\\]"
70 1.1 christos "\[0-9\]+\tmain"
71 1.1 christos "\[0-9\]+\tsquare"
72 1.1 christos "\\\[interrupt: vector = 0x3 \\\(#bp\\\)(, ip = 0x\[0-9a-fA-F\]+)?\\\]"
73 1.1 christos "\\\[iret(: ip = $hex)?\\\]"
74 1.1 christos "\[0-9\]+\tmain"
75 1.1 christos }
76