[RFC] win32-nat.c 'set new-console' and interruption

Pierre Muller muller@ics.u-strasbg.fr
Mon Jun 23 16:05:00 GMT 2008



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Christopher Faylor
> Envoyé : Monday, June 23, 2008 1:45 PM
> À : gdb-patches@sourceware.org; Pierre Muller
> Objet : Re: [RFC] win32-nat.c 'set new-console' and interruption
> 
> On Mon, Jun 23, 2008 at 09:17:39AM +0200, Pierre Muller wrote:
> >I will resend a new patch proposal that complies with the lowercase
> >coding standard rule shortly.
> 
> That was only the most minor problem.  The race condition is something
> that needs to be addressed before the patch can be considered.

  I agree with you on this.
I have a proposal to remove that possible race condition:
The exception record has a field that contains the exception
address, if I test that there is no GDB inserted breakpoint at
that location before converting the TARGET_SIGNAL_TRAP
into a TARGET_SIGNAL_INT, it should fix most problems, no?

  The one case that it would still not catch would be 
a 'int 3' instruction that is in the debuggee code from the start
but other than at startup, such instructions are quite unlikely, no?

  Is this a sufficient fix for the possible race or
should I try harder?


Pierre Muller
Pascal language support maintainer for GDB

PS: I have two code formatting issues in my modified code:

1) the CORE_ADDR addr assignment line goes past the 80 row boundary,
even if I put the current_event on a separate line
would
+          CORE_ADDR addr = (CORE_ADDR)
+            current_event.u.Exception.ExceptionRecord.ExceptionAddress; 
be acceptable to avoid going past 80?

2) For the DEBUG_EXCEPT macro use that I added,
I am also unsure about the formatting, as I had
to cut the line within the string.



Modified code to remove the race condition
between an exception create by DebugBreakProcess
and an exception created by the 'int 3' instruction
inserted by GDB for breakpoints.

@@ -1076,7 +1079,22 @@ handle_exception (struct target_waitstat
       break;
     case EXCEPTION_BREAKPOINT:
       DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT");
-      ourstatus->value.sig = TARGET_SIGNAL_TRAP;
+      if (ctrl_break_sent)
+
+       {
+          CORE_ADDR addr =
+           (CORE_ADDR)
current_event.u.Exception.ExceptionRecord.ExceptionAddress;
+
+          if (!breakpoint_inserted_here_p (addr))
+           {
+             DEBUG_EXCEPT (("EXCEPTION_BREAKPOINT at 0x%lx converted to \
+TARGET_SIGNAL_INT\n", (DWORD) addr));
+             ctrl_break_sent = 0;
+             ourstatus->value.sig = TARGET_SIGNAL_INT;
+           }
+       }
+      else
+       ourstatus->value.sig = TARGET_SIGNAL_TRAP;
       break;
     case DBG_CONTROL_C:
       DEBUG_EXCEPTION_SIMPLE ("DBG_CONTROL_C");




More information about the Gdb-patches mailing list