blob: 35203ab5766e72651e893996a2399a070a0dd33d [file] [log] [blame]
# Copyright 2020-2026 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test the set/show suppress-cli-notifications command.
standard_testfile
if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
{debug pthreads}] } {
return
}
if {![runto_main]} {
return
}
delete_breakpoints
gdb_breakpoint [gdb_get_line_number "Break here"]
gdb_continue_to_breakpoint "threads created"
if {![use_gdb_stub]} {
gdb_test "add-inferior -exec $binfile" ".*" \
"add a second inferior"
gdb_test "inferior 2" ".*Switching to inferior 2 .*" \
"inferior switch is not suppressed"
gdb_test "info breakpoints"
gdb_test "info inferiors"
gdb_test "info connections"
gdb_run_cmd
gdb_test_multiple "" "stop at breakpoint in inferior 2" {
-wrap -re "Breakpoint ${::decimal}(?:\\.${::decimal})?, main .*" {
pass $gdb_test_name
}
}
}
gdb_test_no_output "set suppress-cli-notifications on"
if {![use_gdb_stub]} {
gdb_test_no_output "inferior 1" \
"inferior switch is suppressed when changing inferior"
}
gdb_test_no_output "inferior 1" \
"inferior switch is suppressed when same inferior selected"
gdb_test_no_output "next" "stepping is suppressed"
gdb_test_no_output "thread 2" "switch to a new thread"
gdb_test_no_output "thread 2" "switch to the same thread"
# Now check that suppression can be turned back off.
gdb_test_no_output "set suppress-cli-notifications off"
gdb_test "thread 1" \
[multi_line \
"\\\[Switching to thread 1\[^\r\n\]*\\\]" \
"#0\\s+main\[^\r\n\]+" \
"\[^\r\n\]+Second\\. \\*/"]
gdb_test_no_output "set wait_for_gdb = 0" \
"set wait_for_gdb in first inferior"
if {![use_gdb_stub]} {
gdb_test "inferior 2" ".*Switching to inferior 2 .* to thread 2\\.1 .*" \
"inferior switch is not suppressed again"
gdb_test "next" ".*Second.*" "stepping is not suppressed"
gdb_test_no_output "set wait_for_gdb = 0" \
"set wait_for_gdb in second inferior"
}