bug#56515: [PATCH] Add ,delete-all to delete all traps

Ekaitz Zarraga <[email protected]>
Newsgroups gmane.lisp.guile.bugs,gmane.lisp.guile.devel
Message-ID <plpdn0kNvpUbn6F99THTWY_QuhorDWoyCkGf2WE6qP-whS8KPFp9hW0nqqjcW3gcCaUWX8CASgvnLyRLPrcZtKRTROWaCjfpVHxBzINMGSQ=@elenq.tech>
Hi all,

I attach a patch to add a ,delete-all or ,dela command to the REPL that deletes
all traps.

I considered it could be useful once the debugging is done to be able to
continue with the normal execution of the program.

I hope it's useful.

Ekaitz
0001-Add-delete-all-to-delete-all-traps.patch (text/x-patch, 1.3 KB)
From 066d20e1f0a2b4bb864d23517c96f8fb94b9bdcb Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <[email protected]>
Date: Tue, 12 Jul 2022 10:05:46 +0200
Subject: [PATCH] Add ,delete-all to delete all traps

* module/system/repl/command.scm (delete-all): New meta-command.
---
 module/system/repl/command.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/module/system/repl/command.scm b/module/system/repl/command.scm
index ac1fa0933..3eb383c63 100644
--- a/module/system/repl/command.scm
+++ b/module/system/repl/command.scm
@@ -65,7 +65,7 @@
               (next n) (next-instruction ni)
               (finish)
               (tracepoint tp)
-              (traps) (delete del) (disable) (enable)
+              (traps) (delete del) (delete-all dela) (disable) (enable)
               (registers regs))
     (inspect  (inspect i) (pretty-print pp))
     (system   (gc) (statistics stat) (option o)
@@ -806,6 +806,13 @@ Delete a trap."
       (error "expected a trap index (a non-negative integer)" idx)
       (delete-trap! idx)))
 
+(define-meta-command (delete-all repl)
+  "delete-all
+Delete all traps.
+
+Delete all traps."
+(map delete-trap! (list-traps)))
+
 (define-meta-command (disable repl idx)
   "disable IDX
 Disable a trap.

base-commit: 118ee0c50ba90ea7ad7ff1fd2a212bbbb7a66d99
-- 
2.36.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.