emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master b6407b9 197/215: Merge pull request #130 from realgud/enab


From: Rocky Bernstein
Subject: [elpa] master b6407b9 197/215: Merge pull request #130 from realgud/enable-disable
Date: Sat, 30 Jul 2016 14:49:06 +0000 (UTC)

branch: master
commit b6407b912e8afd843367ca32d386905fc5b9a00e
Merge: bc1f4ba d367cab
Author: R. Bernstein <address@hidden>
Commit: GitHub <address@hidden>

    Merge pull request #130 from realgud/enable-disable
    
    Enable disable
---
 realgud/common/bp.el               |   11 +++++++++
 realgud/common/track.el            |   44 ++++++++++++++++++++++++++++++++++++
 realgud/debugger/bashdb/init.el    |   16 +++++++++++--
 realgud/debugger/trepan.pl/init.el |   18 +++++++++++++++
 realgud/debugger/trepan2/init.el   |   12 ++++++++++
 realgud/debugger/trepan3k/init.el  |   12 ++++++++++
 realgud/debugger/zshdb/init.el     |   14 +++++++++++-
 realgud/lang/posix-shell.el        |   22 ++++++++++++++++--
 realgud/lang/python.el             |   36 ++++++++++++++++++++++++++++-
 test/test-regexp-bashdb.el         |   15 ++++++++++++
 test/test-regexp-trepanpl.el       |   26 +++++++++++++++++++++
 test/test-regexp-zshdb.el          |   34 ++++++++++++++++++++++++----
 12 files changed, 250 insertions(+), 10 deletions(-)

diff --git a/realgud/common/bp.el b/realgud/common/bp.el
index f5e4c9d..159daeb 100644
--- a/realgud/common/bp.el
+++ b/realgud/common/bp.el
@@ -202,4 +202,15 @@ number."
              (bp-num (realgud-loc-num loc)))
         (realgud-bp-del-icon marker (current-buffer) bp-num))))
 
+(defun realgud-bp-enable-disable-info (bp-num enable? loc buf)
+  "Enable or disable bp with BP-NUM at location LOC in BUF."
+  (if (realgud-loc? loc)
+      (let* ((marker (realgud-loc-marker loc))
+             (bp-num-check (realgud-loc-num loc)))
+       (if (eq bp-num bp-num-check)
+           (realgud-bp-put-icon marker enable? bp-num buf)
+         (message "Internal error - bp number found %s doesn't match requested 
%s"
+                  bp-num-check bp-num)
+         ))))
+
 (provide-me "realgud-")
diff --git a/realgud/common/track.el b/realgud/common/track.el
index 303e948..af62291 100644
--- a/realgud/common/track.el
+++ b/realgud/common/track.el
@@ -198,6 +198,12 @@ evaluating (realgud-cmdbuf-info-loc-regexp 
realgud-cmdbuf-info)"
              ;; put into a list and iterate over that.
              (realgud-track-termination? text)
              (setq text-sans-loc (or (realgud-track-loc-remaining text) text))
+             (realgud-track-bp-enable-disable text-sans-loc
+                                              (realgud-cmdbuf-pat 
"brkpt-enable")
+                                              't)
+             (realgud-track-bp-enable-disable text-sans-loc
+                                              (realgud-cmdbuf-pat 
"brkpt-disable")
+                                              nil)
              (setq frame-num (realgud-track-selected-frame text))
              (setq bp-loc (realgud-track-bp-loc text-sans-loc cmd-mark cmdbuf))
              (if bp-loc
@@ -522,6 +528,44 @@ of the breakpoints found in command buffer."
                 ;; return the locations
                 found-locs))))))))
 
