mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-15 04:31:49 +08:00
81f47ac29f
Fix up all failures encountered when running the testsuite with GDB_DEBUG="infrun". Some tests rely on enabling debugging for various components. With debugging on, this will be lost to the debug file. Disable separate tty for mi tests when debugging. This currently does not work. disasm.c should send errors to the stderr instead of the logfile. Note that enabling debug for other components might still cause additional errors above what has been fixed here. gdb/ChangeLog: * disasm.c (set_disassembler_options): Send errors to stderr. gdb/testsuite/ChangeLog: * gdb.base/breakpoint-in-ro-region.exp: Disable when debugging. * gdb.base/debug-expr.exp: Likewise. * gdb.base/foll-fork.exp: Likewise. * gdb.base/foll-vfork.exp: Likewise. * gdb.base/fork-print-inferior-events.exp: Likewise. * gdb.base/gdb-sigterm.exp: Likewise. * gdb.base/gdbinit-history.exp: Likewise. * gdb.base/osabi.exp: Likewise. * gdb.base/sss-bp-on-user-bp-2.exp: Likewise. * gdb.base/ui-redirect.exp: Likewise. * gdb.gdb/unittest.exp: Likewise. * gdb.mi/mi-break.exp: Disable separate-mi-tty when debugging. * gdb.mi/mi-watch.exp: Likewise. * gdb.mi/new-ui-mi-sync.exp: Likewise. * gdb.mi/user-selected-context-sync.exp: Likewise. * gdb.python/python.exp: Disable debug test when debugging. * gdb.threads/check-libthread-db.exp: Disable when debugging. * gdb.threads/signal-while-stepping-over-bp-other-thread.exp: Likewise. * gdb.threads/stepi-random-signal.exp: Likewise.
117 lines
3.1 KiB
Plaintext
117 lines
3.1 KiB
Plaintext
# Copyright 2013-2019 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 relies on checking gdb debug output. Do not run if gdb debug is
|
|
# enabled as any debug will be redirected to the log.
|
|
if [gdb_debug_enabled] {
|
|
untested "debug is enabled"
|
|
return 0
|
|
}
|
|
|
|
standard_testfile
|
|
set executable ${testfile}
|
|
|
|
if { [gdb_compile_pthreads \
|
|
"${srcdir}/${subdir}/${srcfile}" \
|
|
"${binfile}" \
|
|
executable {debug}] != "" } {
|
|
untested "failed to compile"
|
|
return -1
|
|
}
|
|
|
|
clean_restart $executable
|
|
|
|
# Start the second thread.
|
|
if ![runto start] {
|
|
return -1
|
|
}
|
|
|
|
# Go back to the main thread, and leave it in the loop, where we're
|
|
# reasonably sure we don't have 'conditional jmp $pc'-like
|
|
# instructions. We wouldn't be able to detect whether a stepi makes
|
|
# progress over those.
|
|
gdb_test_no_output "set scheduler-locking on"
|
|
gdb_test "thread 1" "Switching to .*"
|
|
gdb_breakpoint $srcfile:[gdb_get_line_number "set break 2 here"]
|
|
gdb_continue_to_breakpoint "loop" ".* set break 2 here .*"
|
|
|
|
# Now back to thread 2, and let it queue a signal in thread 1.
|
|
gdb_test "thread 2" "Switching to .*"
|
|
gdb_breakpoint $srcfile:[gdb_get_line_number "set break here"]
|
|
gdb_continue_to_breakpoint "after pthread_kill" ".* set break here .*"
|
|
|
|
# We're now ready to stepi thread 1. It should immediately dequeue
|
|
# the signal.
|
|
gdb_test "thread 1" "Switching to .*" "thread 1 again"
|
|
|
|
# No longer need these.
|
|
delete_breakpoints
|
|
|
|
# Turn on infrun debugging, so we can tell whether the signal is
|
|
# really dequeued and that GDB sees it.
|
|
gdb_test_no_output "set debug infrun 1"
|
|
|
|
# Make sure the target backend reports the signal to GDB core. Some
|
|
# backends (like Linux) skip reporting a signal if set to
|
|
# pass/nostop/noprint, resuming the thread immediately instead.
|
|
gdb_test "handle SIGCHLD print"
|
|
|
|
# Helper to extract the current PC. PREFIX is used to make each call
|
|
# have its own unique test name.
|
|
|
|
proc get_pc { prefix } {
|
|
with_test_prefix "$prefix" {
|
|
return [get_hexadecimal_valueof "\$pc" ""]
|
|
}
|
|
}
|
|
|
|
set prev_addr [get_pc "before stepi"]
|
|
if {$prev_addr == ""} {
|
|
return
|
|
}
|
|
|
|
# True if we saw the infrun path we want to test be exercised.
|
|
set seen 0
|
|
|
|
set test "stepi"
|
|
if {[gdb_test_multiple "stepi" "$test" {
|
|
-re "infrun: random signal" {
|
|
set seen 1
|
|
exp_continue
|
|
}
|
|
-re "$gdb_prompt $" {
|
|
}
|
|
}] != 0} {
|
|
return
|
|
}
|
|
|
|
if {$seen} {
|
|
pass "$test"
|
|
} else {
|
|
fail "$test (no random signal)"
|
|
}
|
|
|
|
set addr [get_pc "after stepi"]
|
|
if {$addr == ""} {
|
|
return
|
|
}
|
|
|
|
set test "stepi interfered by signal makes progress"
|
|
if {$addr == $prev_addr} {
|
|
fail "$test"
|
|
} else {
|
|
pass "$test"
|
|
}
|