Skip to content
Snippets Groups Projects
Commit 78eb5a7b authored by rtoy's avatar rtoy
Browse files

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.
parent 9cf15715
No related branches found
No related tags found
No related merge requests found
/* x86-arch.c -*- Mode: C; comment-column: 40 -*-
*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/x86-arch.c,v 1.40 2010/12/22 02:12:52 rtoy Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/x86-arch.c,v 1.41 2010/12/23 22:23:48 rtoy Exp $
*
*/
......@@ -250,6 +250,8 @@ arch_do_displaced_inst(os_context_t * context, unsigned long orig_inst)
* 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 @@ arch_do_displaced_inst(os_context_t * context, unsigned long orig_inst)
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 @@ sigtrap_handler(HANDLER_ARGS)
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 @@ sigtrap_handler(HANDLER_ARGS)
*(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
/*
......
/* x86-lispregs.h -*- Mode: C; -*-
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/x86-lispregs.h,v 1.13 2008/12/29 14:40:34 rtoy Rel $
* $Header: /Volumes/share2/src/cmucl/cvs2git/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_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment