Mercurial > emacs
changeset 103759:b4080ae429fb
(gdb-init-1): Move sending
-data-list-register-names to ...
(gdb-starting): ... here because GDB 7.0 requires execution to
have started when using this MI command.
(gdb-set-header): New function to distinguish select and
unselected tabs in gdb buffers.
(gdb-propertize-header): New macro that uses gdb-set-header.
(gdb-breakpoints-header, gdb-locals-header): Use it.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Wed, 08 Jul 2009 00:41:00 +0000 |
parents | c14148a02ac8 |
children | 56d7bae253ef |
files | lisp/progmodes/gdb-mi.el |
diffstat | 1 files changed, 63 insertions(+), 61 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/gdb-mi.el Wed Jul 08 00:40:30 2009 +0000 +++ b/lisp/progmodes/gdb-mi.el Wed Jul 08 00:41:00 2009 +0000 @@ -501,8 +501,6 @@ ; Needs GDB 6.0 onwards. (list "-file-list-exec-source-file" 'gdb-get-source-file))) (gdb-input - (list "-data-list-register-names" 'gdb-get-register-names)) - (gdb-input (list "-gdb-show prompt" 'gdb-get-prompt))) (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.") @@ -1327,6 +1325,8 @@ (defun gdb-starting (output-field) ;; CLI commands don't emit ^running at the moment so use gdb-running too. + (gdb-input + (list "-data-list-register-names" 'gdb-get-register-names)) (setq gdb-inferior-status "running") (gdb-force-mode-line-update (propertize gdb-inferior-status 'face font-lock-type-face)) @@ -1764,6 +1764,53 @@ (define-key map (vector 'header-line 'down-mouse-1) 'ignore) map)) +(defmacro gdb-propertize-header (name buffer help-echo mouse-face face) + `(propertize ,name + 'help-echo ,help-echo + 'mouse-face ',mouse-face + 'face ',face + 'local-map + (gdb-make-header-line-mouse-map + 'mouse-1 + (lambda (event) (interactive "e") + (save-selected-window + (select-window (posn-window (event-start event))) + (set-window-dedicated-p (selected-window) nil) + (switch-to-buffer + (gdb-get-buffer-create ',buffer)) + (setq header-line-format(gdb-set-header ',buffer)) + (set-window-dedicated-p (selected-window) t)))))) + +(defun gdb-set-header (buffer) + (cond ((eq buffer 'gdb-locals-buffer) + (list + (gdb-propertize-header "Locals" gdb-locals-buffer + nil nil mode-line) + " " + (gdb-propertize-header "Registers" gdb-registers-buffer + "mouse-1: select" mode-line-highlight mode-line-inactive))) + ((eq buffer 'gdb-registers-buffer) + (list + (gdb-propertize-header "Locals" gdb-locals-buffer + "mouse-1: select" mode-line-highlight mode-line-inactive) + " " + (gdb-propertize-header "Registers" gdb-registers-buffer + nil nil mode-line))) + ((eq buffer 'gdb-breakpoints-buffer) + (list + (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer + nil nil mode-line) + " " + (gdb-propertize-header "Threads" gdb-threads-buffer + "mouse-1: select" mode-line-highlight mode-line-inactive))) + ((eq buffer 'gdb-threads-buffer) + (list + (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer + "mouse-1: select" mode-line-highlight mode-line-inactive) + " " + (gdb-propertize-header "Threads" gdb-threads-buffer + nil nil mode-line))))) + ;; uses "-thread-info". Needs GDB 7.0 onwards. ;;; Threads view @@ -2309,7 +2356,10 @@ (defvar gdb-disassembly-mode-map ;; TODO - (make-sparse-keymap)) + (let ((map (make-sparse-keymap))) + (suppress-keymap map) + (define-key map "q" 'kill-this-buffer) + map)) (defun gdb-disassembly-mode () "Major mode for GDB disassembly information. @@ -2375,37 +2425,12 @@ ;;; Breakpoints view (defvar gdb-breakpoints-header - `(,(propertize "Breakpoints" - 'help-echo "mouse-1: select" - 'mouse-face 'mode-line-highlight - 'face 'mode-line - 'local-map - (gdb-make-header-line-mouse-map - 'mouse-1 - (lambda (event) (interactive "e") - (save-selected-window - (select-window (posn-window (event-start event))) - (set-window-dedicated-p (selected-window) nil) - (switch-to-buffer - (gdb-get-buffer-create 'gdb-breakpoints-buffer)) - (set-window-dedicated-p (selected-window) t))))) + (list + (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer + nil nil mode-line) " " - ,(propertize "Threads" - 'help-echo "mouse-1: select" - 'mouse-face 'mode-line-highlight - 'face 'mode-line - 'local-map - (gdb-make-header-line-mouse-map - 'mouse-1 - ;; TODO: same code few lines above - (lambda (event) (interactive "e") - (save-selected-window - (select-window (posn-window (event-start event))) - (set-window-dedicated-p (selected-window) nil) - (switch-to-buffer - (gdb-get-buffer-create 'gdb-threads-buffer)) - (set-window-dedicated-p (selected-window) t))) -)))) + (gdb-propertize-header "Threads" gdb-threads-buffer + "mouse-1: select" mode-line-highlight mode-line-inactive))) (defun gdb-breakpoints-mode () "Major mode for gdb breakpoints. @@ -2671,35 +2696,12 @@ (set-window-point window p))))))) (defvar gdb-locals-header - `(,(propertize "Locals" - 'help-echo "mouse-1: select" - 'mouse-face 'mode-line-highlight - 'face 'mode-line - 'local-map - (gdb-make-header-line-mouse-map - 'mouse-1 - (lambda (event) (interactive "e") - (save-selected-window - (select-window (posn-window (event-start event))) - (set-window-dedicated-p (selected-window) nil) - (switch-to-buffer - (gdb-get-buffer-create 'gdb-locals-buffer)) - (set-window-dedicated-p (selected-window) t))))) + (list + (gdb-propertize-header "Locals" gdb-locals-buffer + nil nil mode-line) " " - ,(propertize "Registers" - 'help-echo "mouse-1: select" - 'mouse-face 'mode-line-highlight - 'face 'mode-line - 'local-map - (gdb-make-header-line-mouse-map - 'mouse-1 - (lambda (event) (interactive "e") - (save-selected-window - (select-window (posn-window (event-start event))) - (set-window-dedicated-p (selected-window) nil) - (switch-to-buffer - (gdb-get-buffer-create 'gdb-registers-buffer)) - (set-window-dedicated-p (selected-window) t))))))) + (gdb-propertize-header "Registers" gdb-registers-buffer + "mouse-1: select" mode-line-highlight mode-line-inactive))) (defvar gdb-locals-mode-map (let ((map (make-sparse-keymap)))