Mercurial > emacs
changeset 94128:c1450edc341a
(gdb-stack-update): New variable.
(gdb, gdb-starting, gdb-frames-mode): Use it.
(gdb-invalidate-frames): Advise to call "info stack" only if
execution has occurred.
(gdb-info-breakpoints-custom): Only update overlay-arrow pointing to
selected frame if no execution has occurred.
(gdb-frames-force-update): New interactive function.
(gdb-frames-mode-map): Bind it to "F".
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Thu, 17 Apr 2008 05:12:42 +0000 |
parents | fb606df96242 |
children | f8353eba8b8d |
files | lisp/progmodes/gdb-ui.el |
diffstat | 1 files changed, 33 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/gdb-ui.el Thu Apr 17 05:10:04 2008 +0000 +++ b/lisp/progmodes/gdb-ui.el Thu Apr 17 05:12:42 2008 +0000 @@ -146,6 +146,7 @@ (defvar gdb-printing t) (defvar gdb-parent-bptno-enabled nil) (defvar gdb-ready nil) +(defvar gdb-stack-update nil) (defvar gdb-early-user-input nil) (defvar gdb-buffer-type nil @@ -328,6 +329,7 @@ (setq gdb-first-prompt t) (setq gud-running nil) (setq gdb-ready nil) + (setq gdb-stack-update nil) (setq gdb-flush-pending-output nil) (setq gdb-early-user-input nil) (setq gud-filter-pending-text nil) @@ -1404,6 +1406,10 @@ ((eq sink 'user) (progn (setq gud-running t) + (setq gdb-stack-update t) + ;; Temporarily set gud-running to nil to force "info stack" onto queue. + (let ((gud-running nil)) + (gdb-invalidate-frames)) (setq gdb-inferior-status "running") (setq gdb-signalled nil) (gdb-force-mode-line-update @@ -1989,7 +1995,13 @@ (match-beginning 1) (match-end 1) '(face font-lock-variable-name-face))))))) (end-of-line)))))) - (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) + (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom)) + + ;; Breakpoints buffer is always present. Hack to just update + ;; current frame if there's been no execution. + (if gdb-stack-update + (setq gdb-stack-update nil) + (if (gdb-get-buffer 'gdb-stack-buffer) (gdb-info-stack-custom)))) (declare-function gud-remove "gdb-ui" t t) ; gud-def (declare-function gud-break "gdb-ui" t t) ; gud-def @@ -2190,6 +2202,13 @@ gdb-info-stack-handler gdb-info-stack-custom) +;; This may be more important for embedded targets where unwinding the +;; stack may take a long time. +(defadvice gdb-invalidate-frames (around gdb-invalidate-frames-advice + (&optional ignored) activate compile) + "Only queue \"info stack\" if execution has occurred." + (if gdb-stack-update ad-do-it)) + (defun gdb-info-stack-custom () (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) (let (move-to) @@ -2287,10 +2306,22 @@ (suppress-keymap map) (define-key map "q" 'kill-this-buffer) (define-key map "\r" 'gdb-frames-select) + (define-key map "F" 'gdb-frames-force-update) (define-key map [mouse-2] 'gdb-frames-select) (define-key map [follow-link] 'mouse-face) map)) +(defun gdb-frames-force-update () + "Force update of call stack. +Use when the displayed call stack gets out of sync with the +actual one, e.g after using the Gdb command \"return\" or setting +$pc directly from the GUD buffer. This command isn't normally needed." + (interactive) + (setq gdb-stack-update t) + (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) + (gdb-invalidate-frames) + (gdbmi-invalidate-frames))) + (defun gdb-frames-mode () "Major mode for gdb call stack. @@ -2304,6 +2335,7 @@ (setq buffer-read-only t) (use-local-map gdb-frames-mode-map) (run-mode-hooks 'gdb-frames-mode-hook) + (setq gdb-stack-update t) (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) 'gdb-invalidate-frames 'gdbmi-invalidate-frames))