[cffi-devel] How do I debug a memory fault?

Liam Healy lnp at healy.washington.dc.us
Sun Oct 7 17:16:44 UTC 2007


I am using CFFI in SBCL on Debian GNU/Linux etch (amd64).  I have had
a great deal of success interfacing to the GNU scientific library
(GSL).  Usually, when I get a "memory fault" I quickly can see my
mistake in defining the interface, and once fixed, the error goes
away.

I can't figure this one out however.  The interface is:
  gsl_odeiv_step * gsl_odeiv_step_alloc (const gsl_odeiv_step_type *
T, size_t dim)
I attempt to call this with a predefined pointer,
  (describe *step-rk8pd*)
  #.(SB-SYS:INT-SAP #X2B31DAEB0328) is a SB-SYS:SYSTEM-AREA-POINTER.
and I get a memory fault.  What is the best way to debug this?

Thanks for any tips.

Liam



(FOREIGN-FUNCALL "gsl_odeiv_step_alloc" :POINTER *step-rk8pd* :SIZE 2 :POINTER)

memory fault
   [Condition of type SB-KERNEL::MEMORY-FAULT-ERROR]

Restarts:
  0: [ABORT-REQUEST] Abort handling SLIME request.
  1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread"
{100385EF71}>)

Backtrace:
  0: (SB-KERNEL::MEMORY-FAULT-ERROR)
  1: ("foreign function: call_into_lisp")
  2: ("foreign function: post_signal_tramp")
  3: ("foreign function: gsl_odeiv_step_alloc")
  4: (SB-INT:EVAL-IN-LEXENV (FOREIGN-FUNCALL "gsl_odeiv_step_alloc"
:POINTER *STEP-RK8PD* :SIZE 2 :POINTER) #<NULL-LEXENV>)
  5: (SWANK::EVAL-REGION "(FOREIGN-FUNCALL \"gsl_odeiv_step_alloc\"
:POINTER *step-rk8pd* :SIZE 2 :POINTER)
" T)



More information about the cffi-devel mailing list