btrace: increase buffer size for exception test
[external/binutils.git] / gdb / testsuite / gdb.btrace / multi-thread-step.exp
1 # This testcase is part of GDB, the GNU debugger.
2 #
3 # Copyright 2013-2015 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
20 # check for btrace support
21 if { [skip_btrace_tests] } { return -1 }
22
23 # start inferior
24 standard_testfile
25 if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" "$binfile" executable {debug}] != "" } {
26     return -1
27 }
28 clean_restart $testfile
29
30 if ![runto_main] {
31     return -1
32 }
33
34 # set up breakpoints
35 set bp_1 [gdb_get_line_number "bp.1" $srcfile]
36 set bp_2 [gdb_get_line_number "bp.2" $srcfile]
37 set bp_3 [gdb_get_line_number "bp.3" $srcfile]
38
39 proc gdb_cont_to_line { line } {
40         gdb_breakpoint $line
41         gdb_continue_to_breakpoint "cont to $line" ".*$line\r\n.*"
42         delete_breakpoints
43 }
44
45 # trace the code between the two breakpoints
46 delete_breakpoints
47 gdb_cont_to_line $srcfile:$bp_1
48 # make sure GDB knows about the new thread
49 gdb_test "info threads" ".*"
50 gdb_test_no_output "record btrace"
51 gdb_cont_to_line $srcfile:$bp_2
52
53 # navigate in the trace history for both threads
54 with_test_prefix "navigate" {
55   gdb_test "thread 1" ".*"
56   with_test_prefix "thread 1" {
57     gdb_test "record goto begin" ".*"
58     gdb_test "info record" ".*Replay in progress\.  At instruction 1\."
59   }
60   gdb_test "thread 2" ".*"
61   with_test_prefix "thread 2" {
62     gdb_test "record goto begin" ".*"
63     gdb_test "info record" ".*Replay in progress\.  At instruction 1\."
64   }
65 }
66
67 # step both threads
68 with_test_prefix "step" {
69   gdb_test "thread 1" ".*"
70   with_test_prefix "thread 1" {
71     gdb_test "info record" ".*Replay in progress\.  At instruction 1\."
72     gdb_test "stepi" ".*"
73     gdb_test "info record" ".*Replay in progress\.  At instruction 2\."
74   }
75   gdb_test "thread 2" ".*"
76   with_test_prefix "thread 2" {
77     gdb_test "info record" ".*Replay in progress\.  At instruction 1\."
78     gdb_test "stepi" ".*"
79     gdb_test "info record" ".*Replay in progress\.  At instruction 2\."
80   }
81 }
82
83 # run to the end of the history for both threads
84 with_test_prefix "cont" {
85   gdb_test "thread 1" ".*"
86   with_test_prefix "thread 1" {
87     gdb_test "info record" ".*Replay in progress\.  At instruction 2\."
88     gdb_test "continue" "No more reverse-execution history.*"
89   }
90   gdb_test "thread 2" ".*"
91   with_test_prefix "thread 2" {
92     gdb_test "info record" ".*Replay in progress\.  At instruction 2\."
93     gdb_test "continue" "No more reverse-execution history.*"
94   }
95 }
96
97 # reverse-step both threads
98 with_test_prefix "reverse-step" {
99   gdb_test "thread 1" ".*"
100   with_test_prefix "thread 1" {
101     gdb_test "reverse-stepi" ".*"
102     gdb_test "info record" ".*Replay in progress\..*"
103   }
104   gdb_test "thread 2" ".*"
105   with_test_prefix "thread 2" {
106     gdb_test "reverse-stepi" ".*"
107     gdb_test "info record" ".*Replay in progress\..*"
108   }
109 }
110
111 # both threads are still replaying
112 with_test_prefix "check" {
113   gdb_test "thread 1" ".*"
114   with_test_prefix "thread 1" {
115     gdb_test "info record" ".*Replay in progress\..*"
116   }
117   gdb_test "thread 2" ".*"
118   with_test_prefix "thread 2" {
119     gdb_test "info record" ".*Replay in progress\..*"
120   }
121 }
122
123 # navigate back into the history for thread 1 and continue thread 2
124 with_test_prefix "cont" {
125   gdb_test "thread 1" ".*"
126   with_test_prefix "thread 1" {
127     gdb_test "record goto begin" ".*"
128     gdb_test "info record" ".*Replay in progress\.  At instruction 1\."
129   }
130   gdb_test "thread 2" ".*"
131   with_test_prefix "thread 2" {
132     gdb_test "record goto end" ".*"
133     gdb_cont_to_line $srcfile:$bp_3
134   }
135 }