Commit cfcf42ff authored by Brian Leung's avatar Brian Leung Committed by Juri Linkov
Browse files

Ensure that gud commands for non-GDB debuggers are handled by repeat-mode

* lisp/progmodes/gud.el (sdb-repeat-map): Define.
(sdb): Set repeat-mode property to the symbol corresponding to the
repeat map.
(dbx-repeat-map): Define.
(dbx): Set repeat-mode property to the symbol corresponding to the
repeat map.
(xdb-repeat-map): Define.
(xdb): Set repeat-mode property to the symbol corresponding to the
repeat map.
(perldb-repeat-map): Define.
(perldb): Set repeat-mode property to the symbol corresponding to the
repeat map.
(pdb-repeat-map): Define.
(pdb): Set repeat-mode property to the symbol corresponding to the
repeat map.
(guiler-repeat-map): Define.
(guiler): Set repeat-mode property to the symbol corresponding to the
repeat map.
(jdb-repeat-map): Define.
(jdb): Set repeat-mode property to the symbol corresponding to the
repeat map.  (Bug#49632)
parent 29d62099
Pipeline #11624 failed with stages
in 14 seconds
......@@ -1037,6 +1037,18 @@ SKIP is the number of chars to skip on each line, it defaults to 0."
(defvar gud-sdb-lastfile nil)
(defvar sdb-repeat-map
(let ((map (make-sparse-keymap)))
(pcase-dolist (`(,key . ,cmd) '(("n" . gud-next)
("s" . gud-step)
("i" . gud-stepi)
("c" . gud-cont)
("l" . gud-refresh)))
(define-key map key cmd))
map)
"Keymap to repeat `sdb' stepping instructions `C-x C-a C-n n n'.
Used in `repeat-mode'.")
(defun gud-sdb-marker-filter (string)
(setq gud-marker-acc
(if gud-marker-acc (concat gud-marker-acc string) string))
......@@ -1107,6 +1119,8 @@ and source-file directory for your debugger."
(gud-def gud-cont "c" "\C-r" "Continue with display.")
(gud-def gud-print "%e/" "\C-p" "Evaluate C expression at point.")
(gud-set-repeat-map-property 'sdb-repeat-map)
(setq comint-prompt-regexp "\\(^\\|\n\\)\\*")
(setq paragraph-start comint-prompt-regexp)
(run-hooks 'sdb-mode-hook)
......@@ -1265,6 +1279,23 @@ whereby $stopformat=1 produces an output format compatible with
;; whereby `set $stopformat=1' reportedly produces output compatible
;; with `gud-dbx-marker-filter', which we prefer.
(defvar dbx-repeat-map
(let ((map (make-sparse-keymap)))
(pcase-dolist (`(,key . ,cmd) '(("n" . gud-next)
("s" . gud-step)
("i" . gud-stepi)
("c" . gud-cont)
("l" . gud-refresh)
("<" . gud-up)
(">" . gud-down)))
(define-key map key cmd))
(when (or gud-mips-p
gud-irix-p)
(define-key map "f" 'gud-finish))
map)
"Keymap to repeat `dbx' stepping instructions `C-x C-a C-n n n'.
Used in `repeat-mode'.")
;; The process filter is also somewhat
;; unreliable, sometimes not spotting the markers; I don't know
;; whether there's anything that can be done about that.]
......@@ -1412,6 +1443,8 @@ and source-file directory for your debugger."
(gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.")
(gud-def gud-run "run" nil "Run the program.")
(gud-set-repeat-map-property 'dbx-repeat-map)
(setq comint-prompt-regexp "^[^)\n]*dbx) *")
(setq paragraph-start comint-prompt-regexp)
(run-hooks 'dbx-mode-hook)
......@@ -1423,6 +1456,21 @@ and source-file directory for your debugger."
;; History of argument lists passed to xdb.
(defvar gud-xdb-history nil)
(defvar xdb-repeat-map
(let ((map (make-sparse-keymap)))
(pcase-dolist (`(,key . ,cmd) '(("n" . gud-next)
("s" . gud-step)
("i" . gud-stepi)
("c" . gud-cont)
("l" . gud-refresh)
("f" . gud-finish)
("<" . gud-up)
(">" . gud-down)))
(define-key map key cmd))
map)
"Keymap to repeat `xdb' stepping instructions `C-x C-a C-n n n'.
Used in `repeat-mode'.")
(defcustom gud-xdb-directories nil
"A list of directories that xdb should search for source code.
If nil, only source files in the program directory
......@@ -1488,6 +1536,8 @@ directories if your program contains sources from more than one directory."
(gud-def gud-finish "bu\\t" "\C-f" "Finish executing current function.")
(gud-def gud-print "p %e" "\C-p" "Evaluate C expression at point.")
(gud-set-repeat-map-property 'xdb-repeat-map)
(setq comint-prompt-regexp "^>")
(setq paragraph-start comint-prompt-regexp)
(run-hooks 'xdb-mode-hook))
......@@ -1498,6 +1548,17 @@ directories if your program contains sources from more than one directory."
;; History of argument lists passed to perldb.
(defvar gud-perldb-history nil)
(defvar perldb-repeat-map
(let ((map (make-sparse-keymap)))
(pcase-dolist (`(,key . ,cmd) '(("n" . gud-next)
("s" . gud-step)
("c" . gud-cont)
("l" . gud-refresh)))
(define-key map key cmd))
map)
"Keymap to repeat `perldb' stepping instructions `C-x C-a C-n n n'.
Used in `repeat-mode'.")
(defun gud-perldb-massage-args (_file args)
"Convert a command line as would be typed normally to run perldb
into one that invokes an Emacs-enabled debugging session.
......@@ -1640,6 +1701,7 @@ and source-file directory for your debugger."
(gud-def gud-print "p %e" "\C-p" "Evaluate perl expression at point.")
(gud-def gud-until "c %l" "\C-u" "Continue to current line.")
(gud-set-repeat-map-property 'perldb-repeat-map)
(setq comint-prompt-regexp "^ DB<+[0-9]+>+ ")
(setq paragraph-start comint-prompt-regexp)
......@@ -1668,6 +1730,20 @@ and source-file directory for your debugger."
(defvar gud-pdb-marker-regexp-start "^> ")
(defvar pdb-repeat-map
(let ((map (make-sparse-keymap)))
(pcase-dolist (`(,key . ,cmd) '(("n" . gud-next)
("s" . gud-step)
("c" . gud-cont)
("l" . gud-refresh)
("f" . gud-finish)
("<" . gud-up)
(">" . gud-down)))
(define-key map key cmd))
map)
"Keymap to repeat `pdb' stepping instructions `C-x C-a C-n n n'.
Used in `repeat-mode'.")
;; There's no guarantee that Emacs will hand the filter the entire
;; marker at once; it could be broken up across several strings. We
;; might even receive a big chunk with several markers in it. If we
......@@ -1757,6 +1833,8 @@ directory and source-file directory for your debugger."
(gud-def gud-print "p %e" "\C-p" "Evaluate Python expression at point.")
(gud-def gud-statement "!%e" "\C-e" "Execute Python statement at point.")
(gud-set-repeat-map-property 'pdb-repeat-map)
;; (setq comint-prompt-regexp "^(.*pdb[+]?) *")
(setq comint-prompt-regexp "^(Pdb) *")
(setq paragraph-start comint-prompt-regexp)
......@@ -1770,6 +1848,19 @@ directory and source-file directory for your debugger."
(defvar gud-guiler-lastfile nil)
(defvar guiler-repeat-map
(let ((map (make-sparse-keymap)))
(pcase-dolist (`(,key . ,cmd) '(("n" . gud-next)
("s" . gud-step)
("l" . gud-refresh)
("f" . gud-finish)
("<" . gud-up)
(">" . gud-down)))
(define-key map key cmd))
map)
"Keymap to repeat `guiler' stepping instructions `C-x C-a C-n n n'.
Used in `repeat-mode'.")
(defun gud-guiler-marker-filter (string)
(setq gud-marker-acc (if gud-marker-acc (concat gud-marker-acc string) string))
......@@ -1835,6 +1926,8 @@ and source-file directory for your debugger."
(gud-def gud-down ",down" ">" "Down one stack frame.")
(gud-def gud-print "%e" "\C-p" "Evaluate Guile expression at point.")
(gud-set-repeat-map-property 'guiler-repeat-map)
(setq comint-prompt-regexp "^scheme@([^>]+> ")
(setq paragraph-start comint-prompt-regexp)
(run-hooks 'guiler-mode-hook))
......@@ -2280,6 +2373,21 @@ extension EXTN. Normally EXTN is given as the regular expression
;; Note: Reset to this value every time a prompt is seen
(defvar gud-jdb-lowest-stack-level 999)
(defvar jdb-repeat-map
(let ((map (make-sparse-keymap)))
(pcase-dolist (`(,key . ,cmd) '(("n" . gud-next)
("s" . gud-step)
("i" . gud-stepi)
("c" . gud-cont)
("f" . gud-finish)
("<" . gud-up)
(">" . gud-down)
("l" . gud-refresh)))
(define-key map key cmd))
map)
"Keymap to repeat `jdb' stepping instructions `C-x C-a C-n n n'.
Used in `repeat-mode'.")
(defun gud-jdb-find-source-using-classpath (p)
"Find source file corresponding to fully qualified class P.
Convert P from jdb's output, converted to a pathname
......@@ -2488,6 +2596,8 @@ gud, see `gud-mode'."
(gud-def gud-print "print %e" "\C-p" "Print value of expression at point.")
(gud-def gud-pstar "dump %e" nil "Print all object information at point.")
(gud-set-repeat-map-property 'jdb-repeat-map)
(setq comint-prompt-regexp "^> \\|^[^ ]+\\[[0-9]+\\] ")
(setq paragraph-start comint-prompt-regexp)
(run-hooks 'jdb-mode-hook)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment