]> code.delx.au - gnu-emacs-elpa/commitdiff
Look for termination message in track mode and use that to terminate debugging.
authorrocky <rocky@gnu.org>
Sun, 17 Apr 2011 21:11:59 +0000 (17:11 -0400)
committerrocky <rocky@gnu.org>
Sun, 17 Apr 2011 21:11:59 +0000 (17:11 -0400)
dbgr/common/track.el
dbgr/debugger/bashdb/init.el
dbgr/debugger/kshdb/init.el
dbgr/debugger/remake/init.el
dbgr/debugger/trepan/init.el
dbgr/debugger/trepanx/init.el
dbgr/debugger/zshdb/init.el
test/test-track.el

index 788fd66c6d71fd7da1a91573fbdc652c3c16cfd5..9d3f49a96cdf04863c44cac8da2973814760cd74 100644 (file)
@@ -96,6 +96,7 @@ evaluating (dbgr-cmdbuf-info-loc-regexp dbgr-cmdbuf-info)"
                  (dbgr-track-divert-prompt text cmdbuf to))
              ;; FIXME: instead of these fixed filters, 
              ;; put into a list and iterate over that.
+             (dbgr-track-termination? text)
              (setq text-sans-loc (or (dbgr-track-loc-remaining text) text))
              (setq frame-num (dbgr-track-selected-frame text) text)
              (setq bp-loc (dbgr-track-bp-loc text-sans-loc cmd-mark cmdbuf))
@@ -369,6 +370,21 @@ loc-regexp pattern"
          nil))
     nil)
   )
+
+
+(defun dbgr-track-termination?(text)
+  "Return 't and call dbgr-terminate-cmdbuf we we have a termination message"
+  (if (dbgr-cmdbuf?)
+      (let ((termination-re (dbgr-cmdbuf-pat "termination"))
+           )
+       (if (and termination-re (string-match termination-re text))
+           (progn 
+             (dbgr-terminate (current-buffer))
+             't)
+         nil)
+       )
+    )
+  )
   
 (defun dbgr-track-divert-prompt(text cmdbuf to)
   "Return a cons node of the part before the prompt-regexp and the part 
index 5d3ed827783c337cb2a5e359961e677c8a87a573..f0459c22bef9f94aa7680651429daa825a316b10 100644 (file)
@@ -73,6 +73,10 @@ dbgr-loc-pat struct")
        :line-group 5)
       )
 
+;; Regular expression that for a termination message.
+(setf (gethash "termination" dbgr-bashdb-pat-hash)
+       "^bashdb: That's all, folks...\n")
+
 (setf (gethash "font-lock-keywords" dbgr-bashdb-pat-hash)
       '(
        ;; The frame number and first type name, if present.
index 807f2de9e5e5d64a5c4fea3ef93e91b0c56af6f6..eca7388908790712e56082cddf3d7e78f4208fe3 100644 (file)
@@ -72,6 +72,10 @@ dbgr-loc-pat struct")
        :line-group 5)
       )
 
+;; Regular expression that for a termination message.
+(setf (gethash "termination" dbgr-kshdb-pat-hash)
+       "^kshdb: That's all, folks...\n")
+
 (setf (gethash "font-lock-keywords" dbgr-kshdb-pat-hash)
       '(
        ;; The frame number and first type name, if present.
index c9fb908b525a4c683c68c398225b6eb9c989874d..f6edd9dfd1b5ecd2ef027f644f79aac9f4376702 100644 (file)
@@ -52,9 +52,6 @@ dbgr-loc-pat struct")
        :regexp "^Breakpoint \\([0-9]+\\) on target .* cleared\n"
        :num 1))
 
