Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBCL Error Messages: Any way to improve?

Tags:

I've been developing with Common Lisp for almost a year now, and this is really starting to get on my nerves. I started programming CL using CLISP, but I later switched over to SBCL for speed. I do a lot of rather low-level stuff, so I need to interface with a lot of C code. I really like the incremental development aspect of CL (I don't use Emacs however - I'm running SLIMV in Vim), but I find myself developing more slowly than I would in Python, Perl, C, or even NASM. The root of the problem lies in SBCL's error messages. I once was forced to search through almost 500 lines of code because SBCL decided to give me an ERROR: Invalid number of arguments on foreign function #< some memory address >. No designation of what function was called, no line number, nothing. More recently, I've had the delight of getting The loaded code expects an incompatible layout for class SB-PRETTY:PRETTY-STREAM. randomly. The code runs FINE on CLISP, but just fails with obscure errors on SBCL. Is there any way to make these messages somewhat more informative? I've been writing C and assembly for almost 6 years now, and even they will give you a line number. The only halfway reasonable SBCL errors I've seen have been reader errors, which are almost useless because they usually amount to a missing parenthesis. Again, is there any declaration/command line switch that can be used to change this? I'd even be okay with writing my own error printer at this point.

EDIT: An example, with (sb-ext:restrict-compiler-policy 'debug 3) in my ~/.sbclrc (using --load rather than --script so .sbclrc is loaded)

debugger invoked on a SB-INT:SIMPLE-PROGRAM-ERROR in thread
#<THREAD "main thread" RUNNING {AB09931}>:
  invalid number of arguments: 0

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(SB-KERNEL::INVALID-ARG-COUNT-ERROR-HANDLER
 #<unavailable argument>
 #.(SB-SYS:INT-SAP #XB78CDAE0)
 #<SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #XB78CD7DC :TYPE (*
                                                         (STRUCT
                                                          SB-VM::OS-CONTEXT-T-STRUCT))>
 (79))
0] print
(SB-KERNEL::INVALID-ARG-COUNT-ERROR-HANDLER
    #<unavailable argument>
    #.(SB-SYS:INT-SAP #XB78CDAE0)
    #<SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #XB78CD7DC :TYPE (*
                                                            (STRUCT
                                                             SB-VM::OS-CONTEXT-T-STRUCT))>
    (79))
0] down
(SB-KERNEL:INTERNAL-ERROR
    #.(SB-SYS:INT-SAP #XB78CD7DC)
    #<unavailable argument>)
1] down
("foreign function: #x805FCBB")
2] down

Bottom of stack.

Not exactly informative.