[Ecls-list] finding point of errors
Juan Jose Garcia Ripoll
lisp at arrakis.es
Thu Nov 17 04:41:02 UTC 2005
On Thu, 2005-11-17 at 23:18 +1100, Dean O'Connor wrote:
> Hopefully this is not too silly a question ... about fault
> finding/debugging ...
>
> If I load a lisp script into ECL and there is some coding/syntax mistake
> and ECL spits an error such as this:
>
> "Too few arguments supplied to a macro or a destructuring-bind form.
> Broken at LOAD."
>
> If I do a backtrace, its doesn't really give me many clues
> eg.
>
> "RAZOR-BASE>> :b
> Backtrace: LOAD > eval > load > eval"
The fact that no other names appears after LOAD means that functions
which have been executed in lower levels are all compiled. Compiled
functions do not registerm themselves with the invocation history stack
because this slows function calls.
I am now thinking that it would be a nice idea to force MACROEXPAND to
register the function call to the macro expander, so that it appears in
the backtrace. I will write this in my todo list. Until then you can
type this on the toplevel:
(setf *macroexpand-hook*
#'(lambda (function form env) (funcall function form env)))
Now all macroexpansion calls will get traced in the invocation history
stack and you will see the offending form. See this:
> (setf *macroexpand-hook*
#'(ext:lambda-block myexpander (function form env)
(funcall function form env)))
#<bytecompiled-function MYEXPANDER>
> (do () :bogus)
:BOGUS is not of type LIST.
Broken at MYEXPANDER.
>> :b
Backtrace: > MYEXPANDER
>> :v
Block names: MYEXPANDER.
Local variables:
FUNCTION: #<compiled-function 08098a68>
FORM: (DO () :BOGUS)
ENV: (NIL)
>>
Regards
Juanjo
More information about the ecl-devel
mailing list