diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2015-04-15 21:41:25 +0100 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2015-04-22 19:54:22 +0100 |
commit | f16eab5ffbd9128410241abc48edcd5871c91137 (patch) | |
tree | bd51570f5cbfa415feeadb0ef57b3bf98353936c | |
parent | 68ffc90245e2e51ba5f096f166ae49262d461b5e (diff) | |
download | gdb-f16eab5ffbd9128410241abc48edcd5871c91137.zip gdb-f16eab5ffbd9128410241abc48edcd5871c91137.tar.gz gdb-f16eab5ffbd9128410241abc48edcd5871c91137.tar.bz2 |
windows-nat: Don't change current_event.dwThreadId in handle_output_debug_string()
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.
main () at ../../../gdb/testsuite/gdb.base/catch-signal.c:40
40 raise (SIGHUP); /* second HUP */
Failed to resume program execution (ContinueDebugEvent failed, error 87)
(gdb)
This error occurs because when handle_output_debug_string processes a Cygwin
signal message, it re-writes current_event.dwThreadId to reflect the thread that
the signal will be delivered to, which can be different to the thread reporting
the signal.
Altering current_event.dwThreadId() will cause ContinueDebugEvent() to be
applied to the wrong thread and fail.
So, rather than re-writing the thread id in current_event, use the thread
id by returning it.
With this patch applied this test now yields the expected result:
$ ./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)
gdb/ChangeLog:
2015-04-22 Jon Turney <jon.turney@dronecode.org.uk>
* windows-nat.c (handle_output_debug_string): Don't change
current_event.dwThreadId.
(get_windows_debug_event): Use thread_id, rather than relying on
current_event.dwThreadId being changed.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/windows-nat.c | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1d64788..f5ea395 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2015-04-22 Jon Turney <jon.turney@dronecode.org.uk> + * windows-nat.c (handle_output_debug_string): Don't change + current_event.dwThreadId. + (get_windows_debug_event): Use thread_id, rather than relying on + current_event.dwThreadId being changed. + +2015-04-22 Jon Turney <jon.turney@dronecode.org.uk> + * windows-nat.c (windows_continue): Report an error if ContinueDebugEvent() fails. diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 6942d64..be5d7e8 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -850,7 +850,6 @@ handle_output_debug_string (struct target_waitstatus *ourstatus) __COPY_CONTEXT_SIZE, &n) && n == __COPY_CONTEXT_SIZE) have_saved_context = 1; - current_event.dwThreadId = retval; } } #endif @@ -1509,7 +1508,7 @@ get_windows_debug_event (struct target_ops *ops, thread_id); current_thread = th; if (!current_thread) - current_thread = thread_rec (current_event.dwThreadId, TRUE); + current_thread = thread_rec (thread_id, TRUE); } out: |