From 22c80ff1053c9711d0f18987ee8d15fc0f4e5580 Mon Sep 17 00:00:00 2001 From: Olof-Joachim Frahm Date: Sat, 10 Sep 2016 00:12:33 +0200 Subject: [PATCH] Add ABCL disassembler post. --- abcl-java-debugging.post | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 abcl-java-debugging.post diff --git a/abcl-java-debugging.post b/abcl-java-debugging.post new file mode 100644 index 0000000..a93a449 --- /dev/null +++ b/abcl-java-debugging.post @@ -0,0 +1,27 @@ +;;;;; +title: Debugging Java with ABCL +date: 2016-09-10 00:05:24 +format: md +tags: lisp +bindings: 3bmd-code-blocks:*code-blocks-default-colorize* :common-lisp +;;;;; + +So after adding a dispatch mechanism into the `DISASSEMBLE` function of ABCL I +also want to show a neat way of disassembling arbitrary Java classes using one +of the provided disassemblers. + +First of, make sure that you have the ObjectWeb ASM library in your classpath +(everything up from version 3 should work at least, perhaps even lower +versions), note that in future releases you might be able to load it via Maven +and one of the optional contribs as well, likely via `(require '#:asm-all)`. + +Next up, try `(disassemble #'list)` and confirm that some output is shown. + +Now to show bytecode for arbitrary Java classes we've got to jump through some +additional hoops - though perhaps at some point this could become a stable API +as well: + + (system::objectweb-disassemble (#"getResourceAsStream" (java:jclass "java.lang.Object") "/java/util/Random.class")) + +I haven't tried this via the JAD disassembler, but it seems likely that a +similar approach should work for it too. -- 1.7.10.4