-(defconst dbgr-remake-frame-start-regexp
-  "\\(?:^\\|\n\\)")
-
 (defconst dbgr-remake-selected-frame-arrow "=>"
 "String that describes which frame is selected in a debugger
 backtrace listing.")
@@ -71,7 +68,7 @@ backtrace listing.")
 ;; #1  Makefile at /tmp/Makefile:230
 (setf (gethash "lang-backtrace" dbgr-remake-pat-hash)
       (make-dbgr-loc-pat
-       :regexp         (concat dbgr-remake-frame-start-regexp 
+       :regexp         (concat "^"
                        dbgr-remake-frame-num-regexp
                        "\\(.*\\)"
                        dbgr-remake-frame-file-regexp
@@ -87,7 +84,7 @@ backtrace listing.")
 ;;   #1  Makefile at /tmp/Makefile:230
 (setf (gethash "debugger-backtrace" dbgr-remake-pat-hash)
       (make-dbgr-loc-pat
-       :regexp         (concat dbgr-remake-frame-start-regexp
+       :regexp         (concat "^"
                        dbgr-remake-frame-arrow
                        dbgr-remake-frame-num-regexp
                        "\\(.*\\)"
@@ -103,6 +100,10 @@ backtrace listing.")
 (setf (gethash "selected-frame-indicator" dbgr-remake-pat-hash)
       dbgr-remake-selected-frame-arrow)
 
+;; Regular expression that for a termination message.
+(setf (gethash "termination" dbgr-remake-pat-hash)
+       "^remake: That's all, folks...\n")
+
 (setf (gethash "font-lock-keywords" dbgr-remake-pat-hash)
       '(
        ;; ;; File name and line number
index 569d520b5668aa90502f844ac89b6b6e2c414cb6..bd339b848dad0feb88053d903f9736ea456fb718 100644 (file)
@@ -78,6 +78,8 @@ backtrace listing.")
 (defconst dbgr-trepan-frame-file-regexp
   "[ \t\n]+in file \\([^ \n]+\\)")
 
+(defconst dbgr-trepan-debugger-name "trepan" "Name of debugger")
+
 ;; Top frame number
 (setf (gethash "top-frame-num" dbgr-trepan-pat-hash) 0)
 
@@ -119,10 +121,9 @@ backtrace listing.")
        :line-group 7)
       )
 
-;; Regular expression that describes which frame is selected in 
-;; a debugger backtrace listing.
-(setf (gethash "selected-frame-indicator" dbgr-trepan-pat-hash)
-      dbgr-trepan-selected-frame-indicator)
+;; Regular expression that for a termination message.
+(setf (gethash "termination" dbgr-trepan-pat-hash)
+       "^trepan: That's all, folks...\n")
 
 (setf (gethash "font-lock-keywords" dbgr-trepan-pat-hash)
       '(
@@ -189,7 +190,7 @@ backtrace listing.")
 ;;     ;;  (0 trepan-frames-current-frame-face append))
 ;;     ))
 
-(setf (gethash "trepan" dbgr-pat-hash) dbgr-trepan-pat-hash)
+(setf (gethash dbgr-trepan-debugger-name dbgr-pat-hash) dbgr-trepan-pat-hash)
 
 (defvar dbgr-trepan-command-hash (make-hash-table :test 'equal)
   "Hash key is command name like 'quit' and the value is 
@@ -197,6 +198,7 @@ backtrace listing.")
 
 (setf (gethash "quit" dbgr-trepan-command-hash) "quit!")
 (setf (gethash "shell" dbgr-trepan-command-hash) "irb")
-(setf (gethash "trepan" dbgr-command-hash) dbgr-trepan-command-hash)
+(setf (gethash dbgr-trepan-debugger-name
+              dbgr-command-hash) dbgr-trepan-command-hash)
 
 (provide-me "dbgr-trepan-")
index ef0ac8f77c0c5911d55f493a5e0711484433df32..352217162c2d29c439bcf9f7bb3936d475b3927b 100644 (file)
@@ -87,6 +87,10 @@ dbgr-loc-pat struct")
        :line-group 7)
       )
 
+;; Regular expression that for a termination message.
+(setf (gethash "termination" dbgr-trepanx-pat-hash)
+       "^trepanx: That's all, folks...\n")
+
 (setf (gethash "font-lock-keywords" dbgr-trepanx-pat-hash)
       '(
        ;; File name and line number. E.g. at /test/gcd.rb:6
index 0f708d53e693ecf808cae4425f8cfadd1e25fe1d..2c1f7674acdbe38bf23a43d67565150a66f73fa7 100644 (file)
@@ -72,6 +72,10 @@ dbgr-loc-pat struct")
        :line-group 5)
       )
 
+;; Regular expression that for a termination message.
+(setf (gethash "termination" dbgr-zshdb-pat-hash)
+       "^zshdb: That's all, folks...\n")
+
 (setf (gethash "font-lock-keywords" dbgr-zshdb-pat-hash)
       '(
        ;; The frame number and first type name, if present.
index 943234fd3cc3290ecf759240b55a117bc4716f03..49f15386c4b0d8f8b82935a1b6997546b3be31b4 100644 (file)
@@ -1,5 +1,6 @@
 (require 'test-unit)
 (load-file "../dbgr/common/track.el")
+(load-file "../dbgr/common/core.el")
 (load-file "../dbgr/debugger/trepan/init.el")
 
 (test-unit-clear-contexts)
@@ -55,6 +56,17 @@ end
                  )
 
 
+        (specify "dbgr-track-termination?"
+                 (setq debugger-output "-- (/usr/local/bin/irb:9 @2)
+require 'irb'
+")
+                 (assert-nil (dbgr-track-termination? debugger-output))
+                 (setq debugger-output "Really quit? (N/y) y
+trepan: That's all, folks...
+")
+                 (assert-t (dbgr-track-termination? debugger-output))
+                 )
+
         ;; (setq debugger-bp-output (format "Breakpoint %d set at line %d\n\tin file %s.\n"
         ;;                               bp-num line-number filename))
         ;; (setq bp-loc (dbgr-track-bp-loc debugger-bp-output nil))