1 # Copyright
(C
) 2013-2022 Free Software Foundation
, Inc.
3 # This
program is free software
; you can redistribute it and
/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation
; either version
3 of the License
, or
6 #
(at your option
) any later version.
8 # This
program is distributed in the hope that it will be useful
,
9 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License
for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this
program.
If not
, see
<http
://www.gnu.org
/licenses
/>.
16 # Regression test
for PR15693. A breakpoint with a condition that
17 # calls a function that evaluates false would result in a spurious
18 #
*running event sent to the frontend each time the breakpoint is hit
19 #
(and the target re
-resumed
). Like
:
23 #
*running
,thread
-id
="all"
25 #
*running
,thread
-id
="all"
26 #
*running
,thread
-id
="all"
27 #
*running
,thread
-id
="all"
28 #
*running
,thread
-id
="all"
29 #
*running
,thread
-id
="all"
32 load_lib mi
-support.exp
35 # Run either the multi
-threaded or the single
-threaded variant of the
36 # test
, as determined by VARIANT.
37 proc test
{ variant
} {
38 global gdb_test_file_name
39 global testfile srcdir subdir srcfile srcfile2 binfile
40 global mi_gdb_prompt async
42 with_test_prefix
"$variant" {
49 if {$variant
== "mt" } {
50 lappend options
"pthreads"
53 # Don
't use standard_testfile as we need a different binary
55 set testfile $gdb_test_file_name-$variant
56 set binfile [standard_output_file ${testfile}]
57 set srcfile $testfile.c
58 set srcfile2 $gdb_test_file_name.c
60 if {[build_executable "failed to prepare" \
62 "${srcfile} ${srcfile2}" \
68 mi_gdb_reinitialize_dir $srcdir/$subdir
69 mi_gdb_reinitialize_dir $srcdir/$subdir
70 mi_gdb_load ${binfile}
74 # Leave the breakpoint at 'test
' set, on purpose. The next
75 # resume shall emit a single '*running
,thread
-id
="all"', even
76 #
if GDB needs to step over a breakpoint
(that is
, even
if GDB
77 # needs to run only one thread
for a little bit
).
79 set bp_location
[gdb_get_line_number
"set breakpoint here" $srcfile2]
80 set bp_location_end
[gdb_get_line_number
"set end breakpoint here" $srcfile2]
82 mi_gdb_test
"-break-insert -c return_false() $srcfile2:$bp_location" ".*" \
83 "insert conditional breakpoint"
85 mi_gdb_test
"-break-insert $srcfile2:$bp_location_end" ".*" \
86 "insert end breakpoint"
88 set msg
"no spurious *running notifications"
89 send_gdb
"-exec-continue\n"
91 -re
"\\*running.*\\*running.*\\*stopped" {
94 -re
"\\^running\r\n\\*running,thread-id=\"all\"\r\n${mi_gdb_prompt}.*\\*stopped" {
102 # In sync
mode, there
's an extra prompt after *stopped. Consume it.
105 -re "$mi_gdb_prompt" {