Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autopopulate *available-disassemblers* and autoload chosen disassemblers #434

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/org/armedbear/lisp/disassemble.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@
(in-package :system)
(require :clos)

(eval-when (:load-toplevel)
(defvar *available-disassemblers*
(let ((files
(directory (merge-pathnames
"abcl-introspect/*.lisp"
sys::*abcl-contrib*))))
(loop for f in files
append
(with-open-file (s f :direction :input)
(loop for line = (read-line s nil :eof)
until (eq line :eof)
when (search "disassemble-class-bytes" line)
do (return (list (intern (string-upcase (pathname-name f)) :keyword)))))))))

(defvar *disassembler-function* nil
"The currently used function for CL:DISASSEMBLE.

Expand Down Expand Up @@ -63,6 +77,8 @@ SYS:*DISASSEMBLERS*."
(flet ((sane-disassembler-p (disassembler)
(and disassembler
(fboundp disassembler))))
(when (member name *available-disassemblers*)
(require name))
(setf *disassembler-function*
(if name
(let ((disassembler (cdr (assoc name *disassemblers*))))
Expand Down