[armedbear-devel] Some convenience functions

Theam Yong Chew senatorzergling at gmail.com
Sun Mar 16 11:25:55 UTC 2014


Hi all,

I've got a bunch of useful functions for general hacking with
abcl. Hope they could be useful. Any suggestions on the best place for
sending patches (if indeed they are useful enough). abcl contribs,
slime contribs, or core abcl?

Yong



;; javap seems to be bundled/more widely available compared to the defaults

(defun disassemble-class-cmd (path)
  (with-accessors ((d pathname-directory)
                   (n pathname-name))
      (merge-pathnames path)
    (format nil "cd ~{/~a~}; javap -c ~a"
            (cdr d) n)))

(defun disassemble-class (path)
  (ext:run-shell-command
   (disassemble-class-cmd path)))

(setf system::*disassembler*
      #'disassemble-class-cmd)


(in-package :swank)

(defmethod menu-choices-for-presentation ((throwable java:java-exception))
  "Java exception stack traces (different from Lisp stack traces) are
also available."
  (list (list "printStackTrace"
              (lambda (choice object id)
                (declare (ignore choice id))
                ;; TODO, print to an Emacs buffer instead
                (java:jcall "printStackTrace" *standard-output*
                            (java:java-exception-cause object))))))

(in-package :swank-backend)

;; Not real frame local variables, but it at least exposes function
;; arguments for possible inspection

(defimplementation frame-locals (index)
  (loop for id upfrom 0
        for item in (java:jcall "toLispList" (nth-frame index))
        collect (let () ;; ((id id) (item item))
                  (list :name "??" :id id :value item))))

(defimplementation frame-var-value (index id)
  (elt (java:jcall "toLispList" (nth-frame index)) id))



More information about the armedbear-devel mailing list