Update of /cvsroot/sbcl/sbcl/src/runtime
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7616/src/runtime
Modified Files:
arch.h breakpoint.h win32-os.c x86-arch.c
Log Message:
1.0.0.2: TRACE :ENCAPSULATE NIL, plus other minor Windows improvements
* Function end breakpoints need single-stepping awareness in
order to work -- fixes TRACE :ENCAPSULATE NIL on Windows.
* Add more exception codes to grovel-headers.c, and recognize
them in HANDLE-WIN32-EXCEPTION -- for now just signal a simple
error with the exception name as the message,
* Tweak test-suite to recognize backtrace idiosyncracies on Windows,
and skip a test that would hang due to non-working timouts.
Index: arch.h
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/arch.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- arch.h 21 Feb 2006 22:59:32 -0000 1.10
+++ arch.h 30 Nov 2006 16:20:42 -0000 1.11
@@ -46,4 +46,9 @@
extern void fpu_save(void *);
extern void fpu_restore(void *);
+#ifdef LISP_FEATURE_X86
+extern unsigned int * single_stepping;
+extern void restore_breakpoint_from_single_step(os_context_t * context);
+#endif
+
#endif /* __ARCH_H__ */
Index: breakpoint.h
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/breakpoint.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- breakpoint.h 27 Sep 2005 15:52:50 -0000 1.6
+++ breakpoint.h 30 Nov 2006 16:20:42 -0000 1.7
@@ -23,4 +23,7 @@
extern void *handle_fun_end_breakpoint(int signal, siginfo_t *info,
os_context_t *context);
+extern void handle_single_step_trap(os_context_t *context, int kind,
+ int register_offset);
+
#endif
Index: win32-os.c
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/win32-os.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- win32-os.c 23 Nov 2006 12:42:31 -0000 1.23
+++ win32-os.c 30 Nov 2006 16:20:42 -0000 1.24
@@ -334,8 +334,9 @@
* unwinding in Lisp.
*/
-EXCEPTION_DISPOSITION sigtrap_emulator(CONTEXT *context,
- struct lisp_exception_frame *exception_frame)
+EXCEPTION_DISPOSITION
+sigtrap_emulator(CONTEXT *context,
+ struct lisp_exception_frame *exception_frame)
{
if (*((char *)context->Eip + 1) == trap_ContextRestore) {
/* This is the cleanup for what is immediately below, and
@@ -424,19 +425,26 @@
/* set_seh_frame(handler.handler[0]); */
}
-EXCEPTION_DISPOSITION handle_exception(EXCEPTION_RECORD *exception_record,
- struct lisp_exception_frame *exception_frame,
- CONTEXT *context,
- void *dc) /* FIXME: What's dc again? */
+EXCEPTION_DISPOSITION
+handle_exception(EXCEPTION_RECORD *exception_record,
+ struct lisp_exception_frame *exception_frame,
+ CONTEXT *context,
+ void *dc) /* FIXME: What's dc again? */
{
-
/* For EXCEPTION_ACCESS_VIOLATION only. */
void *fault_address = (void *)exception_record->ExceptionInformation[1];
+ if (single_stepping &&
+ exception_record->ExceptionCode == EXCEPTION_SINGLE_STEP) {
+ /* We are doing a displaced instruction. At least function
+ * end breakpoints uses this. */
+ restore_breakpoint_from_single_step(context);
+ return ExceptionContinueExecution;
+ }
+
if (exception_record->ExceptionCode == EXCEPTION_BREAKPOINT) {
/* Pick off sigtrap case first. */
return sigtrap_emulator(context, exception_frame);
-
}
else if (exception_record->ExceptionCode == EXCEPTION_ACCESS_VIOLATION &&
(is_valid_lisp_addr(fault_address) ||
Index: x86-arch.c
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/x86-arch.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- x86-arch.c 18 Sep 2006 20:09:14 -0000 1.44
+++ x86-arch.c 30 Nov 2006 16:20:42 -0000 1.45
@@ -209,34 +209,40 @@
}
void
+restore_breakpoint_from_single_step(os_context_t * context)
+{
+ /* fprintf(stderr,"* single step trap %x\n", single_stepping); */
+#ifdef CANNOT_GET_TO_SINGLE_STEP_FLAG
+ /* Un-install single step helper instructions. */
+ *(single_stepping-3) = single_step_save1;
+ *(single_stepping-2) = single_step_save2;
+ *(single_stepping-1) = single_step_save3;
+#else
+ *context_eflags_addr(context) &= ~0x100;
+#endif
+ /* Re-install the breakpoint if possible. */
+ if (*os_context_pc_addr(context) == (int)single_stepping + 1) {
+ fprintf(stderr, "warning: couldn't reinstall breakpoint\n");
+ } else {
+ *((char *)single_stepping) = BREAKPOINT_INST; /* x86 INT3 */
+ *((char *)single_stepping+1) = trap_Breakpoint;
+ }
+
+ single_stepping = NULL;
+ return;
+}
+
+void
sigtrap_handler(int signal, siginfo_t *info, void *void_context)
{
os_context_t *context = (os_context_t*)void_context;
unsigned int trap;
#ifndef LISP_FEATURE_WIN32
- if (single_stepping && (signal==SIGTRAP))
- {
- /* fprintf(stderr,"* single step trap %x\n", single_stepping); */
-
-#ifdef CANNOT_GET_TO_SINGLE_STEP_FLAG
- /* Un-install single step helper instructions. */
- *(single_stepping-3) = single_step_save1;
- *(single_stepping-2) = single_step_save2;
- *(single_stepping-1) = single_step_save3;
-#else
- *context_eflags_addr(context) &= ~0x100;
-#endif
- /* Re-install the breakpoint if possible. */
- if (*os_context_pc_addr(context) == (int)single_stepping + 1) {
- fprintf(stderr, "warning: couldn't reinstall breakpoint\n");
- } else {
- *((char *)single_stepping) = BREAKPOINT_INST; /* x86 INT3 */
- *((char *)single_stepping+1) = trap_Breakpoint;
- }
-
- single_stepping = NULL;
- return;
+ /* On Windows this is done in the SE handler. */
+ if (single_stepping && (signal==SIGTRAP)) {
+ restore_breakpoint_from_single_step(context);
+ return;
}
#endif
|