Add ABCL disassembler post. master
authorOlof-Joachim Frahm <olof@macrolet.net>
Fri, 9 Sep 2016 22:12:33 +0000 (00:12 +0200)
committerOlof-Joachim Frahm <olof@macrolet.net>
Fri, 9 Sep 2016 22:12:33 +0000 (00:12 +0200)
abcl-java-debugging.post [new file with mode: 0644]

diff --git a/abcl-java-debugging.post b/abcl-java-debugging.post
new file mode 100644 (file)
index 0000000..a93a449
--- /dev/null
@@ -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.