aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.threads
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-10-30 15:07:07 +0000
committerPedro Alves <palves@redhat.com>2014-02-07 19:04:10 +0000
commitb5ee5a50d440d75556fbe9154e501331f9e1d3c7 (patch)
tree1fd02c0647e896e3685b3aaa2020ab11e9986223 /gdb/testsuite/gdb.threads
parentd1eb56967f0487adbdad1de6b136f083e61149ce (diff)
downloadgdb-b5ee5a50d440d75556fbe9154e501331f9e1d3c7.zip
gdb-b5ee5a50d440d75556fbe9154e501331f9e1d3c7.tar.gz
gdb-b5ee5a50d440d75556fbe9154e501331f9e1d3c7.tar.bz2
Fix gdb.threads/stepi-random-signal.exp on software single-step targets.
Currently on software single-step Linux targets we get: (gdb) PASS: gdb.threads/stepi-random-signal.exp: before stepi: get hexadecimal valueof "$pc" stepi infrun: clear_proceed_status_thread (Thread 0x7ffff7fca700 (LWP 7073)) infrun: clear_proceed_status_thread (Thread 0x7ffff7fcb740 (LWP 7069)) infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT, step=1) infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 7069)] at 0x400700 infrun: wait_for_inferior () infrun: target_wait (-1, status) = infrun: 7069 [Thread 0x7ffff7fcb740 (LWP 7069)], infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x400704 infrun: software single step trap for Thread 0x7ffff7fcb740 (LWP 7069) infrun: stepi/nexti infrun: stop_stepping 44 while (counter != 0) (gdb) FAIL: gdb.threads/stepi-random-signal.exp: stepi (no random signal) Vs hardware-step targets: (gdb) PASS: gdb.threads/stepi-random-signal.exp: before stepi: get hexadecimal valueof "$pc" stepi infrun: clear_proceed_status_thread (Thread 0x7ffff7fca700 (LWP 9565)) infrun: clear_proceed_status_thread (Thread 0x7ffff7fcb740 (LWP 9561)) infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT, step=1) infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 9561)] at 0x400700 infrun: wait_for_inferior () infrun: target_wait (-1, status) = infrun: 9561 [Thread 0x7ffff7fcb740 (LWP 9561)], infrun: status->kind = stopped, signal = GDB_SIGNAL_CHLD infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x400700 infrun: random signal (GDB_SIGNAL_CHLD) infrun: random signal, keep going infrun: resume (step=1, signal=GDB_SIGNAL_CHLD), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 9561)] at 0x400700 infrun: prepare_to_wait infrun: target_wait (-1, status) = infrun: 9561 [Thread 0x7ffff7fcb740 (LWP 9561)], infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x400704 infrun: stepi/nexti infrun: stop_stepping 44 while (counter != 0) (gdb) PASS: gdb.threads/stepi-random-signal.exp: stepi The test turns on infrun debug, does a stepi while a SIGCHLD is pending, and checks whether the "random signal" paths in infrun.c are taken. On the software single-step variant above, those paths were not taken. This is a test bug. The Linux backend short-circuits reporting signals that are set to pass/nostop/noprint. But _only_ if the thread is _not_ single-stepping. So on hardware-step targets, even though the signal is set to pass/nostop/noprint by default, the thread is indeed told to single-step, and so the core sees the signal. On the other hand, on software single-step architectures, the backend never actually gets a single-step request (steps are emulated by setting a breakpoint at the next pc, and then the target told to continue, not step). So the short-circuiting code triggers and the core doesn't see the signal. The fix is to make the test be sure the target doesn't bypass reporting the signal to the core. Tested on x86_64 Fedora 17, both with and without a series that implements software single-step for x86_64. gdb/testsuite/ 2014-02-07 Pedro Alves <palves@redhat.com> * gdb.threads/stepi-random-signal.exp: Set SIGCHLD to print.
Diffstat (limited to 'gdb/testsuite/gdb.threads')
-rw-r--r--gdb/testsuite/gdb.threads/stepi-random-signal.exp5
1 files changed, 5 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.threads/stepi-random-signal.exp b/gdb/testsuite/gdb.threads/stepi-random-signal.exp
index d099c91..168b226 100644
--- a/gdb/testsuite/gdb.threads/stepi-random-signal.exp
+++ b/gdb/testsuite/gdb.threads/stepi-random-signal.exp
@@ -56,6 +56,11 @@ delete_breakpoints
# 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.