branch: master commit bc3fa207633d9f17036546de7ad6d4cd2fba936b Author: rocky <ro...@gnu.org> Commit: rocky <ro...@gnu.org>
Add some enable/disble patterns Note: code for perl, zshdb and bashdb will work right only after the next releases of these packages. --- realgud/debugger/bashdb/init.el | 4 +- realgud/debugger/trepan.pl/init.el | 18 +++++++++ realgud/debugger/trepan2/init.el | 18 +++++++++ realgud/debugger/trepan3k/init.el | 18 +++++++++ realgud/debugger/zshdb/init.el | 14 ++++++- realgud/lang/posix-shell.el | 2 +- test/test-regexp-bashdb.el | 4 +- test/test-regexp-trepanpl.el | 26 ++++++++++++ test/test-regexp-zshdb.el | 78 +++++++++++++++++++++++++++++------- 9 files changed, 160 insertions(+), 22 deletions(-) diff --git a/realgud/debugger/bashdb/init.el b/realgud/debugger/bashdb/init.el index 1359d08..1a34b81 100644 --- a/realgud/debugger/bashdb/init.el +++ b/realgud/debugger/bashdb/init.el @@ -58,7 +58,7 @@ realgud-loc-pat struct") ;; Regular expression that describes a debugger "delete" (breakpoint) response. ;; For example: -;; Removed 1 breakpoint(s). +;; Deleted breakpoint 1. (setf (gethash "brkpt-del" realgud:bashdb-pat-hash) realgud:POSIX-debugger-brkpt-del-pat) @@ -98,7 +98,7 @@ realgud-loc-pat struct") (setf (gethash "bashdb" realgud-command-hash) realgud:bashdb-command-hash) (setf (gethash "clear" realgud:bashdb-command-hash) "clear %l") -(setf (gethash "quit" realgud:bashdb-command-hash) "quit!") +(setf (gethash "quit" realgud:bashdb-command-hash) "quit") (setf (gethash "until" realgud:bashdb-command-hash) "continue %l") (provide-me "realgud:bashdb-") diff --git a/realgud/debugger/trepan.pl/init.el b/realgud/debugger/trepan.pl/init.el index 8092120..0d9e744 100644 --- a/realgud/debugger/trepan.pl/init.el +++ b/realgud/debugger/trepan.pl/init.el @@ -143,6 +143,24 @@ realgud-loc-pat struct") realgud:regexp-captured-num) :num 1)) +;; Regular expression that describes a debugger "disable" (breakpoint) response. +;; For example: +;; Breakpoint entry 4 disabled. +(setf (gethash "brkpt-disable" realgud:trepanpl-pat-hash) + (make-realgud-loc-pat + :regexp (format "^Breakpoint entry %s disabled" + realgud:regexp-captured-num) + :num 1)) + +;; Regular expression that describes a debugger "enable" (breakpoint) response. +;; For example: +;; Breakpoint entry 4 enabled. +(setf (gethash "brkpt-enable" realgud:trepanpl-pat-hash) + (make-realgud-loc-pat + :regexp (format "^Breakpoint entry %s enabled" + realgud:regexp-captured-num) + :num 1)) + (defconst realgud:trepanpl-selected-frame-indicator "-->" "String that describes which frame is selected in a debugger backtrace listing.") diff --git a/realgud/debugger/trepan2/init.el b/realgud/debugger/trepan2/init.el index 9fb9fec..371f44e 100644 --- a/realgud/debugger/trepan2/init.el +++ b/realgud/debugger/trepan2/init.el @@ -65,6 +65,24 @@ realgud-loc-pat struct") (setf (gethash "brkpt-del" realgud:trepan2-pat-hash) realgud:python-trepan-brkpt-del-pat) +;; Regular expression that describes a debugger "disable" (breakpoint) response. +;; For example: +;; Breakpoint entry 4 disabled. +(setf (gethash "brkpt-disable" realgud:trepan2-pat-hash) + (make-realgud-loc-pat + :regexp (format "^Breakpoint entry %s disabled" + realgud:regexp-captured-num) + :num 1)) + +;; Regular expression that describes a debugger "enable" (breakpoint) response. +;; For example: +;; Breakpoint entry 4 enabled. +(setf (gethash "brkpt-enable" realgud:trepan2-pat-hash) + (make-realgud-loc-pat + :regexp (format "^Breakpoint entry %s enabled" + realgud:regexp-captured-num) + :num 1)) + ;; Regular expression for a termination message. (setf (gethash "termination" realgud:trepan2-pat-hash) "^trepan2: That's all, folks...\n") diff --git a/realgud/debugger/trepan3k/init.el b/realgud/debugger/trepan3k/init.el index b9d8f2a..ded4d56 100644 --- a/realgud/debugger/trepan3k/init.el +++ b/realgud/debugger/trepan3k/init.el @@ -63,6 +63,24 @@ realgud-loc-pat struct") (setf (gethash "brkpt-del" realgud:trepan3k-pat-hash) realgud:python-trepan-brkpt-del-pat) +;; Regular expression that describes a debugger "disable" (breakpoint) response. +;; For example: +;; Breakpoint entry 4 disabled. +(setf (gethash "brkpt-disable" realgud:trepan3k-pat-hash) + (make-realgud-loc-pat + :regexp (format "^Breakpoint entry %s disabled" + realgud:regexp-captured-num) + :num 1)) + +;; Regular expression that describes a debugger "enable" (breakpoint) response. +;; For example: +;; Breakpoint entry 4 enabled. +(setf (gethash "brkpt-enable" realgud:trepan3k-pat-hash) + (make-realgud-loc-pat + :regexp (format "^Breakpoint entry %s enabled" + realgud:regexp-captured-num) + :num 1)) + ;; Regular expression for a termination message. (setf (gethash "termination" realgud:trepan3k-pat-hash) "^trepan3k: That's all, folks...\n") diff --git a/realgud/debugger/zshdb/init.el b/realgud/debugger/zshdb/init.el index e8bc9ff..f2fd9b5 100644 --- a/realgud/debugger/zshdb/init.el +++ b/realgud/debugger/zshdb/init.el @@ -56,10 +56,22 @@ realgud-loc-pat struct") ;; Regular expression that describes a debugger "delete" (breakpoint) response. ;; For example: -;; Removed 1 breakpoint(s). +;; Deleted breakpoint 1. (setf (gethash "brkpt-del" realgud:zshdb-pat-hash) realgud:POSIX-debugger-brkpt-del-pat) +;; Regular expression that describes a debugger "disable" (breakpoint) response. +;; For example: +;; Breakpoint entry 4 disabled. +(setf (gethash "brkpt-disable" realgud:zshdb-pat-hash) + realgud:POSIX-debugger-brkpt-disable-pat) + +;; Regular expression that describes a debugger "enable" (breakpoint) response. +;; For example: +;; Breakpoint entry 4 enabled. +(setf (gethash "brkpt-enable" realgud:zshdb-pat-hash) + realgud:POSIX-debugger-brkpt-enable-pat) + ;; Regular expression that describes a debugger "backtrace" command line. ;; For example: ;; ->0 in file `/etc/apparmor/fns' at line 24 diff --git a/realgud/lang/posix-shell.el b/realgud/lang/posix-shell.el index c647f8f..f929d07 100644 --- a/realgud/lang/posix-shell.el +++ b/realgud/lang/posix-shell.el @@ -103,7 +103,7 @@ traceback) line." ) ;; Removed 1 breakpoint(s). (defconst realgud:POSIX-debugger-brkpt-del-pat (make-realgud-loc-pat - :regexp (format "^Removed %s breakpoint(s).\n" + :regexp (format "^Deleted breakpoint %s.\n" realgud:regexp-captured-num) :num 1)) diff --git a/test/test-regexp-bashdb.el b/test/test-regexp-bashdb.el index d171e76..9d84ee3 100644 --- a/test/test-regexp-bashdb.el +++ b/test/test-regexp-bashdb.el @@ -112,17 +112,15 @@ (match-end file-group))) (note "breakpoint delete matching") -(setq test-text "Removed 1 breakpoint(s).\n") +(setq test-text "Deleted breakpoint 1.\n") (assert-t (numberp (loc-match test-text bp-del-pat)) "breakpoint delete matching") (note "breakpoint enable matching") (setq test-text "Breakpoint entry 4 enabled.\n") (assert-t (numberp (loc-match test-text bp-enable-pat)) "breakpoint enable matching") - (note "breakpoint disable matching") (setq test-text "Breakpoint entry 2 disabled.\n") (assert-t (numberp (loc-match test-text bp-disable-pat)) "breakpoint disable matching") - (end-tests) diff --git a/test/test-regexp-trepanpl.el b/test/test-regexp-trepanpl.el index 694dc1d..9e4fb44 100644 --- a/test/test-regexp-trepanpl.el +++ b/test/test-regexp-trepanpl.el @@ -17,6 +17,10 @@ (defvar dbg-bt-pat) (defvar bps-pat) (defvar realgud-bt-pat) + (defvar brkpt-del) + (defvar bp-del-pat) + (defvar bp-enable-pat) + (defvar bp-disable-pat) (defvar realgud-perl-ignnore-file-re) ) (declare-function __FILE__ 'load-relative) @@ -31,6 +35,15 @@ (gethash "lang-backtrace" realgud:trepanpl-pat-hash)) +(set (make-local-variable 'bp-del-pat) + (gethash "brkpt-del" realgud:trepanpl-pat-hash)) + +(set (make-local-variable 'bp-enable-pat) + (gethash "brkpt-enable" realgud:trepanpl-pat-hash)) + +(set (make-local-variable 'bp-disable-pat) + (gethash "brkpt-disable" realgud:trepanpl-pat-hash)) + (note "prompt matching") (set (make-local-variable 'prompt-pat) (gethash "prompt" realgud:trepanpl-pat-hash)) @@ -86,4 +99,17 @@ bps-pat) test-text) "extract breakpoint line number") +;; (note "breakpoint delete matching") +;; (setq test-text "Deleted breakpoint 1.\n") +;; (assert-t (numberp (loc-match test-text bp-del-pat)) "breakpoint delete matching") + +(note "breakpoint enable matching") +(setq test-text "Breakpoint entry 4 enabled.\n") +(assert-t (numberp (loc-match test-text bp-enable-pat)) "breakpoint enable matching") + + +(note "breakpoint disable matching") +(setq test-text "Breakpoint entry 2 disabled.\n") +(assert-t (numberp (loc-match test-text bp-disable-pat)) "breakpoint disable matching") + (end-tests) diff --git a/test/test-regexp-zshdb.el b/test/test-regexp-zshdb.el index c9ff95a..ee511b3 100644 --- a/test/test-regexp-zshdb.el +++ b/test/test-regexp-zshdb.el @@ -5,11 +5,46 @@ (load-file "../realgud/debugger/zshdb/init.el") (load-file "./regexp-helper.el") +(declare-function loc-match 'realgud-helper) +(declare-function prompt-match 'regexp-helper) +(declare-function realgud-loc-pat-num 'realgud-regexp) +(declare-function realgud-loc-pat-regexp 'realgud-regexp) +(declare-function realgud-loc-pat-file-group 'realgud-regexp) +(declare-function realgud-loc-pat-line-group 'realgud-regexp) +(declare-function __FILE__ 'load-relative) + (test-simple-start) +(eval-when-compile + (defvar file-group) + (defvar frame-re) + (defvar frame-pat) + (defvar line-group) + (defvar num-group) + (defvar test-pos) + (defvar prompt-pat) + (defvar realgud:zshdb-pat-hash) + (defvar realgud-pat-bt) + (defvar test-s1) + (defvar test-text) + (defvar brkpt-del) + (defvar bp-del-pat) + (defvar bp-enable-pat) + (defvar bp-disable-pat) +) + (setq prompt-pat (gethash "prompt" realgud:zshdb-pat-hash)) (setq frame-pat (gethash "debugger-backtrace" realgud:zshdb-pat-hash)) +(set (make-local-variable 'bp-del-pat) + (gethash "brkpt-del" realgud:zshdb-pat-hash)) + +(set (make-local-variable 'bp-enable-pat) + (gethash "brkpt-enable" realgud:zshdb-pat-hash)) + +(set (make-local-variable 'bp-disable-pat) + (gethash "brkpt-disable" realgud:zshdb-pat-hash)) + (note "zshdb prompt matching") (prompt-match "zshdb<10> " "10") (prompt-match "zshdb<(5)> " "5" "subshell prompt %s") @@ -18,7 +53,7 @@ (note "zshdb frame matching") (note "debugger-backtrace") -(setq s1 +(setq test-s1 "->0 in file `/etc/apparmor/functions' at line 24 ##1 /etc/apparmor/functions called from file `/etc/init.d/apparmor' at line 35 ##2 /etc/init.d/apparmor called from file `/usr/local/bin/zshdb' at line 129 @@ -27,44 +62,57 @@ (setq num-group (realgud-loc-pat-num frame-pat)) (setq file-group (realgud-loc-pat-file-group frame-pat)) (setq line-group (realgud-loc-pat-line-group frame-pat)) -(assert-equal 0 (string-match frame-re s1)) -(assert-equal "0" (substring s1 +(assert-equal 0 (string-match frame-re test-s1)) +(assert-equal "0" (substring test-s1 (match-beginning num-group) (match-end num-group))) (assert-equal "/etc/apparmor/functions" - (substring s1 + (substring test-s1 (match-beginning file-group) (match-end file-group))) (assert-equal "24" - (substring s1 + (substring test-s1 (match-beginning line-group) (match-end line-group))) -(setq pos (match-end 0)) +(setq test-pos (match-end 0)) -(assert-equal 49 (string-match frame-re s1 pos)) -(assert-equal "1" (substring s1 +(assert-equal 49 (string-match frame-re test-s1 test-pos)) +(assert-equal "1" (substring test-s1 (match-beginning num-group) (match-end num-group))) (assert-equal "/etc/init.d/apparmor" - (substring s1 + (substring test-s1 (match-beginning file-group) (match-end file-group))) (assert-equal "35" - (substring s1 + (substring test-s1 (match-beginning line-group) (match-end line-group))) -(setq pos (match-end 0)) -(assert-equal 128 (string-match frame-re s1 pos)) -(assert-equal "2" (substring s1 +(setq test-pos (match-end 0)) +(assert-equal 128 (string-match frame-re test-s1 test-pos)) +(assert-equal "2" (substring test-s1 (match-beginning num-group) (match-end num-group))) (assert-equal "/usr/local/bin/zshdb" - (substring s1 + (substring test-s1 (match-beginning file-group) (match-end file-group))) (assert-equal "129" - (substring s1 + (substring test-s1 (match-beginning line-group) (match-end line-group))) +(note "breakpoint delete matching") +(setq test-text "Deleted breakpoint 1.\n") +(assert-t (numberp (loc-match test-text bp-del-pat)) "breakpoint delete matching") + +(note "breakpoint enable matching") +(setq test-text "Breakpoint entry 4 enabled.\n") +(assert-t (numberp (loc-match test-text bp-enable-pat)) "breakpoint enable matching") + + +(note "breakpoint disable matching") +(setq test-text "Breakpoint entry 2 disabled.\n") +(assert-t (numberp (loc-match test-text bp-disable-pat)) "breakpoint disable matching") + (end-tests)