diff options
Diffstat (limited to 'gdb/nat')
-rw-r--r-- | gdb/nat/windows-nat.c | 22 | ||||
-rw-r--r-- | gdb/nat/windows-nat.h | 7 |
2 files changed, 9 insertions, 20 deletions
diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c index cd7c1d1..8c2092a 100644 --- a/gdb/nat/windows-nat.c +++ b/gdb/nat/windows-nat.c @@ -184,26 +184,8 @@ handle_exception (struct target_waitstatus *ourstatus, bool debug_exceptions) case EXCEPTION_ACCESS_VIOLATION: DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ACCESS_VIOLATION"); ourstatus->value.sig = GDB_SIGNAL_SEGV; -#ifdef __CYGWIN__ - { - /* See if the access violation happened within the cygwin DLL - itself. Cygwin uses a kind of exception handling to deal - with passed-in invalid addresses. gdb should not treat - these as real SEGVs since they will be silently handled by - cygwin. A real SEGV will (theoretically) be caught by - cygwin later in the process and will be sent as a - cygwin-specific-signal. So, ignore SEGVs if they show up - within the text segment of the DLL itself. */ - const char *fn; - CORE_ADDR addr = (CORE_ADDR) (uintptr_t) rec->ExceptionAddress; - - if ((!cygwin_exceptions && (addr >= cygwin_load_start - && addr < cygwin_load_end)) - || (find_pc_partial_function (addr, &fn, NULL, NULL) - && startswith (fn, "KERNEL32!IsBad"))) - return HANDLE_EXCEPTION_UNHANDLED; - } -#endif + if (handle_access_violation (rec)) + return HANDLE_EXCEPTION_UNHANDLED; break; case STATUS_STACK_OVERFLOW: DEBUG_EXCEPTION_SIMPLE ("STATUS_STACK_OVERFLOW"); diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h index aea1519..8d0fa9b 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -157,6 +157,13 @@ extern void handle_unload_dll (); extern bool handle_ms_vc_exception (const EXCEPTION_RECORD *rec); +/* When EXCEPTION_ACCESS_VIOLATION is processed, we give the embedding + application a chance to change it to be considered "unhandled". + This function must be supplied by the embedding application. If it + returns true, then the exception is "unhandled". */ + +extern bool handle_access_violation (const EXCEPTION_RECORD *rec); + /* Currently executing process */ extern HANDLE current_process_handle; |