Commit 51158d69 authored by Nick Roberts's avatar Nick Roberts
Browse files

(gdb-var-create-handler): Move speedbar

call to...
(gud-watch): ...here so speedbar is raised for already watched
expressions.
(gdb-speedbar-refresh): Delete function.
(gdb-speedbar-update, gdb-speedbar-timer-fn): New functions.
Use speedbar-timer-fn instead of speedbar-refresh (reverting
earlier change).
(gdb-var-evaluate-expression-handler)
(gdb-var-list-children-handler-1, gdb-var-update-handler-1):
Use it.
parent 86c4b9a1
......@@ -694,6 +694,7 @@ With arg, enter name of variable to be watched in the minibuffer."
(if (and transient-mark-mode mark-active)
(buffer-substring (region-beginning) (region-end))
(tooltip-identifier-from-point (point))))))
(speedbar 1)
(catch 'already-watched
(dolist (var gdb-var-list)
(unless (string-match "\\." (car var))
......@@ -725,7 +726,6 @@ With arg, enter name of variable to be watched in the minibuffer."
(match-string 3)
nil nil gdb-frame-address)))
(push var gdb-var-list)
(speedbar 1)
(unless (string-equal
speedbar-initial-expansion-list-name "GUD")
(speedbar-change-initial-expansion-list "GUD"))
......@@ -741,13 +741,26 @@ With arg, enter name of variable to be watched in the minibuffer."
(message-box "Watching expressions requires gdb 6.0 onwards")
(message-box "No symbol \"%s\" in current context." expr))))
(defun gdb-speedbar-update ()
(when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
;; Dummy command to update speedbar even when idle.
(gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-timer-fn))
;; Keep gdb-pending-triggers non-nil till end.
(push 'gdb-speedbar-timer gdb-pending-triggers)))
(defun gdb-speedbar-timer-fn ()
(setq gdb-pending-triggers
(delq 'gdb-speedbar-timer gdb-pending-triggers))
(speedbar-timer-fn))
(defun gdb-var-evaluate-expression-handler (varnum changed)
(goto-char (point-min))
(re-search-forward ".*value=\\(\".*\"\\)" nil t)
(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 1)))))
(gdb-speedbar-update))
(defun gdb-var-list-children (varnum)
(gdb-enqueue-input
......@@ -811,21 +824,7 @@ type_changed=\".*?\".*?}")
varnum "\"\n")
`(lambda () (gdb-var-evaluate-expression-handler ,varnum t)))))))
(setq gdb-pending-triggers
(delq 'gdb-var-update gdb-pending-triggers))
(when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
;; Dummy command to update speedbar at right time.
(gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-refresh))
;; Keep gdb-pending-triggers non-nil till end.
(push 'gdb-speedbar-refresh gdb-pending-triggers)))
(defun gdb-speedbar-refresh ()
(setq gdb-pending-triggers
(delq 'gdb-speedbar-refresh gdb-pending-triggers))
(with-current-buffer gud-comint-buffer
(let ((speedbar-verbosity-level 0)
(speedbar-shown-directories nil))
(save-excursion
(speedbar-refresh)))))
(delq 'gdb-var-update gdb-pending-triggers)))
(defun gdb-var-delete ()
"Delete watch expression at point from the speedbar."
......@@ -2804,8 +2803,6 @@ Kills the gdb buffers, and resets variables and the source buffers."
(setq overlay-arrow-variable-list
(delq 'gdb-overlay-arrow-position overlay-arrow-variable-list))
(setq fringe-indicator-alist '((overlay-arrow . right-triangle)))
(if (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
(speedbar-refresh))
(setq gud-running nil)
(setq gdb-active-process nil)
(setq gdb-var-list nil)
......@@ -3233,7 +3230,8 @@ numchild=\"\\(.+?\\)\",.*?value=\\(\".*?\"\\),.*?type=\"\\(.+?\\)\".*?}")
(throw 'child-already-watched nil))
(push varchild var-list))))
(push var var-list)))
(setq gdb-var-list (nreverse var-list)))))
(setq gdb-var-list (nreverse var-list))))
(gdb-speedbar-update))
; Uses "-var-update --all-values". Needs GDB 6.4 onwards.
(defun gdb-var-update-1 ()
......@@ -3266,11 +3264,7 @@ in_scope=\"\\(.*?\\)\".*?}")
(read (match-string 2)))))))
(setq gdb-pending-triggers
(delq 'gdb-var-update gdb-pending-triggers))
(when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
;; dummy command to update speedbar at right time
(gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-refresh))
;; keep gdb-pending-triggers non-nil till end
(push 'gdb-speedbar-refresh gdb-pending-triggers)))
(gdb-speedbar-update))
;; Registers buffer.
;;
......
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