changeset 104951:34d2d71d540f

(gdb-var-update-regexp): Delete. (gdb-var-update-handler): Use json parsing.
author Nick Roberts <nickrob@snap.net.nz>
date Fri, 11 Sep 2009 11:55:11 +0000
parents 7a82898e4c32
children d04ef26eaf27
files lisp/progmodes/gdb-mi.el
diffstat 1 files changed, 9 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gdb-mi.el	Fri Sep 11 11:54:30 2009 +0000
+++ b/lisp/progmodes/gdb-mi.el	Fri Sep 11 11:55:11 2009 +0000
@@ -1136,29 +1136,25 @@
        (list "-var-update --all-values *" 'gdb-var-update-handler)))
   (gdb-add-pending 'gdb-var-update))
 
-(defconst gdb-var-update-regexp
-  "{.*?name=\"\\(.*?\\)\".*?,\\(?:value=\\(\".*?\"\\),\\)?.*?\
-in_scope=\"\\(.*?\\)\".*?}")
-
 (defun gdb-var-update-handler ()
+ (let ((changelist (gdb-get-field (gdb-json-partial-output) 'changelist)))
   (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))
+  (dolist (change changelist)
+    (let* ((varnum (gdb-get-field change 'name))
 	   (var (assoc varnum gdb-var-list)))
       (when var
-	(let ((match (match-string 3)))
-	  (cond ((string-equal match "false")
+	(let ((scope (gdb-get-field change 'in_scope)))
+	  (cond ((string-equal scope "false")
 		 (if gdb-delete-out-of-scope
 		     (gdb-var-delete-1 varnum)
 		   (setcar (nthcdr 5 var) 'out-of-scope)))
-		((string-equal match "true")
+		((string-equal scope "true")
 		 (setcar (nthcdr 5 var) 'changed)
 		 (setcar (nthcdr 4 var)
-			 (read (match-string 2))))
-		((string-equal match "invalid")
-		 (gdb-var-delete-1 varnum)))))))
+			 (gdb-get-field change 'value)))
+		((string-equal scope "invalid")
+		 (gdb-var-delete-1 varnum))))))))
   (gdb-delete-pending 'gdb-var-update)
   (gdb-speedbar-update))