On Fri, 13 Nov 2009 23:03:17 -0500
Andy Hefner <ahefner@...> wrote:
> I'm presently building an application compiled to an executable using
> ECL from recent CVS and c:build-program with an :epilogue-code which
> calls my main function. The lisp portions are compiled using
> compile-file :system-p t (to produce .o rather than .fasl files),
> following one of the ECL examples. Currently I'm testing on x86 Linux.
> This works well, but I'm not sure how to debug the resulting program.
> By default, there seems to be no error handling in place, and errors
> in lisp code cause segfaults or lockups. Ideally I'd like to print a
> backtrace or get into the lisp debugger, so I wrapped my main in a
> handler-bind catching serious-conditions and calling
> cl:invoke-debugger. This gets me a debugger (provided I set
> system::*break-enable* to T somewhere), but the backtrace has only one
> entry, "SI:BYTECODES [Evaluation of: (G1:MAIN)]". Is there a way to
> get more information from ECL (perhaps I should build my program in a
> different way)?
Hmm in cases where I couldn't get any interesting information from
ECL's debugger I used ktrace (there is a similar command on Linux
called strace) and also attaching GDB to a running process (or starting
ECL from within GDB), as since ECL compiles to C code GDB is still
However to use GDB I rebuilt ECL after setting the CFLAGS environment
variable to "-O0 -g" as well as LDFLAGS to "-g", which not only built
ECL with debug symbols but also caused ECL to observe those same flags
when compiling user Lisp code.
I forgot the exact details and would have to check the documentation
and/or code again, but it's also possible to tell the compiler to leave
temporary transient C files around, which could also be handy...
Hopefully these tips help a bit,