aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2008-04-17 05:12:42 +0000
committerNick Roberts2008-04-17 05:12:42 +0000
commit551b23f38c98004dad0179a629dbd377fec90374 (patch)
tree164e14972dfa144fbb9694965d8a3f36675103a2
parentf1f6afd2fefd4c12c1e87690fd26778b6a2dfb24 (diff)
downloademacs-551b23f38c98004dad0179a629dbd377fec90374.tar.gz
emacs-551b23f38c98004dad0179a629dbd377fec90374.zip
(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".
-rw-r--r--lisp/progmodes/gdb-ui.el34
1 files changed, 33 insertions, 1 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 0dadebee8d5..c175e079342 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -146,6 +146,7 @@ Emacs can't find.")
146(defvar gdb-printing t) 146(defvar gdb-printing t)
147(defvar gdb-parent-bptno-enabled nil) 147(defvar gdb-parent-bptno-enabled nil)
148(defvar gdb-ready nil) 148(defvar gdb-ready nil)
149(defvar gdb-stack-update nil)
149(defvar gdb-early-user-input nil) 150(defvar gdb-early-user-input nil)
150 151
151(defvar gdb-buffer-type nil 152(defvar gdb-buffer-type nil
@@ -328,6 +329,7 @@ session."
328 (setq gdb-first-prompt t) 329 (setq gdb-first-prompt t)
329 (setq gud-running nil) 330 (setq gud-running nil)
330 (setq gdb-ready nil) 331 (setq gdb-ready nil)
332 (setq gdb-stack-update nil)
331 (setq gdb-flush-pending-output nil) 333 (setq gdb-flush-pending-output nil)
332 (setq gdb-early-user-input nil) 334 (setq gdb-early-user-input nil)
333 (setq gud-filter-pending-text nil) 335 (setq gud-filter-pending-text nil)
@@ -1404,6 +1406,10 @@ not GDB."
1404 ((eq sink 'user) 1406 ((eq sink 'user)
1405 (progn 1407 (progn
1406 (setq gud-running t) 1408 (setq gud-running t)
1409 (setq gdb-stack-update t)
1410 ;; Temporarily set gud-running to nil to force "info stack" onto queue.
1411 (let ((gud-running nil))
1412 (gdb-invalidate-frames))
1407 (setq gdb-inferior-status "running") 1413 (setq gdb-inferior-status "running")
1408 (setq gdb-signalled nil) 1414 (setq gdb-signalled nil)
1409 (gdb-force-mode-line-update 1415 (gdb-force-mode-line-update
@@ -1989,7 +1995,13 @@ static char *magick[] = {
1989 (match-beginning 1) (match-end 1) 1995 (match-beginning 1) (match-end 1)
1990 '(face font-lock-variable-name-face))))))) 1996 '(face font-lock-variable-name-face)))))))
1991 (end-of-line)))))) 1997 (end-of-line))))))
1992 (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) 1998 (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))
1999
2000 ;; Breakpoints buffer is always present. Hack to just update
2001 ;; current frame if there's been no execution.
2002 (if gdb-stack-update
2003 (setq gdb-stack-update nil)
2004 (if (gdb-get-buffer 'gdb-stack-buffer) (gdb-info-stack-custom))))
1993 2005
1994(declare-function gud-remove "gdb-ui" t t) ; gud-def 2006(declare-function gud-remove "gdb-ui" t t) ; gud-def
1995(declare-function gud-break "gdb-ui" t t) ; gud-def 2007(declare-function gud-break "gdb-ui" t t) ; gud-def
@@ -2190,6 +2202,13 @@ If not in a source or disassembly buffer just set point."
2190 gdb-info-stack-handler 2202 gdb-info-stack-handler
2191 gdb-info-stack-custom) 2203 gdb-info-stack-custom)
2192 2204
2205;; This may be more important for embedded targets where unwinding the
2206;; stack may take a long time.
2207(defadvice gdb-invalidate-frames (around gdb-invalidate-frames-advice
2208 (&optional ignored) activate compile)
2209 "Only queue \"info stack\" if execution has occurred."
2210 (if gdb-stack-update ad-do-it))
2211
2193(defun gdb-info-stack-custom () 2212(defun gdb-info-stack-custom ()
2194 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) 2213 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer)
2195 (let (move-to) 2214 (let (move-to)
@@ -2287,10 +2306,22 @@ If not in a source or disassembly buffer just set point."
2287 (suppress-keymap map) 2306 (suppress-keymap map)
2288 (define-key map "q" 'kill-this-buffer) 2307 (define-key map "q" 'kill-this-buffer)
2289 (define-key map "\r" 'gdb-frames-select) 2308 (define-key map "\r" 'gdb-frames-select)
2309 (define-key map "F" 'gdb-frames-force-update)
2290 (define-key map [mouse-2] 'gdb-frames-select) 2310 (define-key map [mouse-2] 'gdb-frames-select)
2291 (define-key map [follow-link] 'mouse-face) 2311 (define-key map [follow-link] 'mouse-face)
2292 map)) 2312 map))
2293 2313
2314(defun gdb-frames-force-update ()
2315 "Force update of call stack.
2316Use when the displayed call stack gets out of sync with the
2317actual one, e.g after using the Gdb command \"return\" or setting
2318$pc directly from the GUD buffer. This command isn't normally needed."
2319 (interactive)
2320 (setq gdb-stack-update t)
2321 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
2322 (gdb-invalidate-frames)
2323 (gdbmi-invalidate-frames)))
2324
2294(defun gdb-frames-mode () 2325(defun gdb-frames-mode ()
2295 "Major mode for gdb call stack. 2326 "Major mode for gdb call stack.
2296 2327
@@ -2304,6 +2335,7 @@ If not in a source or disassembly buffer just set point."
2304 (setq buffer-read-only t) 2335 (setq buffer-read-only t)
2305 (use-local-map gdb-frames-mode-map) 2336 (use-local-map gdb-frames-mode-map)
2306 (run-mode-hooks 'gdb-frames-mode-hook) 2337 (run-mode-hooks 'gdb-frames-mode-hook)
2338 (setq gdb-stack-update t)
2307 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) 2339 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
2308 'gdb-invalidate-frames 2340 'gdb-invalidate-frames
2309 'gdbmi-invalidate-frames)) 2341 'gdbmi-invalidate-frames))