source: trunk/abcl/contrib/abcl-introspect/objectweb.lisp

Last change on this file was 15280, checked in by Mark Evenson, 4 years ago

Make javap the default for CL:DISASSEMBLE

Fix system interface for choosing disassemblers. Use
SYS:CHOOSE-DISASSEMBLER to interogate and/or change the active
disassembler for CL:DISASSEMBLER from the available assemblers
enumerated in SYS:*DISASSEMBLERS*. Test the ABCL-INTROSPECT for
loading available disassemblers as part of CI.

Additional disassemblers are collected in the ABCL-INTROSPECT contrib
as top-level ASDF systems. Currently available disassemblers include
OBJECTWEB, JAVAP, JAD, PROCYON, FERNFLOWER, and CFR.

Update OBJECTWEB to ASM framework 8.0.1

Encapsulate the loading and use of javap and jad command line
disassemblers as ASDF systems.

Rename all packages as ABCL-INTROSPECT/mumble/mumble.

Normalize ASDF formatting with dangling ":components" keyword. N.b. I
don't like this convention, as stylistically keyword arguments should
not occur in a line without their parameter, but otherwise ASDF
systems creep into too much screen.

Incomplete initial implementation for PROCYON.

Fix test semantics. Normalize test system ASDF name to
the singular form.

Document the CL:DISASSEMBLER interface in the manual and system
README.

Move the JAD dissassembler into a contrib. This contrib should
introspect the current archicture, download the necessary version of
JAD, and use that but it doesn't yet quite work. Among other
problems, it seems that the PATHNAME-URL implementation used for
downloading has problems on openjdk8 being returned a 403 Forbidden
from the remote server for some unexplained reason, whereas openjdk11
works.

File size: 992 bytes
Line 
1(defpackage :abcl-introspect/jvm/tools/objectweb
2  (:use :cl)
3  (:export
4   #:disassemble-class-bytes))
5(in-package :abcl-introspect/jvm/tools/objectweb)
6
7(defun disassemble-class-bytes (object)
8  (let* ((reader (java:jnew "org.objectweb.asm.ClassReader" object))
9         (writer (java:jnew "java.io.StringWriter"))
10         (printer (java:jnew "java.io.PrintWriter" writer))
11         (tracer (java:jnew "org.objectweb.asm.util.TraceClassVisitor" java:+null+ printer))
12         ;; this is to support both the 1.X and subsequent releases
13         (flags (ignore-errors (java:jfield "org.objectweb.asm.ClassReader" "SKIP_DEBUG"))))
14    (java:jcall-raw "accept" reader tracer (or flags java:+false+))
15    (java:jcall "toString" writer)))
16
17(eval-when (:load-toplevel :execute)
18  (pushnew `(:objectweb . abcl-introspect/jvm/tools/objectweb::disassemble-class-bytes)
19           sys::*disassemblers*)
20  (format cl:*load-verbose* "~&; ~a ; Successfully added Objectweb disassembler.~%" *package*))
21
Note: See TracBrowser for help on using the repository browser.