mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-03-07 13:39:43 +08:00
As follow-up to this discussion: https://sourceware.org/pipermail/gdb-patches/2020-August/171385.html ... make runto_main not pass no-message to runto. This means that if we fail to run to main, for some reason, we'll emit a FAIL. This is the behavior we want the majority of (if not all) the time. Without this, we rely on tests logging a failure if runto_main fails, otherwise. They do so in a very inconsisteny mannet, sometimes using "fail", "unsupported" or "untested". The messages also vary widly. This patch removes all these messages as well. Also, remove a few "fail" where we call runto (and not runto_main). by default (without an explicit no-message argument), runto prints a failure already. In two places, gdb.multi/multi-re-run.exp and gdb.python/py-pp-registration.exp, remove "message" passed to runto. This removes a few PASSes that we don't care about (but FAILs will still be printed if we fail to run to where we want to). This aligns their behavior with the rest of the testsuite. Change-Id: Ib763c98c5f4fb6898886b635210d7c34bd4b9023
118 lines
3.6 KiB
Plaintext
118 lines
3.6 KiB
Plaintext
# Copyright (C) 2015-2021 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/>.
|
|
|
|
# This test verifies that threads created by the child fork are
|
|
# properly handled. Specifically, GDB used to have a bug where it
|
|
# would leave child fork threads stuck stopped, even though "info
|
|
# threads" would show them running.
|
|
#
|
|
# See https://sourceware.org/bugzilla/show_bug.cgi?id=18600
|
|
|
|
# In remote mode, we cannot continue debugging after all
|
|
# inferiors have terminated, and this test requires that.
|
|
if { [target_info exists gdb_protocol]
|
|
&& [target_info gdb_protocol] == "remote" } {
|
|
continue
|
|
}
|
|
|
|
standard_testfile
|
|
|
|
proc do_test { detach-on-fork } {
|
|
global GDBFLAGS
|
|
global srcfile testfile
|
|
global gdb_prompt
|
|
|
|
set saved_gdbflags $GDBFLAGS
|
|
set GDBFLAGS [concat $GDBFLAGS " -ex \"set non-stop on\""]
|
|
|
|
if {[prepare_for_testing "failed to prepare" \
|
|
$testfile $srcfile {debug pthreads}] == -1} {
|
|
set GDBFLAGS $saved_gdbflags
|
|
return -1
|
|
}
|
|
|
|
set GDBFLAGS $saved_gdbflags
|
|
|
|
if ![runto_main] then {
|
|
return 0
|
|
}
|
|
|
|
gdb_test_no_output "set detach-on-fork ${detach-on-fork}"
|
|
set test "continue &"
|
|
gdb_test_multiple $test $test {
|
|
-re "$gdb_prompt " {
|
|
pass $test
|
|
}
|
|
}
|
|
|
|
# gdbserver had a bug that resulted in reporting the fork child's
|
|
# initial stop to gdb, which gdb does not expect, in turn
|
|
# resulting in a broken session, like:
|
|
#
|
|
# [Thread 31536.31536] #16 stopped. <== BAD
|
|
# [New Thread 31547.31547]
|
|
# [Inferior 10 (process 31536) exited normally]
|
|
# [New Thread 31547.31560]
|
|
#
|
|
# [Thread 31547.31547] #18 stopped. <== BAD
|
|
# Cannot remove breakpoints because program is no longer writable. <== BAD
|
|
# Further execution is probably impossible. <== BAD
|
|
# [Inferior 11 (process 31547) exited normally]
|
|
# [Inferior 1 (process 31454) exited normally]
|
|
#
|
|
# These variables track whether we see such broken behavior.
|
|
set saw_cannot_remove_breakpoints 0
|
|
set saw_thread_stopped 0
|
|
|
|
set test "inferior 1 exited"
|
|
gdb_test_multiple "" $test {
|
|
-re "Cannot remove breakpoints" {
|
|
set saw_cannot_remove_breakpoints 1
|
|
exp_continue
|
|
}
|
|
-re "Thread \[^\r\n\]+ stopped\\." {
|
|
set saw_thread_stopped 1
|
|
exp_continue
|
|
}
|
|
-re "(Thread|LWP) \[^\r\n\]+ exited" {
|
|
# Avoid timeout with check-read1
|
|
exp_continue
|
|
}
|
|
-re "New (Thread|LWP) \[^\r\n\]+" {
|
|
# Avoid timeout with check-read1
|
|
exp_continue
|
|
}
|
|
-re "Inferior 1 \(\[^\r\n\]+\) exited normally" {
|
|
pass $test
|
|
}
|
|
}
|
|
|
|
gdb_assert !$saw_cannot_remove_breakpoints \
|
|
"no failure to remove breakpoints"
|
|
gdb_assert !$saw_thread_stopped \
|
|
"no spurious thread stop"
|
|
|
|
gdb_test "info threads" "No threads\." \
|
|
"no threads left"
|
|
|
|
gdb_test "info inferiors" \
|
|
"Num\[ \t\]+Description\[ \t\]+Connection\[ \t\]+Executable\[ \t\]+\r\n\\* 1 \[^\r\n\]+" \
|
|
"only inferior 1 left"
|
|
}
|
|
|
|
foreach_with_prefix detach-on-fork {"on" "off"} {
|
|
do_test ${detach-on-fork}
|
|
}
|