From fb6df3ea137eabad25d70219da2c84282883b433 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 29 Mar 2011 12:38:18 +0200 Subject: [PATCH] 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. --- module/language/objcode/spec.scm | 4 ++-- module/system/repl/command.scm | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/module/language/objcode/spec.scm b/module/language/objcode/spec.scm index bbd745412..7cc85b7f6 100644 --- a/module/language/objcode/spec.scm +++ b/module/language/objcode/spec.scm @@ -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" diff --git a/module/system/repl/command.scm b/module/system/repl/command.scm index 87ab993a5..109b533f8 100644 --- a/module/system/repl/command.scm +++ b/module/system/repl/command.scm @@ -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