Created
September 17, 2010 04:51
-
-
Save kurohuku/583736 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar *arch-type* "i386") | |
(defun make-disasm-command (target file) | |
(format "objdump -b binary -m %s -D %s" target file)) | |
(defun make-perl-command (lst tmp-file) | |
(concat | |
"perl -e 'print \"" | |
(apply | |
'concat | |
(mapcar | |
(lambda (n) | |
(format "\\x%x" n)) | |
lst)) | |
"\"' >" | |
tmp-file)) | |
(defun disasm-byte-list (lst) | |
(let ((tmp-file (make-temp-file "disasm_"))) | |
(let ((file-buf (find-file-noselect tmp-file)) | |
(cmd (make-disasm-command *arch-type* tmp-file))) | |
(shell-command (make-perl-command lst tmp-file)) | |
(let ((buf (get-buffer-create "*disasm*"))) | |
(shell-command cmd buf) | |
(delete-file tmp-file) | |
(pop-to-buffer buf))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment