aboutsummaryrefslogtreecommitdiff
path: root/gdb/win32-nat.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1997-08-18 21:31:51 +0000
committerIan Lance Taylor <ian@airs.com>1997-08-18 21:31:51 +0000
commit36339ecd2b90b159b9e52d642e94e29d1ccc48ba (patch)
tree423d40227242f1e42b2a05a2762840a9a0f06acd /gdb/win32-nat.c
parentdef47b537e22f5f9fb3cad980cf6adbc710598bd (diff)
downloadgdb-36339ecd2b90b159b9e52d642e94e29d1ccc48ba.zip
gdb-36339ecd2b90b159b9e52d642e94e29d1ccc48ba.tar.gz
gdb-36339ecd2b90b159b9e52d642e94e29d1ccc48ba.tar.bz2
* win32-nat.c (handle_exception): Return a value indicating
whether the exception was handled. Don't handle random exceptions the first time around, so that structured exception handling works. (child_wait): Check the return value of handle_exception. Set the continue_status argument to ContinueDebugEvent accordingly.
Diffstat (limited to 'gdb/win32-nat.c')
-rw-r--r--gdb/win32-nat.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index 5fdea1f..664d554 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -375,7 +375,7 @@ handle_load_dll (char *eventp)
}
-static void
+static int
handle_exception (DEBUG_EVENT * event, struct target_waitstatus *ourstatus)
{
int i;
@@ -411,6 +411,12 @@ handle_exception (DEBUG_EVENT * event, struct target_waitstatus *ourstatus)
ourstatus->value.sig = TARGET_SIGNAL_TRAP;
break;
default:
+ /* This may be a structured exception handling exception. In
+ that case, we want to let the program try to handle it, and
+ only break if we see the exception a second time. */
+ if (event->u.Exception.dwFirstChance)
+ return 0;
+
printf_unfiltered ("gdb: unknown target exception 0x%08x at 0x%08x\n",
event->u.Exception.ExceptionRecord.ExceptionCode,
event->u.Exception.ExceptionRecord.ExceptionAddress);
@@ -420,6 +426,7 @@ handle_exception (DEBUG_EVENT * event, struct target_waitstatus *ourstatus)
context.ContextFlags = CONTEXT_FULL | CONTEXT_FLOATING_POINT;
GetThreadContext (current_thread, &context);
exception_count++;
+ return 1;
}
static int
@@ -436,12 +443,15 @@ child_wait (int pid, struct target_waitstatus *ourstatus)
DEBUG_EVENT event;
BOOL t = WaitForDebugEvent (&event, INFINITE);
char *p;
+ DWORD continue_status;
event_count++;
current_thread_id = event.dwThreadId;
current_process_id = event.dwProcessId;
+ continue_status = DBG_CONTINUE;
+
switch (event.dwDebugEventCode)
{
case CREATE_THREAD_DEBUG_EVENT:
@@ -490,8 +500,10 @@ child_wait (int pid, struct target_waitstatus *ourstatus)
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%d code=%s)\n",
event.dwProcessId, event.dwThreadId,
"EXCEPTION_DEBUG_EVENT"));
- handle_exception (&event, ourstatus);
- return current_process_id;
+ if (handle_exception (&event, ourstatus))
+ return current_process_id;
+ continue_status = DBG_EXCEPTION_NOT_HANDLED;
+ break;
case OUTPUT_DEBUG_STRING_EVENT: /* message from the kernel */
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%d code=%s)\n",
@@ -516,7 +528,7 @@ child_wait (int pid, struct target_waitstatus *ourstatus)
current_process_id, current_thread_id));
CHECK (ContinueDebugEvent (current_process_id,
current_thread_id,
- DBG_CONTINUE));
+ continue_status));
}
}