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

fix error message on ,disassemble "non-procedure"

* module/language/objcode/spec.scm (decompile-value): Don't assume that
  `error' will handle format strings appropriately.
* module/system/repl/command.scm (disassemble): A more human error when
  you disassemble a non-procedure.

Bug reported by Andrew Horton.
This commit is contained in:
Andy Wingo 2011-03-29 12:38:18 +02:00
parent 2460274d36
commit fb6df3ea13
2 changed files with 7 additions and 3 deletions

View file

@ -1,6 +1,6 @@
;;; Guile Lowlevel Intermediate Language
;; Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
;; Copyright (C) 2001, 2009, 2010, 2011 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -71,7 +71,7 @@
((objcode? x)
(values x #f))
(else
(error "can't decompile ~A: not a program or objcode" x))))
(error "Object for disassembly not a program or objcode" x))))
(define-language objcode
#:title "Guile Object Code"

View file

@ -465,7 +465,11 @@ Compile a file."
(define-meta-command (disassemble repl (form))
"disassemble EXP
Disassemble a compiled procedure."
(guile:disassemble (repl-eval repl (repl-parse repl form))))
(let ((obj (repl-eval repl (repl-parse repl form))))
(if (or (program? obj) (objcode? obj))
(guile:disassemble obj)
(format #t "Argument to ,disassemble not a procedure or objcode: ~a~%"
obj))))
(define-meta-command (disassemble-file repl file)
"disassemble-file FILE