summaryrefslogtreecommitdiff
path: root/module/system/repl/command.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2010-09-19 11:32:47 +0200
committerAndy Wingo <wingo@pobox.com>2010-09-19 11:32:47 +0200
commit589520bc59981bcf60f4f348961f57301731c438 (patch)
tree592b62ebab1989748c345d7338d7c79087526127 /module/system/repl/command.scm
parentb9badc35ab555e92812a16a0b91186c887d01f7c (diff)
downloadguile-589520bc59981bcf60f4f348961f57301731c438.tar.gz
add ,traps ,delete ,disable ,enable
* module/system/repl/command.scm (traps, delete, disable, enable): New meta-commands.
Diffstat (limited to 'module/system/repl/command.scm')
-rw-r--r--module/system/repl/command.scm44
1 files changed, 43 insertions, 1 deletions
diff --git a/module/system/repl/command.scm b/module/system/repl/command.scm
index 4f88ef0d0..ed1cba9f9 100644
--- a/module/system/repl/command.scm
+++ b/module/system/repl/command.scm
@@ -57,7 +57,8 @@
(profile (time t) (profile pr) (trace tr))
(debug (backtrace bt) (up) (down) (frame fr)
(procedure proc) (locals) (error-message error)
- (break br))
+ (break br)
+ (traps) (delete del) (disable) (enable))
(inspect (inspect i) (pretty-print pp))
(system (gc) (statistics stat) (option o)
(quit q continue cont))))
@@ -579,6 +580,47 @@ Starts a recursive prompt when PROCEDURE is called."
(let ((idx (add-trap-at-procedure-call! proc)))
(format #t "Added breakpoint ~a at ~a.~%" idx proc)))))
+(define-meta-command (traps repl)
+ "traps
+Show the set of currently attached traps.
+
+Show the set of currently attached traps (breakpoints)."
+ (let ((traps (list-traps)))
+ (if (null? traps)
+ (format #t "No traps enabled.~%")
+ (for-each (lambda (idx name)
+ (format #t " ~a: ~a~a~%"
+ idx name
+ (if (trap-enabled? idx) "" " (disabled)")))
+ (map car traps) (map cdr traps)))))
+
+(define-meta-command (delete repl idx)
+ "delete IDX
+Delete a trap.
+
+Delete a trap."
+ (if (not (integer? idx))
+ (error "expected a trap index (a non-negative integer)" idx)
+ (delete-trap! idx)))
+
+(define-meta-command (disable repl idx)
+ "disable IDX
+Disable a trap.
+
+Disable a trap."
+ (if (not (integer? idx))
+ (error "expected a trap index (a non-negative integer)" idx)
+ (disable-trap! idx)))
+
+(define-meta-command (enable repl idx)
+ "enable IDX
+Enable a trap.
+
+Enable a trap."
+ (if (not (integer? idx))
+ (error "expected a trap index (a non-negative integer)" idx)
+ (enable-trap! idx)))
+
;;;