[cmucl-cvs] CMUCL commit: src/lisp (x86-arch.c x86-lispregs.h)
Raymond Toy
rtoy at common-lisp.net
Thu Dec 23 22:23:48 UTC 2010
Date: Thursday, December 23, 2010 @ 17:23:48
Author: rtoy
Path: /project/cmucl/cvsroot/src/lisp
Modified: x86-arch.c x86-lispregs.h
Fix tracing for NetBSD. Function end breakpoints didn't seem to be
working when tracing, for example
(declaim (ftype (function (double-float) double-float) fact))
(defun fact (x)
(declare (double-float x))
(if (= x 1)
1d0
(* x (fact (1- x)))))
lisp/x86-lispregs.h
o NetBSD has access to the eflags register
lisp/x86-arch.c:
o Add some debugging prints (disabled).
o The stuff near line 262 about pc-9 pointing to the pushf instruction
should be conditioned on SC_EFLAGS because that's what decides
whether we insert the pushf instructions for single stepping.
----------------+
x86-arch.c | 12 ++++++++----
x86-lispregs.h | 4 +++-
2 files changed, 11 insertions(+), 5 deletions(-)
Index: src/lisp/x86-arch.c
diff -u src/lisp/x86-arch.c:1.40 src/lisp/x86-arch.c:1.41
--- src/lisp/x86-arch.c:1.40 Tue Dec 21 21:12:52 2010
+++ src/lisp/x86-arch.c Thu Dec 23 17:23:48 2010
@@ -1,6 +1,6 @@
/* x86-arch.c -*- Mode: C; comment-column: 40 -*-
*
- * $Header: /project/cmucl/cvsroot/src/lisp/x86-arch.c,v 1.40 2010-12-22 02:12:52 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/x86-arch.c,v 1.41 2010-12-23 22:23:48 rtoy Exp $
*
*/
@@ -250,6 +250,8 @@
* single-stepping and stop on the next instruction.
*/
+ DFPRINTF(0, (stderr, "Installing helper instructions\n"));
+
single_step_save1 = *(pc - 3);
single_step_save2 = *(pc - 2);
single_step_save3 = *(pc - 1);
@@ -260,12 +262,13 @@
single_stepping = (unsigned int *) pc;
-#if !(defined(__linux__) || defined(DARWIN))
+#ifndef SC_EFLAGS
/*
* pc - 9 points to the pushf instruction that we installed for
* the helper.
*/
+ DFPRINTF(0, (stderr, " Setting pc to pushf instruction at %p\n", (void*) ((char*) pc - 9)));
SC_PC(context) = (int)((char *) pc - 9);
#endif
}
@@ -277,8 +280,8 @@
unsigned int trap;
#if 0
- fprintf(stderr, "x86sigtrap: %8x %x\n",
- SC_PC(context), *(unsigned char *) (SC_PC(context) - 1));
+ fprintf(stderr, "x86sigtrap: %8x %x\n",
+ SC_PC(context), *(unsigned char *) (SC_PC(context) - 1));
fprintf(stderr, "sigtrap(%d %d %x)\n", signal, CODE(code), context);
#endif
@@ -295,6 +298,7 @@
*(single_stepping - 3) = single_step_save1;
*(single_stepping - 2) = single_step_save2;
*(single_stepping - 1) = single_step_save3;
+ DFPRINTF(0, (stderr, "Uninstalling helper instructions\n"));
#endif
/*
Index: src/lisp/x86-lispregs.h
diff -u src/lisp/x86-lispregs.h:1.13 src/lisp/x86-lispregs.h:1.14
--- src/lisp/x86-lispregs.h:1.13 Mon Dec 29 09:40:34 2008
+++ src/lisp/x86-lispregs.h Thu Dec 23 17:23:48 2010
@@ -1,5 +1,5 @@
/* x86-lispregs.h -*- Mode: C; -*-
- * $Header: /project/cmucl/cvsroot/src/lisp/x86-lispregs.h,v 1.13 2008-12-29 14:40:34 rtoy Rel $
+ * $Header: /project/cmucl/cvsroot/src/lisp/x86-lispregs.h,v 1.14 2010-12-23 22:23:48 rtoy Exp $
*/
#ifndef _X86_LISPREGS_H_
@@ -58,6 +58,8 @@
#endif
#elif defined(__linux__)
#define SC_EFLAGS(sc) ((sc)->uc_mcontext.gregs[REG_EFL])
+#elif defined(__NetBSD__)
+#define SC_EFLAGS(sc) ((sc)->uc_mcontext.__gregs[_REG_EFL])
#endif
#endif /* _X86_LISPREGS_H_ */
More information about the cmucl-cvs
mailing list