branch: master commit 0387891f80141c449e4a09c6a7c659d8535bc99e Merge: 3bef00c d7bac58 Author: rocky <ro...@gnu.org> Commit: rocky <ro...@gnu.org>
Merge branch 'master' of github.com:realgud/realgud --- realgud/common/helper.el | 5 +++++ realgud/common/track.el | 32 ++++++++++++++++++++++++++++++++ test/test-regexp-remake.el | 27 +++++++++++++++++---------- 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/realgud/common/helper.el b/realgud/common/helper.el index 82bc878..705100d 100644 --- a/realgud/common/helper.el +++ b/realgud/common/helper.el @@ -13,6 +13,7 @@ ;; GNU General Public License for more details. (require 'cl-lib) +(require 'cl) ;;; Miscellaneous utility functions (require 'load-relative) @@ -102,3 +103,7 @@ gives: ;; (eval (intern var-str)))) (provide-me "realgud-") + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions) +;; End: diff --git a/realgud/common/track.el b/realgud/common/track.el index 971534b..f047c13 100644 --- a/realgud/common/track.el +++ b/realgud/common/track.el @@ -206,6 +206,10 @@ evaluating (realgud-cmdbuf-info-loc-regexp realgud-cmdbuf-info)" (realgud-cmdbuf-pat "brkpt-disable") nil) (setq frame-num (realgud-track-selected-frame text)) + (if (and frame-num (not loc)) + (setq loc (realgud-track-loc-from-selected-frame + text cmd-mark))) + (setq bp-loc (realgud-track-bp-loc text-sans-loc cmd-mark cmdbuf)) (if bp-loc (let ((src-buffer (realgud-loc-goto bp-loc))) @@ -600,6 +604,30 @@ loc-regexp pattern" ) +(defun realgud-track-loc-from-selected-frame(text cmd-mark &optional + opt-regexp opt-ignore-file-re) + "Return a selected frame number found in TEXT or nil if none found." + (if (realgud-cmdbuf?) + (let ((selected-frame-pat (realgud-cmdbuf-pat "selected-frame")) + (frame-num-regexp) + (ignore-file-re (or opt-ignore-file-re + (realgud-sget 'cmdbuf-info 'ignore-file-re)))) + (if (and selected-frame-pat + (setq frame-num-regexp (realgud-loc-pat-regexp + selected-frame-pat))) + (if (string-match frame-num-regexp text) + (let* ((file-group (realgud-loc-pat-file-group selected-frame-pat)) + (line-group (realgud-loc-pat-line-group selected-frame-pat)) + (filename (match-string file-group text)) + (lineno (string-to-number (match-string line-group text)))) + (if (and filename lineno) + (realgud:file-loc-from-line filename lineno + cmd-mark nil nil ignore-file-re) + nil)) + nil) + nil)) + nil)) + (defun realgud-track-termination?(text) "Return 't and call `realgud:terminate' we we have a termination message" (if (realgud-cmdbuf?) @@ -762,3 +790,7 @@ command buffer's debugger location pattern against the line at PT." )) (provide-me "realgud-") + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions) +;; End: diff --git a/test/test-regexp-remake.el b/test/test-regexp-remake.el index 1a3390c..1aa2748 100644 --- a/test/test-regexp-remake.el +++ b/test/test-regexp-remake.el @@ -7,6 +7,13 @@ (test-simple-start) +(eval-when-compile + (defvar prompt-pat) (defvar frame-pat) (defvar frame-re) + (defvar loc-pat) (defvar prompt-pat) (defvar test-text) + (defvar file-group) (defvar line-group) (defvar test-pos) + (defvar num-pat) (defvar num-group) (defvar realgud:remake-pat-hash) +) + (set (make-local-variable 'prompt-pat) (gethash "prompt" realgud:remake-pat-hash)) (set (make-local-variable 'frame-pat) @@ -17,7 +24,7 @@ (prompt-match "remake<<1>> " "1" "recursive remake %s") (note "remake debugger-backtrace") -(setq s1 +(setq test-text "=>#0 Makefile.in at /tmp/Makefile:216 #1 Makefile at /tmp/Makefile:230 ") @@ -31,31 +38,31 @@ (set (make-local-variable '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-text)) +(assert-equal "0" (substring test-text (match-beginning num-group) (match-end num-group))) (assert-equal "/tmp/Makefile" - (substring s1 + (substring test-text (match-beginning file-group) (match-end file-group))) (assert-equal "216" - (substring s1 + (substring test-text (match-beginning line-group) (match-end line-group))) -(set (make-local-variable 'pos) +(set (make-local-variable 'test-pos) (match-end 0)) -(assert-equal 39 (string-match frame-re s1 pos)) -(assert-equal "1" (substring s1 +(assert-equal 39 (string-match frame-re test-text test-pos)) +(assert-equal "1" (substring test-text (match-beginning num-group) (match-end num-group))) (assert-equal "/tmp/Makefile" - (substring s1 + (substring test-text (match-beginning file-group) (match-end file-group))) (assert-equal "230" - (substring s1 + (substring test-text (match-beginning line-group) (match-end line-group)))