Mark Evenson writes:
Attached is a revised patch incorporating Java stack frames in the backtrace against ABCL SVN HEAD.
This revision:
- solves the "off by one" error of Tobias's original patch in a way
that is more robust to stack dumps from other sources (such as calling into ABCL when the top level interpreter has not been established)
- restores the ability to inspect a mixed Java/Lisp backtrace via the
ABCL inspector
- utilizes the stack optimization introduced by Erik in [svn r12064]
in using a link in the StackFrame itself
The Java stack traces certainly give an ABCL implementer a lot more useful information to understand what is going on although it could be more complete with information on the local variables on the various Java frames. But I wonder how useful this would really be for the "end-user" who would be confused by the abstraction barrier ("Why am I getting reference to a Java stack in my Lisp call?").
Comments please on whether this functionality would be useful, and potential improvements.
a) Why did you change SYS:BACKTRACE-AS-LIST to listify the frames? I deliberately changed it to return a list of StackFrame objects, so higher levels can decide whether they want to print java frames, or not. (Which addresses your concern about "abstraction barrier".)
Perhaps because the name BACKTRACE-AS-LIST could be understand to do implicit listification? I could follow that line. In fact, I'd have liked to perform the following renamings, but opted out to change too many things with my patch:
Rename BACKTRACE to PRINT-BACKTRACE
Define BACKTRACE to return a list of StackFrames.
Define BACKTRACE-AS-LIST to return a list of listified stack frames.
b) I don't like that
(frame-to-list #<JAVA-STACK-FRAME>) => ("class.meth(file.java:NN)")
I think it should return ("class.meth" :file "file.java" :line NN) so higher levels can use that information. (For example `v' in SLDB.)
c) PRINT-FRAME contains an IGNORE-ERRORS which purpose I don't understand. Mind you, you actually copied that from my patch, so it's all my fault---I just can't remember why I put it in there. Do you know? If so, please add a comment.
-T.