diff options
author | jao <jao@gnu.org> | 2021-12-26 23:38:07 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-12-26 23:38:07 +0000 |
commit | 5ab51e135f0183af3646b48065ebfeda8c93e880 (patch) | |
tree | 39a7a01db1bd064b4c8d6a9cbe0ea43ee1e131f7 /elisp | |
parent | d4bfb82612e44de893bf4fcc702eaa360ae9128a (diff) | |
download | geiser-buggie-buggie.tar.gz geiser-buggie-buggie.tar.bz2 |
Commands to set breakpoints (at location and at function)buggie-buggie
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-debug.el | 26 | ||||
-rw-r--r-- | elisp/geiser-mode.el | 7 |
2 files changed, 30 insertions, 3 deletions
diff --git a/elisp/geiser-debug.el b/elisp/geiser-debug.el index f5b98a3..1953408 100644 --- a/elisp/geiser-debug.el +++ b/elisp/geiser-debug.el @@ -120,13 +120,16 @@ all ANSI sequences." ret (geiser-eval--retort-result-str ret nil))) +(defun geiser-debug--send-dbg-and-display (thing) + (when-let (ret (geiser-debug--send-dbg thing)) + (geiser-debug--debugger-display thing ret))) + (defun geiser-debug--send-to-repl (thing) (unless (and geiser-debug--debugger-active-p geiser-debug--sender-buffer) (error "Debugger not active")) (save-window-excursion (with-current-buffer geiser-debug--sender-buffer - (when-let (ret (geiser-debug--send-dbg thing)) - (geiser-debug--debugger-display thing ret))))) + (geiser-debug--send-dbg-and-display thing)))) (defun geiser-debug-switch-to-buffer () "Return to the scheme buffer that pooped this debug window." @@ -159,6 +162,24 @@ all ANSI sequences." (interactive) (geiser-debug--send-to-repl 'error)) +(defun geiser-debug-debugger-next () + "Step to next source location." + (interactive) + (geiser-debug--send-to-repl 'next)) + +(defun geiser-debug-set-breakpoint-loc (&optional file line) + "Set breakpoint at FILE and LINE, or current position if not given." + (interactive) + (let ((file (or file (buffer-file-name))) + (line (or line (line-number-at-pos)))) + (geiser-debug--send-dbg-and-display `(break-at-source ,file ,line)))) + +(defun geiser-debug-set-breakpoint-func () + "Ask for a function name and set a breakpoint on entering it." + (interactive) + (let ((fn (geiser-completion--read-symbol "Set breakpoint for: "))) + (geiser-debug--send-dbg-and-display `(break ,fn)))) + (transient-define-prefix geiser-debug--debugger-transient () "Debugging meta-commands." [:description (lambda () (format "%s debugger" (geiser-impl--impl-str))) @@ -169,6 +190,7 @@ all ANSI sequences." ("l" "locals" geiser-debug-debugger-locals) ("r" " registers" geiser-debug-debugger-registers)] ["Go" + ("n" "Step next" geiser-debug-debugger-next) ("jn" "Jump to next error" next-error) ("jp" "Jump to previous error" previous-error) ("x" "Exit debug level" geiser-debug-debugger-quit)]]) diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el index 1e5df0b..87efe22 100644 --- a/elisp/geiser-mode.el +++ b/elisp/geiser-mode.el @@ -1,6 +1,6 @@ ;;; geiser-mode.el -- minor mode for scheme buffers -;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2020 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2020, 2021 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -319,6 +319,11 @@ With prefix, try to enter the current buffer's module." ("Switch to REPL and enter module" "\C-c\C-a" geiser-mode-switch-to-repl-and-enter) ("Set Scheme..." "\C-c\C-s" geiser-set-scheme) + -- + ("Break at point" ((kbd "C-c C-p C-b") (kbd "C-c C-p b")) + geiser-debug-set-breakpoint-loc) + ("Break at function" ((kbd "C-c C-p C-S-b") (kbd "C-c C-p S-b")) + geiser-debug-set-breakpoint-func) ("Exit REPL or debugger" "\C-c\C-q" geiser-exit-repl) -- ("Edit symbol at point" "\M-." geiser-edit-symbol-at-point |