[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e5a2331 153/215: Handle enable/disable bp status messages
From: |
Rocky Bernstein |
Subject: |
[elpa] master e5a2331 153/215: Handle enable/disable bp status messages - 1st cut |
Date: |
Sat, 30 Jul 2016 14:49:02 +0000 (UTC) |
branch: master
commit e5a2331dba0feae5027278e8cd3747482ad05020
Author: rocky <address@hidden>
Commit: rocky <address@hidden>
Handle enable/disable bp status messages - 1st cut
---
realgud/common/bp.el | 19 ++++++++++++----
realgud/common/track.el | 48 +++++++++++++++++++++++++++++++++++++--
realgud/debugger/bashdb/init.el | 14 +++++++++++-
realgud/lang/posix-shell.el | 20 +++++++++++++++-
test/test-regexp-bashdb.el | 17 ++++++++++++++
5 files changed, 110 insertions(+), 8 deletions(-)
diff --git a/realgud/common/bp.el b/realgud/common/bp.el
index 4de307a..84a1019 100644
--- a/realgud/common/bp.el
+++ b/realgud/common/bp.el
@@ -136,15 +136,15 @@ highlighted with FACE."
(spec `((margin left-margin) ,indicator)))
(overlay-put overlay 'before-string (propertize text 'display spec))))
-(defun realgud-bp-put-icon (pos enabled bp-num &optional buf)
+(defun realgud-bp-put-icon (pos enable? bp-num &optional buf)
"Add a breakpoint icon at POS according to breakpoint-display-style.
Use the fringe if available, and the margin otherwise. Record
-breakpoint status ENABLED and breakpoint number BP-NUM in
+breakpoint status ENABLE? and breakpoint number BP-NUM in
overlay. BUF is the buffer that POS refers to; it detaults to
the current buffer."
(let* ((margin-text) (face) (margin-icon) (fringe-icon))
(realgud-set-bp-icons)
- (if enabled
+ (if enable?
(setq margin-text "B"
face 'realgud-bp-enabled-face
margin-icon realgud-bp-enabled-icon
@@ -163,7 +163,7 @@ the current buffer."
(realgud-bp-add-margin-indicator ov margin-text margin-icon face))
(overlay-put ov 'realgud t)
(overlay-put ov 'realgud-bp-num bp-num)
- (overlay-put ov 'realgud-bp-enabled enabled)))))
+ (overlay-put ov 'realgud-bp-enabled enable?)))))
(defun realgud-bp-del-icon (pos &optional buf bpnum)
"Delete breakpoint icon at POS.
@@ -187,4 +187,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 2ba2fb1..aa433c6 100644
--- a/realgud/common/track.el
+++ b/realgud/common/track.el
@@ -188,6 +188,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
@@ -488,8 +494,8 @@ Otherwise return nil. CMD-MARK is set in the realgud-loc
object created.
)
(defun realgud-track-bp-delete(text &optional cmd-mark cmdbuf ignore-file-re)
- "Do regular-expression matching see if a breakpoint has been delete inside
-string TEXT. If we match, we will return the location of the breakpoint found
+ "Do regular-expression matching see if a breakpoint has been deleted inside
+string TEXT. If we match, we will return the breakpointlocation of the
breakpoint found
from in command buffer. Otherwise nil is returned."
; NOTE: realgud-cmdbuf-info is a buffer variable local to the process
@@ -532,6 +538,44 @@ from in command buffer. Otherwise nil is returned."
)
)
+(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 81cf9b5..1359d08 100644
--- a/realgud/debugger/bashdb/init.el
+++ b/realgud/debugger/bashdb/init.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>
@@ -62,6 +62,18 @@ realgud-loc-pat struct")
(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
diff --git a/realgud/lang/posix-shell.el b/realgud/lang/posix-shell.el
index 54216c2..c647f8f 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>
@@ -107,6 +107,24 @@ traceback) line." )
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))
+
(defconst realgud:POSIX-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 00830e9..d171e76 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,14 @@
(setq test-text "Removed 1 breakpoint(s).\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)
- [elpa] master bc1f4ba 194/215: Broaden trepan breakpoint search, (continued)
- [elpa] master bc1f4ba 194/215: Broaden trepan breakpoint search, Rocky Bernstein, 2016/07/30
- [elpa] master 277e10c 167/215: Merge pull request #113 from rocky/logo, Rocky Bernstein, 2016/07/30
- [elpa] master 7211cc5 192/215: Restart should be a confirm command too., Rocky Bernstein, 2016/07/30
- [elpa] master 32fb382 190/215: Merge pull request #126 from realgud/103-jump, Rocky Bernstein, 2016/07/30
- [elpa] master ba2b69c 202/215: Remove code added by mistake, Rocky Bernstein, 2016/07/30
- [elpa] master 4862a6f 206/215: Warn if gdb --interpreter=mi or -i mi is used, Rocky Bernstein, 2016/07/30
- [elpa] master 1e257cf 209/215: One more FSF copyright assignment, Rocky Bernstein, 2016/07/30
- [elpa] master ba3b013 103/215: Merge branch 'ipdb' of https://github.com/seanfarley/emacs-dbgr into ipdb, Rocky Bernstein, 2016/07/30
- [elpa] master b405494 191/215: Fill out pdb-remote execution, Rocky Bernstein, 2016/07/30
- [elpa] master 5cc0037 157/215: Improve visibility of breakpoints, Rocky Bernstein, 2016/07/30
- [elpa] master e5a2331 153/215: Handle enable/disable bp status messages - 1st cut,
Rocky Bernstein <=
- [elpa] master ec23a09 164/215: Slightly shorten setup instructions in README, Rocky Bernstein, 2016/07/30
- [elpa] master f7947aa 131/215: Rename realgud:prompt-if-{prefix-or-, }safe-mode, Rocky Bernstein, 2016/07/30
- [elpa] master eaae9f1 142/215: Update commentary; e.g. link to debuggers handled, Rocky Bernstein, 2016/07/30
- [elpa] master 7c6fab2 166/215: New RealGUD logo, Rocky Bernstein, 2016/07/30
- [elpa] master cc32bab 200/215: Correct realgud:gdb-pid-associate call, Rocky Bernstein, 2016/07/30
- [elpa] master 8e5eaaf 128/215: Merge pull request #94 from rocky/84-fix-autoloads, Rocky Bernstein, 2016/07/30
- [elpa] master 2c31d58 154/215: Typo, Rocky Bernstein, 2016/07/30
- [elpa] master 64bd779 155/215: Alway late on this kind of thing., Rocky Bernstein, 2016/07/30
- [elpa] master b6407b9 197/215: Merge pull request #130 from realgud/enable-disable, Rocky Bernstein, 2016/07/30
- [elpa] master 9ed122a 199/215: Correct enable/disable pattern for trepan.pl, Rocky Bernstein, 2016/07/30