From: Alastair B. <lis...@us...> - 2010-03-01 18:50:00
|
Update of /cvsroot/sbcl/sbcl/src/runtime In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv7056/src/runtime Modified Files: win32-os.c Log Message: 1.0.36.10: UD2-BREAKPOINTS for Win32 * Make UD2-BREAKPOINTS work on Win32. * Add :ud2-breakpoints as a feature affecting fasl format, as it changes the trap code used in compiled code. Index: win32-os.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/win32-os.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- win32-os.c 30 Oct 2008 14:47:42 -0000 1.37 +++ win32-os.c 1 Mar 2010 16:32:56 -0000 1.38 @@ -298,6 +298,17 @@ /* A tiny bit of interrupt.c state we want our paws on. */ extern boolean internal_errors_enabled; +#ifdef LISP_FEATURE_UD2_BREAKPOINTS +#define IS_TRAP_EXCEPTION(exception_record, context) \ + (((exception_record)->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION) && \ + (((unsigned short *)((context)->Eip))[0] == 0x0b0f)) +#define TRAP_CODE_WIDTH 2 +#else +#define IS_TRAP_EXCEPTION(exception_record, context) \ + ((exception_record)->ExceptionCode == EXCEPTION_BREAKPOINT) +#define TRAP_CODE_WIDTH 1 +#endif + /* * A good explanation of the exception handling semantics is * http://win32assembly.online.fr/Exceptionhandling.html . @@ -330,7 +341,7 @@ return ExceptionContinueExecution; } - if (exception_record->ExceptionCode == EXCEPTION_BREAKPOINT) { + if (IS_TRAP_EXCEPTION(exception_record, context)) { unsigned char trap; /* This is just for info in case the monitor wants to print an * approximation. */ @@ -338,7 +349,7 @@ (lispobj *)*os_context_sp_addr(context); /* Unlike some other operating systems, Win32 leaves EIP * pointing to the breakpoint instruction. */ - context->Eip++; + context->Eip += TRAP_CODE_WIDTH; /* Now EIP points just after the INT3 byte and aims at the * 'kind' value (eg trap_Cerror). */ trap = *(unsigned char *)(*os_context_pc_addr(context)); |