[armedbear-devel] how to debug?
Alessio Stalla
alessiostalla at gmail.com
Wed Feb 17 19:08:38 UTC 2010
On Wed, Feb 17, 2010 at 1:53 AM, Alan Ruttenberg
<alanruttenberg at gmail.com> wrote:
> Maybe this can help.
>
> First define:
>
> (defmethod print-object ((v jvm::var-ref) s)
> (prin1 (jvm::variable-name (jvm::var-ref-variable v)) s))
>
> So that when tracing the expansion we don't throw a fit.
>
> Then:
>
> (defun expand-function-call-inline (form lambda-list body args)
> (handler-case
> (multiple-value-bind (bindings ignorables)
> (match-lambda-list (multiple-value-list
> (parse-lambda-list lambda-list))
> args)
> (let ((expanded `(let* ,bindings
> (declare (ignorable , at ignorables))
> , at body)))
> (let ((*print-structure* nil) (*print-pretty* t) (*print-case* :downcase))
> (format t "transforming ~a ~% into~% ~a~%-------~%" form expanded)
> expanded)))
> (lambda-list-mismatch (x)
> (compiler-warn "Invalid function call: ~S (mismatch type: ~A)"
> form (lambda-list-mismatch-type x))
> form)))
Sorry, I can't still reproduce it. I tried downloading lsw from
http://svn.mumble.net:8080/svn/lsw/trunk/ and following the
instructions, but ./abcl (from inside bin/) fails after compiling some
files with:
Error loading /home/alessio/projects/lsw/trunk/jss/armedbear-0.18.0-dev-linux-unknown/invoke.abcl
at line 77 (offset 4749)
Debugger invoked on condition of type ERROR:
Class not found: BSH.CLASSPATH.CLASSMANAGERIMPL
...
even if bsh-2.0b4.jar is in classpath apparently.
I also tried translating the code you posted to "pure" abcl while
trying to preserve what I understood to be its meaning, to find out if
it's the load-time-value of a Pattern object to cause harm, but
apparently my translation has lost the important bits because it
compiles and loads fine.
For reference, this is my "translation":
((lambda (g172 &rest g173)
(jcall "replaceAll"
g172
"replacement"))
((lambda (g174 &rest g175)
(jcall "matcher"
g174
"string"))
(load-time-value ((lambda (g176 &rest g177)
(jstatic "compile"
g176
(car g177)))
"java.util.regex.Pattern" "\\\\(.)"))
'value)
'$1)
I got rid of the lambdas::gnnn symbols, because using them as in the
code you posted gives unbound variables errors. Since the symbol names
are the same between a variable declaration in the lambda list and its
use, I guess those are intended to be the same symbol even if for
mysterious reasons they get printed differently (maybe your
print-object method has something to do with it - I didn't quite get
it).
Also, I replaced all temp variables with dummy string literals, and I
quoted the unused rest arguments (value and $1) to prevent unbound
variable errors.
Maybe the fact that you use a compiler macro is relevant. I'll try to
understand that.
Later,
Alessio
> Given that, here's the trace of what happens when I compile the
> function in question:
>
>
> java.lang.VerifyError: (class:
> abcl_6037b542_0820_4605_aeb0_a2000b3f3a45, method: execute signature:
> (Lorg/armedbear/lisp/LispObject;Lorg/armedbear/lisp/LispObject;)Lorg/armedbear/lisp/LispObject;)
> Illegal local variable number
> at java.lang.Class.getDeclaredConstructors0(Native Method)
> at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
> at java.lang.Class.getConstructor0(Class.java:2699)
> at java.lang.Class.newInstance0(Class.java:326)
> at java.lang.Class.newInstance(Class.java:308)
> at org.armedbear.lisp.Lisp.makeCompiledFunctionFromClass(Lisp.java:1266)
> at org.armedbear.lisp.Lisp.loadClassBytes(Lisp.java:1327)
> at org.armedbear.lisp.Lisp.loadClassBytes(Lisp.java:1320)
> at org.armedbear.lisp.CompiledClosure$1.execute(CompiledClosure.java:236)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
> at org.armedbear.lisp.compiler_pass2_453.execute(compiler-pass2.lisp:5224)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:786)
> at org.armedbear.lisp.compiler_pass2_454.execute(compiler-pass2.lisp:5261)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:798)
> at org.armedbear.lisp.compiler_pass2_560.execute(compiler-pass2.lisp:8127)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:798)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:596)
> at org.armedbear.lisp.compiler_pass2_327.execute(compiler-pass2.lisp:2961)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
> at org.armedbear.lisp.compiler_pass2_332.execute(compiler-pass2.lisp:3023)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:798)
> at org.armedbear.lisp.compiler_pass2_560.execute(compiler-pass2.lisp:8127)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:798)
> at org.armedbear.lisp.compiler_pass2_401.execute(compiler-pass2.lisp:4131)
> at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:112)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:786)
> at org.armedbear.lisp.compiler_pass2_567.execute(compiler-pass2.lisp:8350)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
> at org.armedbear.lisp.compiler_pass2_569.execute(compiler-pass2.lisp:8581)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:786)
> at org.armedbear.lisp.compiler_pass2_571.execute(compiler-pass2.lisp:8623)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:839)
> at org.armedbear.lisp.compiler_pass2_596.execute(compiler-pass2.lisp:8737)
> at org.armedbear.lisp.compiler_pass2_582.execute(compiler-pass2.lisp:8692)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.Java$23.execute(Java.java:1007)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
> at org.armedbear.lisp.compiler_pass2_578.execute(compiler-pass2.lisp:8692)
> at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:101)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
> at org.armedbear.lisp.compiler_pass2_595.execute(compiler-pass2.lisp:8737)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:810)
> at org.armedbear.lisp.compiler_pass2_601.execute(compiler-pass2.lisp:8754)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.Java$23.execute(Java.java:1007)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
> at org.armedbear.lisp.compiler_pass2_597.execute(compiler-pass2.lisp:8754)
> at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:112)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:786)
> at org.armedbear.lisp.compiler_pass2_602.execute(compiler-pass2.lisp:8825)
> at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:112)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:579)
> at org.armedbear.lisp.Lisp.evalCall(Lisp.java:501)
> at org.armedbear.lisp.Lisp.eval(Lisp.java:459)
> at org.armedbear.lisp.Lisp.evalCall(Lisp.java:489)
> at org.armedbear.lisp.Lisp.eval(Lisp.java:459)
> at org.armedbear.lisp.Lisp.progn(Lisp.java:628)
> at org.armedbear.lisp.SpecialOperators._let(SpecialOperators.java:169)
> at org.armedbear.lisp.SpecialOperators.access$000(SpecialOperators.java:40)
> at org.armedbear.lisp.SpecialOperators$sf_let.execute(SpecialOperators.java:101)
> at org.armedbear.lisp.Lisp.eval(Lisp.java:449)
> at org.armedbear.lisp.Lisp.progn(Lisp.java:628)
> at org.armedbear.lisp.Closure.execute(Closure.java:421)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.Java$
>
> transforming ((lambda (g172 &rest g173)
> (invoke-restargs replaceAll
> lambdas::g172
> #:temp13766
> nil))
> ((lambda (g174 &rest g175)
> (invoke-restargs matcher
> lambdas::g174
> #:temp13767
> t))
> (load-time-value ((lambda (g176 &rest g177)
> (invoke-restargs compile
> g176
> g177
> t))
> 'java.util.regex.pattern \\(.)))
> value)
> $1)
> into
> (let* ((g172
> ((lambda (g174 &rest g175)
> (invoke-restargs matcher lambdas::g174 #:temp13767 t))
> (load-time-value ((lambda (g176 &rest g177)
> (invoke-restargs compile g176 g177 t))
> 'java.util.regex.pattern \\(.)))
> value))
> (temp15717 (list $1))
> (g173 temp15717))
> (declare (ignorable))
> (invoke-restargs replaceAll lambdas::g172 #:temp13766 nil))
> -------
> transforming ((lambda (g174 &rest g175)
> (invoke-restargs matcher
> lambdas::g174
> #:temp13767
> t))
> (load-time-value ((lambda (g176 &rest g177)
> (invoke-restargs compile
> g176
> g177
> t))
> 'java.util.regex.pattern \\(.)))
> value)
> into
> (let* ((g174
> (load-time-value ((lambda (g176 &rest g177)
> (invoke-restargs compile g176 g177 t))
> 'java.util.regex.pattern \\(.))))
> (temp15718 (list value))
> (g175 temp15718))
> (declare (ignorable))
> (invoke-restargs matcher lambdas::g174 #:temp13767 t))
> -------
> transforming ((lambda (g172 &rest g173)
> (invoke-restargs replaceAll
> lambdas::g172
> #:temp13766
> nil))
> ((lambda (g174 &rest g175)
> (invoke-restargs matcher
> lambdas::g174
> #:temp13767
> t))
> (load-time-value ((lambda (g176 &rest g177)
> (invoke-restargs compile
> g176
> g177
> t))
> 'java.util.regex.pattern \\(.)))
> value)
> $1)
> into
> (let* ((g172
> ((lambda (g174 &rest g175)
> (invoke-restargs matcher lambdas::g174 #:temp13767 t))
> (load-time-value ((lambda (g176 &rest g177)
> (invoke-restargs compile g176 g177 t))
> 'java.util.regex.pattern \\(.)))
> value))
> (temp15725 (list $1))
> (g173 temp15725))
> (declare (ignorable))
> (invoke-restargs replaceAll lambdas::g172 #:temp13766 nil))
> -------
> transforming ((lambda (g174 &rest g175)
> (invoke-restargs matcher
> lambdas::g174
> #:temp13767
> t))
> (load-time-value ((lambda (g176 &rest g177)
> (invoke-restargs compile
> g176
> g177
> t))
> 'java.util.regex.pattern \\(.)))
> value)
> into
> (let* ((g174
> (load-time-value ((lambda (g176 &rest g177)
> (invoke-restargs compile g176 g177 t))
> 'java.util.regex.pattern \\(.))))
> (temp15726 (list value))
> (g175 temp15726))
> (declare (ignorable))
> (invoke-restargs matcher lambdas::g174 #:temp13767 t))
> -------
> STYLE-WARNING: The variable LINE is defined but never used.
> STYLE-WARNING: The variable LAMBDAS::G172 is defined but never used.
> STYLE-WARNING: The variable LAMBDAS::G173 is defined but never used.
> STYLE-WARNING: The variable LAMBDAS::G174 is defined but never used.
> STYLE-WARNING: The variable LAMBDAS::G175 is defined but never used.
>
> 23.execute(Java.java:1007)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:562)
> at org.armedbear.lisp.Lisp.evalCall(Lisp.java:494)
> at org.armedbear.lisp.Lisp.eval(Lisp.java:459)
> at org.armedbear.lisp.Lisp.progn(Lisp.java:628)
> at org.armedbear.lisp.SpecialOperators._let(SpecialOperators.java:169)
> at org.armedbear.lisp.SpecialOperators.access$000(SpecialOperators.java:40)
> at org.armedbear.lisp.SpecialOperators$sf_let.execute(SpecialOperators.java:101)
> at org.armedbear.lisp.Lisp.eval(Lisp.java:449)
> at org.armedbear.lisp.Lisp.progn(Lisp.java:628)
> at org.armedbear.lisp.SpecialOperators._let(SpecialOperators.java:169)
> at org.armedbear.lisp.SpecialOperators.access$000(SpecialOperators.java:40)
> at org.armedbear.lisp.SpecialOperators$sf_let.execute(SpecialOperators.java:101)
> at org.armedbear.lisp.Lisp.eval(Lisp.java:449)
> at org.armedbear.lisp.Lisp.progn(Lisp.java:628)
> at org.armedbear.lisp.Closure.execute(Closure.java:646)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:711)
> at org.armedbear.lisp.Lisp.funcall(Lisp.java:183)
> at org.armedbear.lisp.Primitives$pf_apply.execute(Primitives.java:2829)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:886)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:711)
> at org.armedbear.lisp.swank_backend_45.execute(swank-backend.lisp:402)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:886)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:711)
> at org.armedbear.lisp.swank_541.execute(swank.lisp:2691)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.swank_529.execute(swank.lisp:2639)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.swank_524.execute(swank.lisp:2619)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:562)
> at org.armedbear.lisp.swank_528.execute(swank.lisp:2639)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.Java$23.execute(Java.java:1007)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:562)
> at org.armedbear.lisp.swank_526.execute(swank.lisp:2639)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:562)
> at org.armedbear.lisp.swank_540.execute(swank.lisp:2691)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.Primitives$pf_funcall.execute(Primitives.java:2673)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:562)
> at org.armedbear.lisp.Lisp.evalCall(Lisp.java:494)
> at org.armedbear.lisp.Lisp.eval(Lisp.java:459)
> at org.armedbear.lisp.Lisp.progn(Lisp.java:628)
> at org.armedbear.lisp.Closure.bindParametersAndExecute(Closure.java:446)
> at org.armedbear.lisp.Closure.execute(Closure.java:479)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:562)
> at org.armedbear.lisp.Lisp.funcall(Lisp.java:163)
> at org.armedbear.lisp.Primitives$pf_apply.execute(Primitives.java:2811)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:798)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:596)
> at org.armedbear.lisp.swank_backend_41.execute(swank-backend.lisp:382)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:562)
> at org.armedbear.lisp.swank_370.execute(swank.lisp:1774)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:786)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:579)
> at org.armedbear.lisp.swank_539.execute(swank.lisp:2691)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:632)
> at org.armedbear.lisp.Lisp.evalCall(Lisp.java:522)
> at org.armedbear.lisp.Lisp.eval(Lisp.java:459)
> at org.armedbear.lisp.Primitives$pf__eval.execute(Primitives.java:328)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:562)
> at org.armedbear.lisp.Lisp.evalCall(Lisp.java:494)
> at org.armedbear.lisp.Lisp.eval(Lisp.java:459)
> at org.armedbear.lisp.Lisp.progn(Lisp.java:628)
> at org.armedbear.lisp.Primitives$sf_block.execute(Primitives.java:3720)
> at org.armedbear.lisp.Lisp.eval(Lisp.java:449)
> at org.armedbear.lisp.Lisp.progn(Lisp.java:628)
> at org.armedbear.lisp.Closure.bindParametersAndExecute(Closure.java:446)
> at org.armedbear.lisp.Closure.execute(Closure.java:479)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:562)
> at org.armedbear.lisp.swank_400.execute(swank.lisp:1979)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:596)
> at org.armedbear.lisp.Primitives$pf_apply.execute(Primitives.java:2784)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:786)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:579)
> at org.armedbear.lisp.swank_248.execute(swank.lisp:1023)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.Primitives$pf_funcall.execute(Primitives.java:2673)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:562)
> at org.armedbear.lisp.Lisp.evalCall(Lisp.java:494)
> at org.armedbear.lisp.Lisp.eval(Lisp.java:459)
> at org.armedbear.lisp.Lisp.progn(Lisp.java:628)
> at org.armedbear.lisp.SpecialOperators._let(SpecialOperators.java:169)
> at org.armedbear.lisp.SpecialOperators.access$000(SpecialOperators.java:40)
> at org.armedbear.lisp.SpecialOperators$sf_let.execute(SpecialOperators.java:101)
> at org.armedbear.lisp.Lisp.eval(Lisp.java:449)
> at org.armedbear.lisp.Lisp.progn(Lisp.java:628)
> at org.armedbear.lisp.Closure.bindParametersAndExecute(Closure.java:446)
> at org.armedbear.lisp.Closure.execute(Closure.java:493)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:579)
> at org.armedbear.lisp.Lisp.funcall(Lisp.java:165)
> at org.armedbear.lisp.Primitives$pf_apply.execute(Primitives.java:2829)
> at org.armedbear.lisp.Primitive.execute(Primitive.java:143)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:810)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:614)
> at org.armedbear.lisp.swank_backend_74.execute(swank-backend.lisp:663)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:786)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:579)
> at org.armedbear.lisp.swank_148.execute(swank.lisp:423)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.swank_1.execute(swank.lisp:174)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:786)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:579)
> at org.armedbear.lisp.swank_147.execute(swank.lisp:423)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.Java$23.execute(Java.java:1007)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:562)
> at org.armedbear.lisp.swank_145.execute(swank.lisp:423)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.Java$23.execute(Java.java:1007)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:562)
> at org.armedbear.lisp.swank_143.execute(swank.lisp:423)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:786)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:579)
> at org.armedbear.lisp.swank_247.execute(swank.lisp:1023)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.swank_1.execute(swank.lisp:174)
> at org.armedbear.lisp.Symbol.execute(Symbol.java:786)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:579)
> at org.armedbear.lisp.swank_246.execute(swank.lisp:1023)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.Primitives$pf_funcall.execute(Primitives.java:2673)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:562)
> at org.armedbear.lisp.Lisp.evalCall(Lisp.java:494)
> at org.armedbear.lisp.Lisp.eval(Lisp.java:459)
> at org.armedbear.lisp.Lisp.progn(Lisp.java:628)
> at org.armedbear.lisp.Closure.execute(Closure.java:421)
> at org.armedbear.lisp.LispThread.execute(LispThread.java:546)
> at org.armedbear.lisp.Lisp.funcall(Lisp.java:161)
> at org.armedbear.lisp.LispThread$2.run(LispThread.java:88)
> at java.lang.Thread.run(Thread.java:637)
>
> ; Compilation unit finished
> ; Caught 5 WARNING conditions
> ; Caught 5 STYLE-WARNING conditions
>
> ; No value
> CL-USER>
>
More information about the armedbear-devel
mailing list