changeset 69106:3f5044e40e3e

(gdb-signalled): New variable and function. (gdb-debug-log-ring): Rename from gdb-debug-log and make a ring. (gdb-send, gdb-send-item, gud-gdba-marker-filter): Use it. (gdb-debug-log-length): Customize it's length. (gud-watch, gdb-var-create-handler): Display function::var format but don't use to create variable object. (gdb-var-create-handler): Use message-box in place of message. (gdb-stopped): Call gdb-exited if signalled.
author Nick Roberts <nickrob@snap.net.nz>
date Wed, 22 Feb 2006 22:01:35 +0000
parents f04b50463c62
children 781eefbfc6f8 856efda75a1b
files lisp/progmodes/gdb-ui.el
diffstat 1 files changed, 37 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gdb-ui.el	Wed Feb 22 22:00:47 2006 +0000
+++ b/lisp/progmodes/gdb-ui.el	Wed Feb 22 22:01:35 2006 +0000
@@ -123,6 +123,7 @@
 (defvar gdb-macro-info nil
   "Non-nil if GDB knows that the inferior includes preprocessor macro info.")
 (defvar gdb-buffer-fringe-width nil)
+(defvar gdb-signalled nil)
 
 (defvar gdb-buffer-type nil
   "One of the symbols bound in `gdb-buffer-rules'.")
@@ -258,11 +259,20 @@
   (gdb command-line)
   (gdb-init-1))
 
-(defvar gdb-debug-log nil)
+(defcustom gdb-debug-log-length 128
+  "Length of `gdb-debug-log-ring'."
+  :group 'gud
+  :type 'integer
+  :version "22.1")
+
+(defvar gdb-debug-log-ring (make-ring gdb-debug-log-length)
+  "Ring of commands sent to and replies received from GDB.
+This variable is used to debug GDB-UI.  Just need most recent
+messages and a ring limits the size.")
 
 ;;;###autoload
 (defcustom gdb-enable-debug-log nil
-  "Non-nil means record the process input and output in `gdb-debug-log'."
+  "Non-nil means record the process input and output in `gdb-debug-log-ring'."
   :type 'boolean
   :group 'gud
   :version "22.1")
@@ -390,7 +400,6 @@
     expr))
 
 (defun gdb-init-1 ()
-  (setq gdb-debug-log nil)
   (set (make-local-variable 'gud-minor-mode) 'gdba)
   (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter)
   ;;
@@ -469,14 +478,15 @@
 	gdb-source-file-list nil
 	gdb-error nil
 	gdb-macro-info nil
-	gdb-buffer-fringe-width (car (window-fringes)))
+	gdb-buffer-fringe-width (car (window-fringes))
+	gdb-debug-log-ring (make-ring gdb-debug-log-length)
+	gdb-signalled nil)
 
   (setq gdb-buffer-type 'gdba)
 
   (if gdb-use-separate-io-buffer (gdb-clear-inferior-io))
 
   ;; Hack to see test for GDB 6.4+ (-stack-info-frame was implemented in 6.4)
-  (setq gdb-version nil)
   (gdb-enqueue-input (list "server interpreter mi -stack-info-frame\n"
 			   'gdb-get-version)))
 
@@ -573,9 +583,6 @@
   (require 'tooltip)
   (save-selected-window
     (let ((expr (tooltip-identifier-from-point (point))))
-      (if (and (string-equal gdb-current-language "c")
-	       gdb-use-colon-colon-notation gdb-selected-frame)
-	  (setq expr (concat gdb-selected-frame "::" expr)))
       (catch 'already-watched
 	(dolist (var gdb-var-list)
 	  (if (string-equal expr (car var)) (throw 'already-watched nil)))
@@ -593,11 +600,15 @@
 (defun gdb-var-create-handler (expr)
   (goto-char (point-min))
   (if (re-search-forward gdb-var-create-regexp nil t)
-      (let ((var (list expr
-		       (match-string 1)
-		       (match-string 2)
-		       (match-string 3)
-		       nil nil)))
+      (let ((var (list
+		  (if (and (string-equal gdb-current-language "c")
+			   gdb-use-colon-colon-notation gdb-selected-frame)
+		      (setq expr (concat gdb-selected-frame "::" expr))
+		    expr)
+		  (match-string 1)
+		  (match-string 2)
+		  (match-string 3)
+		  nil nil)))
 	(push var gdb-var-list)
 	(speedbar 1)
 	(unless (string-equal
@@ -613,7 +624,7 @@
 		       ,(nth 1 var) nil)))))
     (if (search-forward "Undefined command" nil t)
 	(message-box "Watching expressions requires gdb 6.0 onwards")
-      (message "No symbol \"%s\" in current context." expr))))
+      (message-box "No symbol \"%s\" in current context." expr))))
 
 (defun gdb-var-evaluate-expression-handler (varnum changed)
   (goto-char (point-min))
@@ -864,7 +875,7 @@
 	  "*"))
 
 (defun gdb-display-separate-io-buffer ()
-  "Display IO of inferior in a separate window."
+  "Display IO of debugged program in a separate window."
   (interactive)
   (if gdb-use-separate-io-buffer
       (gdb-display-buffer
@@ -963,7 +974,7 @@
   (let ((item (concat string "\n")))
     (if gud-running
       (progn
-	(if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log))
+	(if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log-ring))
 	(process-send-string proc item))
       (gdb-enqueue-input item))))
 
@@ -986,7 +997,8 @@
 
 (defun gdb-send-item (item)
   (setq gdb-flush-pending-output nil)
-  (if gdb-enable-debug-log (push (cons 'send-item item) gdb-debug-log))
+  (if gdb-enable-debug-log
+      (ring-insert gdb-debug-log-ring (cons 'send-item item)))
   (setq gdb-current-item item)
   (let ((process (get-buffer-process gud-comint-buffer)))
     (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
@@ -1039,7 +1051,7 @@
     ("source" gdb-source)
     ("starting" gdb-starting)
     ("exited" gdb-exited)
-    ("signalled" gdb-exited)
+    ("signalled" gdb-signalled)
     ("signal" gdb-stopping)
     ("breakpoint" gdb-stopping)
     ("watchpoint" gdb-stopping)
@@ -1156,6 +1168,9 @@
   (setq gdb-overlay-arrow-position nil)
   (gdb-stopping ignored))
 
+(defun gdb-signalled (ignored)
+  (setq gdb-signalled t))
+
 (defun gdb-frame-begin (ignored)
   (let ((sink gdb-output-sink))
     (cond
@@ -1172,7 +1187,6 @@
 It is just like `gdb-stopping', except that if we already set the output
 sink to `user' in `gdb-stopping', that is fine."
   (setq gud-running nil)
-  (setq gdb-active-process t)
   (let ((sink gdb-output-sink))
     (cond
      ((eq sink 'inferior)
@@ -1180,7 +1194,8 @@
      ((eq sink 'user) t)
      (t
       (gdb-resync)
-      (error "Unexpected stopped annotation")))))
+      (error "Unexpected stopped annotation"))))
+  (if gdb-signalled (gdb-exited ignored)))
 
 (defun gdb-error (ignored)
   (setq gdb-error (not gdb-error)))
@@ -1233,7 +1248,8 @@
   "A gud marker filter for gdb.  Handle a burst of output from GDB."
   (if gdb-flush-pending-output
       nil
-    (if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log))
+    (if gdb-enable-debug-log
+	(ring-insert gdb-debug-log-ring (cons 'recv string)))
     ;; Recall the left over gud-marker-acc from last time.
     (setq gud-marker-acc (concat gud-marker-acc string))
     ;; Start accumulating output for the GUD buffer.