+(defun realgud-track-bp-enable-disable(text loc-pat enable? &optional cmdbuf)
+  "Do regular-expression matching see if a breakpoint has been enabled or 
disabled inside
+string TEXT. If we match, we will do the action to the breakpoint found and 
return the
+breakpoint location. Otherwise return nil.
+"
+  (setq cmdbuf (or cmdbuf (current-buffer)))
+  (with-current-buffer cmdbuf
+    (if (realgud-cmdbuf?)
+       (let* ((found-loc nil))
+         (if loc-pat
+             (let ((bp-num-group (realgud-loc-pat-num loc-pat))
+                   (loc-regexp   (realgud-loc-pat-regexp loc-pat)))
+               (if (and loc-regexp (string-match loc-regexp text))
+                   (let* ((bp-num (string-to-number (match-string bp-num-group 
text)))
+                          (info realgud-cmdbuf-info)
+                          (bp-list (realgud-cmdbuf-info-bp-list info))
+                          (loc)
+                          )
+                     (while (and (not found-loc) (setq loc (car-safe bp-list)))
+                       (setq bp-list (cdr bp-list))
+                       (when (eq (realgud-loc-num loc) bp-num)
+                         (setq found-loc loc)
+                         (let ((src-buffer (realgud-loc-goto loc)))
+                           (realgud-cmdbuf-add-srcbuf src-buffer cmdbuf)
+                           (with-current-buffer src-buffer
+                             (realgud-bp-enable-disable-info bp-num enable? 
loc src-buffer)
+                             )))
+                       )
+                     ;; return the location:
+                     found-loc)
+                 nil))
+           nil))
+      (and (message "Current buffer %s is not a debugger command buffer"
+                   (current-buffer)) nil)
+      )
+    )
+)
+
 (defun realgud-track-loc-remaining(text)
   "Return the portion of TEXT starting with the part after the
 loc-regexp pattern"
diff --git a/realgud/debugger/bashdb/init.el b/realgud/debugger/bashdb/init.el
index af36b42..49a58dd 100644
--- a/realgud/debugger/bashdb/init.el
+++ b/realgud/debugger/bashdb/init.el
@@ -58,10 +58,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:bashdb-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:bashdb-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:bashdb-pat-hash)
+      realgud:POSIX-debugger-brkpt-enable-pat)
+
 ;; Regular expression that describes a debugger "backtrace" command line.
 ;; For example:
 ;;   ->0 in file `../bashdb/test/example/subshell.sh' at line 6
@@ -86,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")
 
 ;; Unsupported features:
diff --git a/realgud/debugger/trepan.pl/init.el 
b/realgud/debugger/trepan.pl/init.el
index a563295..0cbb9ab 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..4e634d2 100644
--- a/realgud/debugger/trepan2/init.el
+++ b/realgud/debugger/trepan2/init.el
@@ -65,6 +65,18 @@ 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 4 disabled.
+(setf (gethash "brkpt-disable" realgud:trepan2-pat-hash)
+      realgud:python-trepan-brkpt-disable-pat)
+
+;; Regular expression that describes a debugger "enable" (breakpoint) response.
+;; For example:
+;;   Breakpoint 4 enabled.
+(setf (gethash "brkpt-enable" realgud:trepan2-pat-hash)
+      realgud:python-trepan-brkpt-disable-pat)
+
 ;; 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..9199257 100644
--- a/realgud/debugger/trepan3k/init.el
+++ b/realgud/debugger/trepan3k/init.el
@@ -63,6 +63,18 @@ 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 4 disabled.
+(setf (gethash "brkpt-disable" realgud:trepan3k-pat-hash)
+      realgud:python-trepan-brkpt-disable-pat)
+
+;; Regular expression that describes a debugger "enable" (breakpoint) response.
+;; For example:
+;;   Breakpoint 4 enabled.
+(setf (gethash "brkpt-enable" realgud:trepan3k-pat-hash)
+      realgud:python-trepan-brkpt-enable-pat)
+
 ;; 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 a5613c7..8c0a88e 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 6fff596..4f006d2 100644
--- a/realgud/lang/posix-shell.el
+++ b/realgud/lang/posix-shell.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2015 Free Software Foundation, Inc
+;; Copyright (C) 2015, 2016 Free Software Foundation, Inc
 
 ;; Author: Rocky Bernstein <address@hidden>
 
@@ -103,7 +103,25 @@ traceback) line."  )
 ;;   Removed 1 breakpoint(s).
 (defconst realgud:POSIX-debugger-brkpt-del-pat
   (make-realgud-loc-pat
-   :regexp (format "^Deleted breakpoint %s.?\n"
+   :regexp (format "^Deleted breakpoint %s\n"
+                  realgud:regexp-captured-num)
+   :num 1))
+
+;; Regular expression that describes a debugger "disable" (breakpoint) 
response.
+;; For example:
+;;   Breakpoint entry 4 disabled.
+(defconst realgud:POSIX-debugger-brkpt-disable-pat
+  (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.
+(defconst realgud:POSIX-debugger-brkpt-enable-pat
+  (make-realgud-loc-pat
+   :regexp (format "^Breakpoint entry %s enabled."
                   realgud:regexp-captured-num)
    :num 1))
 
diff --git a/realgud/lang/python.el b/realgud/lang/python.el
index 3737b9f..1ddea17 100644
--- a/realgud/lang/python.el
+++ b/realgud/lang/python.el
@@ -1,4 +1,20 @@
-;;; Copyright (C) 2011, 2014-2015 Rocky Bernstein <address@hidden>
+;; Copyright (C) 2011, 2014, 2015 Free Software Foundation, Inc
+
+;; Author: Rocky Bernstein <address@hidden>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 ;;; Common Python constants and regular expressions.
 (eval-when-compile (require 'cl))
 
@@ -94,6 +110,24 @@ traceback) line."  )
        :regexp "^Deleted breakpoint \\([0-9]+\\)\n"
        :num 1))
 
+;; Regular expression that describes a debugger "disable" (breakpoint) 
response.
+;; For example:
+;;   Breakpoint entry 4 disabled.
+(defconst realgud:python-trepan-brkpt-disable-pat
+  (make-realgud-loc-pat
+   :regexp (format "^Breakpoint %s disabled"
+                  realgud:regexp-captured-num)
+   :num 1))
+
+;; Regular expression that describes a debugger "enable" (breakpoint) response.
+;; For example:
+;;   Breakpoint entry 4 enabled.
+(defconst realgud:python-trepan-brkpt-enable-pat
+  (make-realgud-loc-pat
+   :regexp (format "^Breakpoint %s enabled"
+                  realgud:regexp-captured-num)
+   :num 1))
+
 (defconst realgud:python-debugger-font-lock-keywords
   '(
     ;; The frame number and first type name, if present.
diff --git a/test/test-regexp-bashdb.el b/test/test-regexp-bashdb.el
index 35da88d..5e34b0f 100644
--- a/test/test-regexp-bashdb.el
+++ b/test/test-regexp-bashdb.el
@@ -29,11 +29,19 @@
   (defvar test-text)
   (defvar brkpt-del)
   (defvar bp-del-pat)
+  (defvar bp-enable-pat)
+  (defvar bp-disable-pat)
 )
 
 (set (make-local-variable 'bp-del-pat)
       (gethash "brkpt-del" realgud:bashdb-pat-hash))
 
+(set (make-local-variable 'bp-enable-pat)
+      (gethash "brkpt-enable" realgud:bashdb-pat-hash))
+
+(set (make-local-variable 'bp-disable-pat)
+      (gethash "brkpt-disable" realgud:bashdb-pat-hash))
+
 (note "bashdb prompt matching")
 (set (make-local-variable 'prompt-pat)
      (gethash "prompt" realgud:bashdb-pat-hash))
@@ -107,5 +115,12 @@
 (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 654d2ef..1ffecad 100644
--- a/test/test-regexp-zshdb.el
+++ b/test/test-regexp-zshdb.el
@@ -5,6 +5,14 @@
 (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
@@ -28,6 +36,15 @@
 (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")
@@ -57,9 +74,9 @@
              (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 test-s1 pos))
+(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)))
@@ -71,8 +88,8 @@
              (substring test-s1
                         (match-beginning line-group)
                         (match-end line-group)))
-(setq pos (match-end 0))
-(assert-equal 128 (string-match frame-re test-s1 pos))
+(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)))
@@ -89,4 +106,13 @@
 (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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]