changeset 104968:5e36746ef447

(gdb-var-list-children-regexp): Delete. (gdb-var-list-children): Use json parsing.
author Nick Roberts <nickrob@snap.net.nz>
date Sat, 12 Sep 2009 00:03:29 +0000
parents f318da2703ab
children 1f376790249c
files lisp/progmodes/gdb-mi.el
diffstat 1 files changed, 9 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gdb-mi.el	Sat Sep 12 00:02:42 2009 +0000
+++ b/lisp/progmodes/gdb-mi.el	Sat Sep 12 00:03:29 2009 +0000
@@ -1054,25 +1054,20 @@
 		varnum)
 	     `(lambda () (gdb-var-list-children-handler ,varnum)))))
 
-(defconst gdb-var-list-children-regexp
-  "child={.*?name=\"\\(.+?\\)\".*?,exp=\"\\(.+?\\)\".*?,\
-numchild=\"\\(.+?\\)\".*?,value=\\(\"\"\\|\".*?[^\\]\"\\)\
-\\(}\\|.*?,\\(type=\"\\(.+?\\)\"\\)?.*?}\\)")
-
 (defun gdb-var-list-children-handler (varnum)
-  (goto-char (point-min))
-  (let ((var-list nil))
-    (catch 'child-already-watched
+  (let ((var-list nil)
+	(children (gdb-get-field (gdb-json-partial-output "child") 'children)))
+   (catch 'child-already-watched
       (dolist (var gdb-var-list)
 	(if (string-equal varnum (car var))
 	    (progn
 	      (push var var-list)
-	      (while (re-search-forward gdb-var-list-children-regexp nil t)
-		(let ((varchild (list (match-string 1)
-				      (match-string 2)
-				      (match-string 3)
-				      (match-string 7)
-				      (read (match-string 4))
+	      (dolist (child children)
+		(let ((varchild (list (gdb-get-field child 'name)
+				      (gdb-get-field child 'exp)
+				      (gdb-get-field child 'numchild)
+				      (gdb-get-field child 'type)
+				      (gdb-get-field child 'value)
 				      nil)))
 		  (if (assoc (car varchild) gdb-var-list)
 		      (throw 'child-already-watched nil))