aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2015-04-15 21:37:11 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2015-04-22 19:40:11 +0100
commit68ffc90245e2e51ba5f096f166ae49262d461b5e (patch)
tree99077c3e086c70bc6873649b98b8d36dd30bbfcc /gdb
parent23942819fca67effa062a9639be5df3fb074b322 (diff)
downloadgdb-68ffc90245e2e51ba5f096f166ae49262d461b5e.zip
gdb-68ffc90245e2e51ba5f096f166ae49262d461b5e.tar.gz
gdb-68ffc90245e2e51ba5f096f166ae49262d461b5e.tar.bz2
windows-nat: Report an error if ContinueDebugEvent() fails
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] This is due to a defect in the way Cygwin signals are handled: 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. Subsequently, the call to ContinueDebugEvent will fail, because we're trying to resume the wrong thread. GDB is then stuck waiting forever for another event that will never come. This patch doesn't fix the problem, it just adds appropriate error handling. Using error() seems appropriate here, if ContinueDebugEvent() fails, the inferior is in an unknown state and we will probably not be debugging it anymore. With this patch applied, resuming the execution of the program now yields: $ ./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) gdb/ChangeLog: 2015-04-22 Jon Turney <jon.turney@dronecode.org.uk> * windows-nat.c (windows_continue): Report an error if ContinueDebugEvent() fails.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/windows-nat.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d5edf3c..1d64788 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-22 Jon Turney <jon.turney@dronecode.org.uk>
+
+ * windows-nat.c (windows_continue): Report an error if
+ ContinueDebugEvent() fails.
+
2015-04-16 Jon Turney <jon.turney@dronecode.org.uk>
* windows-nat.c (windows_resume): Fix misspelling in debug output.
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 05e4cee..6942d64 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1160,6 +1160,11 @@ windows_continue (DWORD continue_status, int id, int killed)
current_event.dwThreadId,
continue_status);
+ if (!res)
+ error (_("Failed to resume program execution"
+ " (ContinueDebugEvent failed, error %u)"),
+ (unsigned int) GetLastError ());
+
debug_registers_changed = 0;
return res;
}