1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-13 23:20:32 +02:00

add ability to disassemble ELF images

* module/scripts/disassemble.scm (disassemble): Update to work with
  RTl (and only RTL, as that's the future).

* module/system/vm/debug.scm (for-each-elf-symbol): New public
  interface.
  (debug-context-from-image): New helper.
  (find-debug-context): Use the helper.

* module/system/vm/disassembler.scm (disassemble-image): New public
  interface.
This commit is contained in:
Andy Wingo 2013-08-29 20:43:03 +02:00
parent c96933fd54
commit 610295ec9d
3 changed files with 55 additions and 9 deletions

View file

@ -1,6 +1,6 @@
;;; Disassemble --- Disassemble .go files into something human-readable
;; Copyright 2005, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
;; Copyright 2005, 2008, 2009, 2011, 2012, 2013 Free Software Foundation, Inc.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public License
@ -22,12 +22,14 @@
;;; Commentary:
;; Usage: disassemble [ARGS]
;; Usage: disassemble FILE...
;;; Code:
(define-module (scripts disassemble)
#:use-module (system vm objcode)
#:use-module (system vm program)
#:use-module (system vm disassembler)
#:use-module ((language assembly disassemble)
#:renamer (symbol-prefix-proc 'asm:))
#:export (disassemble))
@ -36,7 +38,9 @@
(define (disassemble . files)
(for-each (lambda (file)
(asm:disassemble (load-thunk-from-file file)))
(let* ((thunk (load-thunk-from-file file))
(elf (find-mapped-elf-image (rtl-program-code thunk))))
(disassemble-image elf)))
files))
(define main disassemble)