* gdb patch take 6
@ 2003-09-29 15:40 Jeremy Bettis
2003-11-14 19:22 ` Christopher Faylor
0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Bettis @ 2003-09-29 15:40 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 494 bytes --]
* gdb/win32-nat.c
(handle_exception,get_child_debug_event,_initialize_inftarg) When debugging
a program that uses windows SEH gdb stops the program even if the inferior's
exception handler catches the exception. I have added a new set option,
"set mapexceptionstosignals off" that will cause gdb to completely ignore
WIN32 exceptions. This is similar to the feature "set signal-exceptions 4"
in the Apple Openstep version of gdb 4.15.3.
This patch is relative to gdb-5.2.1-1 from mingw.org.
[-- Attachment #2: gdbpatch.txt --]
[-- Type: text/plain, Size: 9863 bytes --]
--- gdb-5.2.1/gdb/win32-nat.c Sun Feb 16 16:03:19 2003
+++ gdb-mine/gdb/win32-nat.c Mon Sep 15 09:57:48 2003
@@ -200,6 +200,7 @@ static int debug_events = 0; /* show ev
static int debug_memory = 0; /* show target memory accesses */
static int debug_exceptions = 0; /* show target exceptions */
static int useshell = 0; /* use shell for subprocesses */
+static int mapexceptionstosignals = 1; /* map exceptionstosignals */
/* This vector maps GDB's idea of a register's number into an address
in the win32 exception context vector.
@@ -1024,93 +1025,126 @@ handle_exception (struct target_waitstat
/* Record the context of the current thread */
th = thread_rec (current_event.dwThreadId, -1);
- switch (code)
+ if (mapexceptionstosignals)
{
- case EXCEPTION_ACCESS_VIOLATION:
- DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ACCESS_VIOLATION");
- ourstatus->value.sig = TARGET_SIGNAL_SEGV;
- break;
- case STATUS_STACK_OVERFLOW:
- DEBUG_EXCEPTION_SIMPLE ("STATUS_STACK_OVERFLOW");
- ourstatus->value.sig = TARGET_SIGNAL_SEGV;
- break;
- case STATUS_FLOAT_DENORMAL_OPERAND:
- DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_DENORMAL_OPERAND");
- ourstatus->value.sig = TARGET_SIGNAL_FPE;
- break;
- case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
- DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
- ourstatus->value.sig = TARGET_SIGNAL_FPE;
- break;
- case STATUS_FLOAT_INEXACT_RESULT:
- DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_INEXACT_RESULT");
- ourstatus->value.sig = TARGET_SIGNAL_FPE;
- break;
- case STATUS_FLOAT_INVALID_OPERATION:
- DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_INVALID_OPERATION");
- ourstatus->value.sig = TARGET_SIGNAL_FPE;
- break;
- case STATUS_FLOAT_OVERFLOW:
- DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_OVERFLOW");
- ourstatus->value.sig = TARGET_SIGNAL_FPE;
- break;
- case STATUS_FLOAT_STACK_CHECK:
- DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_STACK_CHECK");
- ourstatus->value.sig = TARGET_SIGNAL_FPE;
- break;
- case STATUS_FLOAT_UNDERFLOW:
- DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_UNDERFLOW");
- ourstatus->value.sig = TARGET_SIGNAL_FPE;
- break;
- case STATUS_FLOAT_DIVIDE_BY_ZERO:
- DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_DIVIDE_BY_ZERO");
- ourstatus->value.sig = TARGET_SIGNAL_FPE;
- break;
- case STATUS_INTEGER_DIVIDE_BY_ZERO:
- DEBUG_EXCEPTION_SIMPLE ("STATUS_INTEGER_DIVIDE_BY_ZERO");
- ourstatus->value.sig = TARGET_SIGNAL_FPE;
- break;
- case STATUS_INTEGER_OVERFLOW:
- DEBUG_EXCEPTION_SIMPLE ("STATUS_INTEGER_OVERFLOW");
- ourstatus->value.sig = TARGET_SIGNAL_FPE;
- break;
- case EXCEPTION_BREAKPOINT:
- DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT");
- ourstatus->value.sig = TARGET_SIGNAL_TRAP;
- break;
- case DBG_CONTROL_C:
- DEBUG_EXCEPTION_SIMPLE ("DBG_CONTROL_C");
- ourstatus->value.sig = TARGET_SIGNAL_INT;
- break;
- case DBG_CONTROL_BREAK:
- DEBUG_EXCEPTION_SIMPLE ("DBG_CONTROL_BREAK");
- ourstatus->value.sig = TARGET_SIGNAL_INT;
- break;
- case EXCEPTION_SINGLE_STEP:
- DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_SINGLE_STEP");
- ourstatus->value.sig = TARGET_SIGNAL_TRAP;
- break;
- case EXCEPTION_ILLEGAL_INSTRUCTION:
- DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ILLEGAL_INSTRUCTION");
- ourstatus->value.sig = TARGET_SIGNAL_ILL;
- break;
- case EXCEPTION_PRIV_INSTRUCTION:
- DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_PRIV_INSTRUCTION");
- ourstatus->value.sig = TARGET_SIGNAL_ILL;
- break;
- case EXCEPTION_NONCONTINUABLE_EXCEPTION:
- DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_NONCONTINUABLE_EXCEPTION");
- ourstatus->value.sig = TARGET_SIGNAL_ILL;
- break;
- default:
- if (current_event.u.Exception.dwFirstChance)
- return 0;
- printf_unfiltered ("gdb: unknown target exception 0x%08lx at 0x%08lx\n",
- current_event.u.Exception.ExceptionRecord.ExceptionCode,
- (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress);
- ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
- break;
- }
+ switch (code)
+ {
+ case EXCEPTION_ACCESS_VIOLATION:
+ DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ACCESS_VIOLATION");
+ ourstatus->value.sig = TARGET_SIGNAL_SEGV;
+ break;
+ case STATUS_STACK_OVERFLOW:
+ DEBUG_EXCEPTION_SIMPLE ("STATUS_STACK_OVERFLOW");
+ ourstatus->value.sig = TARGET_SIGNAL_SEGV;
+ break;
+ case STATUS_FLOAT_DENORMAL_OPERAND:
+ DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_DENORMAL_OPERAND");
+ ourstatus->value.sig = TARGET_SIGNAL_FPE;
+ break;
+ case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
+ DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
+ ourstatus->value.sig = TARGET_SIGNAL_FPE;
+ break;
+ case STATUS_FLOAT_INEXACT_RESULT:
+ DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_INEXACT_RESULT");
+ ourstatus->value.sig = TARGET_SIGNAL_FPE;
+ break;
+ case STATUS_FLOAT_INVALID_OPERATION:
+ DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_INVALID_OPERATION");
+ ourstatus->value.sig = TARGET_SIGNAL_FPE;
+ break;
+ case STATUS_FLOAT_OVERFLOW:
+ DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_OVERFLOW");
+ ourstatus->value.sig = TARGET_SIGNAL_FPE;
+ break;
+ case STATUS_FLOAT_STACK_CHECK:
+ DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_STACK_CHECK");
+ ourstatus->value.sig = TARGET_SIGNAL_FPE;
+ break;
+ case STATUS_FLOAT_UNDERFLOW:
+ DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_UNDERFLOW");
+ ourstatus->value.sig = TARGET_SIGNAL_FPE;
+ break;
+ case STATUS_FLOAT_DIVIDE_BY_ZERO:
+ DEBUG_EXCEPTION_SIMPLE ("STATUS_FLOAT_DIVIDE_BY_ZERO");
+ ourstatus->value.sig = TARGET_SIGNAL_FPE;
+ break;
+ case STATUS_INTEGER_DIVIDE_BY_ZERO:
+ DEBUG_EXCEPTION_SIMPLE ("STATUS_INTEGER_DIVIDE_BY_ZERO");
+ ourstatus->value.sig = TARGET_SIGNAL_FPE;
+ break;
+ case STATUS_INTEGER_OVERFLOW:
+ DEBUG_EXCEPTION_SIMPLE ("STATUS_INTEGER_OVERFLOW");
+ ourstatus->value.sig = TARGET_SIGNAL_FPE;
+ break;
+ case EXCEPTION_BREAKPOINT:
+ DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT");
+ ourstatus->value.sig = TARGET_SIGNAL_TRAP;
+ break;
+ case DBG_CONTROL_C:
+ DEBUG_EXCEPTION_SIMPLE ("DBG_CONTROL_C");
+ ourstatus->value.sig = TARGET_SIGNAL_INT;
+ break;
+ case DBG_CONTROL_BREAK:
+ DEBUG_EXCEPTION_SIMPLE ("DBG_CONTROL_BREAK");
+ ourstatus->value.sig = TARGET_SIGNAL_INT;
+ break;
+ case EXCEPTION_SINGLE_STEP:
+ DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_SINGLE_STEP");
+ ourstatus->value.sig = TARGET_SIGNAL_TRAP;
+ break;
+ case EXCEPTION_ILLEGAL_INSTRUCTION:
+ DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_ILLEGAL_INSTRUCTION");
+ ourstatus->value.sig = TARGET_SIGNAL_ILL;
+ break;
+ case EXCEPTION_PRIV_INSTRUCTION:
+ DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_PRIV_INSTRUCTION");
+ ourstatus->value.sig = TARGET_SIGNAL_ILL;
+ break;
+ case EXCEPTION_NONCONTINUABLE_EXCEPTION:
+ DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_NONCONTINUABLE_EXCEPTION");
+ ourstatus->value.sig = TARGET_SIGNAL_ILL;
+ break;
+ default:
+ if (current_event.u.Exception.dwFirstChance)
+ return 0;
+ printf_unfiltered ("gdb: unknown target exception 0x%08lx at 0x%08lx\n",
+ current_event.u.Exception.ExceptionRecord.ExceptionCode,
+ (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress);
+ ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
+ break;
+ }
+ }
+ else
+ {
+ switch (code)
+ {
+ case EXCEPTION_BREAKPOINT:
+ DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT");
+ ourstatus->value.sig = TARGET_SIGNAL_TRAP;
+ break;
+ case DBG_CONTROL_C:
+ DEBUG_EXCEPTION_SIMPLE ("DBG_CONTROL_C");
+ ourstatus->value.sig = TARGET_SIGNAL_INT;
+ break;
+ case DBG_CONTROL_BREAK:
+ DEBUG_EXCEPTION_SIMPLE ("DBG_CONTROL_BREAK");
+ ourstatus->value.sig = TARGET_SIGNAL_INT;
+ break;
+ case EXCEPTION_SINGLE_STEP:
+ DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_SINGLE_STEP");
+ ourstatus->value.sig = TARGET_SIGNAL_TRAP;
+ break;
+ default:
+ if (current_event.u.Exception.dwFirstChance)
+ return 0;
+ printf_unfiltered ("gdb: unknown target exception 0x%08lx at 0x%08lx\n",
+ current_event.u.Exception.ExceptionRecord.ExceptionCode,
+ (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress);
+ ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
+ break;
+ }
+ }
exception_count++;
last_sig = ourstatus->value.sig;
return 1;
@@ -1286,6 +1320,7 @@ get_child_debug_event (int pid, struct t
"EXCEPTION_DEBUG_EVENT"));
if (saw_create != 1)
break;
+ continue_status=DBG_EXCEPTION_NOT_HANDLED;
if (handle_exception (ourstatus))
retval = current_event.dwThreadId;
break;
@@ -1972,6 +2007,12 @@ _initialize_inftarg (void)
add_show_from_set (add_set_cmd ("debugexceptions", class_support, var_boolean,
(char *) &debug_exceptions,
"Set whether to display kernel exceptions in child process.",
+ &setlist),
+ &showlist);
+
+ add_show_from_set (add_set_cmd ("mapexceptionstosignals", class_support, var_boolean,
+ (char *) &mapexceptionstosignals,
+ "Set whether to convert WIN32 exceptions to gdb signals.",
&setlist),
&showlist);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gdb patch take 6
2003-09-29 15:40 gdb patch take 6 Jeremy Bettis
@ 2003-11-14 19:22 ` Christopher Faylor
2003-11-14 21:19 ` Jeremy Bettis
0 siblings, 1 reply; 3+ messages in thread
From: Christopher Faylor @ 2003-11-14 19:22 UTC (permalink / raw)
To: gdb-patches; +Cc: jeremy
[no personal replies please, reply-to set -- beware!]
On Mon, Sep 29, 2003 at 10:41:05AM -0500, Jeremy Bettis wrote:
>* gdb/win32-nat.c
>(handle_exception,get_child_debug_event,_initialize_inftarg) When debugging
>a program that uses windows SEH gdb stops the program even if the inferior's
>exception handler catches the exception. I have added a new set option,
>"set mapexceptionstosignals off" that will cause gdb to completely ignore
>WIN32 exceptions. This is similar to the feature "set signal-exceptions 4"
>in the Apple Openstep version of gdb 4.15.3.
I've been keeping this in my inbox for a while but, on checking with the
FSF assignment coordinator, it looks like there still isn't a gdb assignment
on file.
So, please resubmit if/when an assignment clears.
Thanks,
cgf
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gdb patch take 6
2003-11-14 19:22 ` Christopher Faylor
@ 2003-11-14 21:19 ` Jeremy Bettis
0 siblings, 0 replies; 3+ messages in thread
From: Jeremy Bettis @ 2003-11-14 21:19 UTC (permalink / raw)
To: gdb-patches
Hmmm... I mailed the assignment form in right away when I received it. I
don't know what the delay would be.
----- Original Message -----
From: "Christopher Faylor" <cgf@redhat.com>
To: <gdb-patches@sources.redhat.com>
Cc: <jeremy@deadbeef.com>
Sent: Friday, November 14, 2003 1:21 PM
Subject: Re: gdb patch take 6
> [no personal replies please, reply-to set -- beware!]
> On Mon, Sep 29, 2003 at 10:41:05AM -0500, Jeremy Bettis wrote:
> >* gdb/win32-nat.c
> >(handle_exception,get_child_debug_event,_initialize_inftarg) When
debugging
> >a program that uses windows SEH gdb stops the program even if the
inferior's
> >exception handler catches the exception. I have added a new set option,
> >"set mapexceptionstosignals off" that will cause gdb to completely ignore
> >WIN32 exceptions. This is similar to the feature "set signal-exceptions
4"
> >in the Apple Openstep version of gdb 4.15.3.
>
> I've been keeping this in my inbox for a while but, on checking with the
> FSF assignment coordinator, it looks like there still isn't a gdb
assignment
> on file.
>
> So, please resubmit if/when an assignment clears.
>
> Thanks,
> cgf
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-11-14 21:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-29 15:40 gdb patch take 6 Jeremy Bettis
2003-11-14 19:22 ` Christopher Faylor
2003-11-14 21:19 ` Jeremy Bettis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox