Commit df1bfa9d authored by Nick Roberts's avatar Nick Roberts
Browse files

(gdb-var-update-regexp): Delete.

(gdb-var-update-handler): Use json parsing.
parent ac243a40
...@@ -1136,29 +1136,25 @@ numchild=\"\\(.+?\\)\".*?,value=\\(\"\"\\|\".*?[^\\]\"\\)\ ...@@ -1136,29 +1136,25 @@ numchild=\"\\(.+?\\)\".*?,value=\\(\"\"\\|\".*?[^\\]\"\\)\
(list "-var-update --all-values *" 'gdb-var-update-handler))) (list "-var-update --all-values *" 'gdb-var-update-handler)))
(gdb-add-pending 'gdb-var-update)) (gdb-add-pending 'gdb-var-update))
(defconst gdb-var-update-regexp
"{.*?name=\"\\(.*?\\)\".*?,\\(?:value=\\(\".*?\"\\),\\)?.*?\
in_scope=\"\\(.*?\\)\".*?}")
(defun gdb-var-update-handler () (defun gdb-var-update-handler ()
(let ((changelist (gdb-get-field (gdb-json-partial-output) 'changelist)))
(dolist (var gdb-var-list) (dolist (var gdb-var-list)
(setcar (nthcdr 5 var) nil)) (setcar (nthcdr 5 var) nil))
(goto-char (point-min)) (dolist (change changelist)
(while (re-search-forward gdb-var-update-regexp nil t) (let* ((varnum (gdb-get-field change 'name))
(let* ((varnum (match-string 1))
(var (assoc varnum gdb-var-list))) (var (assoc varnum gdb-var-list)))
(when var (when var
(let ((match (match-string 3))) (let ((scope (gdb-get-field change 'in_scope)))
(cond ((string-equal match "false") (cond ((string-equal scope "false")
(if gdb-delete-out-of-scope (if gdb-delete-out-of-scope
(gdb-var-delete-1 varnum) (gdb-var-delete-1 varnum)
(setcar (nthcdr 5 var) 'out-of-scope))) (setcar (nthcdr 5 var) 'out-of-scope)))
((string-equal match "true") ((string-equal scope "true")
(setcar (nthcdr 5 var) 'changed) (setcar (nthcdr 5 var) 'changed)
(setcar (nthcdr 4 var) (setcar (nthcdr 4 var)
(read (match-string 2)))) (gdb-get-field change 'value)))
((string-equal match "invalid") ((string-equal scope "invalid")
(gdb-var-delete-1 varnum))))))) (gdb-var-delete-1 varnum))))))))
(gdb-delete-pending 'gdb-var-update) (gdb-delete-pending 'gdb-var-update)
(gdb-speedbar-update)) (gdb-speedbar-update))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment