This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 0/5] Fix to Cygwin-specific signal handling (v2)
- From: Jon Turney <jon dot turney at dronecode dot org dot uk>
- To: gdb-patches at sourceware dot org
- Cc: Jon Turney <jon dot turney at dronecode dot org dot uk>
- Date: Thu, 16 Apr 2015 20:23:24 +0100
- Subject: [PATCH 0/5] Fix to Cygwin-specific signal handling (v2)
- Authentication-results: sourceware.org; auth=none
- References: <1429009382-21040-1-git-send-email-jon dot turney at dronecode dot org dot uk>
Some cleanups in windows-nat.c and a fix to Cygwin-specific signal handling.
Using the 'catch-signal' test from the testsuite, on x86_64 Cygwin:
$ ./gdb testsuite/outputs/gdb.base/catch-signal/catch-signal.exe
[...]
(gdb) catch signal
Catchpoint 1 (standard signals)
(gdb) r
[...]
Catchpoint 1 (signal SIGHUP), main () at
../../../gdb/testsuite/gdb.base/catch-signal.c:40
40 raise (SIGHUP); /* second HUP */
(gdb) c
Continuing.
[hangs]
with up to [4/5] applied:
$ ./gdb testsuite/outputs/gdb.base/catch-signal/catch-signal.exe
[...]
(gdb) catch signal
Catchpoint 1 (standard signals)
(gdb) r
[...]
Catchpoint 1 (signal SIGHUP), main () at
../../../gdb/testsuite/gdb.base/catch-signal.c:40
40 raise (SIGHUP); /* second HUP */
(gdb) c
Continuing.
main () at ../../../gdb/testsuite/gdb.base/catch-signal.c:40
40 raise (SIGHUP); /* second HUP */
ContinueDebugEvent failed, GetLastError = 87
(gdb)
It can be seen that changing current_event.dwThreadId as
handle_output_debug_string does when processing a Cygwin signal message, leads
to ContinueDebugEvent() being applied to the wrong thead, with tragic
consequences.
with [5/5] applied:
$ ./gdb testsuite/outputs/gdb.base/catch-signal/catch-signal.exe
[...]
(gdb) catch signal
Catchpoint 1 (standard signals)
(gdb) r
[...]
Catchpoint 1 (signal SIGHUP), main () at
../../../gdb/testsuite/gdb.base/catch-signal.c:40
40 raise (SIGHUP); /* second HUP */
(gdb) c
Continuing.
Catchpoint 1 (signal SIGHUP), main () at
../../../gdb/testsuite/gdb.base/catch-signal.c:42
42 raise (SIGHUP); /* third HUP */
(gdb)
It looks like tests don't finish with an unresponsive gdb, and there are more
tests in the testsuite which have this problem than my computer has cores, so
eventually it ends up stuck on those tests, and the test run doesn't finish.
After these patches, there still remain some problems with Cygwin-specific
signal handling, which hopefully I can address in future patches.
Jon Turney (5):
windows-nat: Don't use ternary conditional operator in
get_windows_debug_event
windows-nat: Cleanups in get_windows_debug_event
windows-nat: Fix misspelling in debug output
windows-nat: Report an error if ContinueDebugEvent() fails
windows-nat: Don't change current_event.dwThreadId in
handle_output_debug_string()
gdb/ChangeLog | 26 ++++++++++++++++++++++++++
gdb/windows-nat.c | 41 +++++++++++++++++++++++------------------
2 files changed, 49 insertions(+), 18 deletions(-)
--
2.1.4