summaryrefslogtreecommitdiff
path: root/lisp/progmodes/gdb-mi.el
diff options
context:
space:
mode:
authorNick Roberts <nickrob@snap.net.nz>2009-07-08 00:41:00 +0000
committerNick Roberts <nickrob@snap.net.nz>2009-07-08 00:41:00 +0000
commitca8eb1bd47553609d2e24347eb54dfe2d9f4c871 (patch)
treeb2fb9eb6f751e95105fd8572928744bdf45ab6ad /lisp/progmodes/gdb-mi.el
parentff0c419486c3ff79b153e26b3608926541e354b8 (diff)
downloademacs-ca8eb1bd47553609d2e24347eb54dfe2d9f4c871.tar.gz
(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.
Diffstat (limited to 'lisp/progmodes/gdb-mi.el')
-rw-r--r--lisp/progmodes/gdb-mi.el124
1 files changed, 63 insertions, 61 deletions
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index d9abe26ceea..73fc2de9aaf 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -501,8 +501,6 @@ detailed description of this mode.
; 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 @@ static char *magick[] = {
(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 @@ corresponding to the mode line clicked."
(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 @@ corresponding to the mode line clicked."
(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 @@ corresponding to the mode line clicked."
;;; 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 @@ member."
(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)))