changeset 70587:5bf70421e7ea

(gdb-reset): Update speedbar if necessary. (gdb-var-evaluate-expression-handler, gdb-var-update-handler): Use a token for pending-triggers to ensure gdb-var-update gets called once per user input again for pre-GDB 6.4. (gdb-var-delete): Match on more complex expressions. (gdb-var-list-children-handler, gdb-var-create-handler): Use a token for consistency.
author Nick Roberts <nickrob@snap.net.nz>
date Thu, 11 May 2006 10:08:03 +0000
parents e7ce4cecd335
children 8a6fc6278754
files lisp/progmodes/gdb-ui.el
diffstat 1 files changed, 24 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gdb-ui.el	Thu May 11 10:07:08 2006 +0000
+++ b/lisp/progmodes/gdb-ui.el	Thu May 11 10:08:03 2006 +0000
@@ -732,9 +732,9 @@
 	(gdb-enqueue-input
 	 (list
 	  (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
-	      (concat "server interpreter mi \"-var-evaluate-expression "
+	      (concat "server interpreter mi \"0-var-evaluate-expression "
 		      (car var) "\"\n")
-	    (concat "-var-evaluate-expression " (car var) "\n"))
+	    (concat "0-var-evaluate-expression " (car var) "\n"))
 	  `(lambda () (gdb-var-evaluate-expression-handler
 		       ,(car var) nil)))))
     (if (search-forward "Undefined command" nil t)
@@ -755,11 +755,13 @@
 
 (defun gdb-var-evaluate-expression-handler (varnum changed)
   (goto-char (point-min))
-  (re-search-forward ".*value=\\(\".*\"\\)" nil t)
+  (re-search-forward "\\(.+\\)\\^done,value=\\(\".*\"\\)" nil t)
+  (setq gdb-pending-triggers
+	(delq (string-to-number (match-string 1)) gdb-pending-triggers))
   (let ((var (assoc varnum gdb-var-list)))
     (when var
       (if changed (setcar (nthcdr 5 var) 'changed))
-      (setcar (nthcdr 4 var) (read (match-string 1)))))
+      (setcar (nthcdr 4 var) (read (match-string 2)))))
   (gdb-speedbar-update))
 
 (defun gdb-var-list-children (varnum)
@@ -791,7 +793,7 @@
 		  (gdb-enqueue-input
 		   (list
 		    (concat
-		     "server interpreter mi \"-var-evaluate-expression "
+		     "server interpreter mi \"0-var-evaluate-expression "
 		     (car varchild) "\"\n")
 		    `(lambda () (gdb-var-evaluate-expression-handler
 				 ,(car varchild) nil)))))))
@@ -813,16 +815,19 @@
   (dolist (var gdb-var-list)
     (setcar (nthcdr 5 var) nil))
   (goto-char (point-min))
-  (while (re-search-forward gdb-var-update-regexp nil t)
-    (let ((varnum (match-string 1)))
-      (if  (string-equal (match-string 2) "false")
-	  (let ((var (assoc varnum gdb-var-list)))
-	    (if var (setcar (nthcdr 5 var) 'out-of-scope)))
-	(gdb-enqueue-input
-	 (list
-	  (concat "server interpreter mi \"-var-evaluate-expression "
-		  varnum "\"\n")
-	  `(lambda () (gdb-var-evaluate-expression-handler ,varnum t)))))))
+  (let ((n 0))
+    (while (re-search-forward gdb-var-update-regexp nil t)
+      (let ((varnum (match-string 1)))
+	(if  (string-equal (match-string 2) "false")
+	    (let ((var (assoc varnum gdb-var-list)))
+	      (if var (setcar (nthcdr 5 var) 'out-of-scope)))
+	  (setq n (1+ n))
+	  (push n gdb-pending-triggers)
+	  (gdb-enqueue-input
+	   (list
+	    (concat "server interpreter mi \"" (number-to-string n)
+		    "-var-evaluate-expression " varnum "\"\n")
+	  `(lambda () (gdb-var-evaluate-expression-handler ,varnum t))))))))
   (setq gdb-pending-triggers
 	(delq 'gdb-var-update gdb-pending-triggers)))
 
@@ -832,7 +837,9 @@
   (if (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
 	    '(gdbmi gdba))
       (let ((text (speedbar-line-text)))
-	(string-match "\\(\\S-+\\)" text)
+	;; Can't use \\S-+ for whitespace because
+	;; speedbar has a whacky syntax table.
+	(string-match "\\([^ \t]+\\)" text)
 	(let ((expr (match-string 1 text)) var varnum)
 	  (catch 'expr-found
 	    (dolist (var1 gdb-var-list)
@@ -2803,6 +2810,7 @@
   (setq overlay-arrow-variable-list
 	(delq 'gdb-overlay-arrow-position overlay-arrow-variable-list))
   (setq fringe-indicator-alist '((overlay-arrow . right-triangle)))
+  (if (boundp 'speedbar-frame) (speedbar-timer-fn))
   (setq gud-running nil)
   (setq gdb-active-process nil)
   (setq gdb-var-list nil)