comparison lisp/progmodes/gdb-ui.el @ 94192:1ec796ca1199

(gdb-mouse-set-clear-breakpoint): Select window clicked on first (regression in 22.2). (gdb): Display thread number in mode-line. (gdb-make-header-line-mouse-map): Move to avoid byte compiler warnings. (gdb-breakpoints-header): New variable. (gdb-breakpoints-mode, gdb-threads-mode): Use it for header line.
author Nick Roberts <nickrob@snap.net.nz>
date Sat, 19 Apr 2008 22:49:32 +0000
parents 580129e092d0
children c5e5de94d51f
comparison
equal deleted inserted replaced
94191:04bc9669d8d5 94192:1ec796ca1199
251 `gdb-restore-windows' - To restore the window layout. 251 `gdb-restore-windows' - To restore the window layout.
252 252
253 See Info node `(emacs)GDB Graphical Interface' for a more 253 See Info node `(emacs)GDB Graphical Interface' for a more
254 detailed description of this mode. 254 detailed description of this mode.
255 255
256
257 +----------------------------------------------------------------------+ 256 +----------------------------------------------------------------------+
258 | GDB Toolbar | 257 | GDB Toolbar |
259 +-----------------------------------+----------------------------------+ 258 +-----------------------------------+----------------------------------+
260 | GUD buffer (I/O of GDB) | Locals buffer | 259 | GUD buffer (I/O of GDB) | Locals buffer |
260 |-----------------------------------+----------------------------------+
261 | | | 261 | | |
262 | Source buffer | I/O buffer for debugged program |
262 | | | 263 | | |
263 | | | 264 |-----------------------------------+----------------------------------+
264 +-----------------------------------+----------------------------------+ 265 | Stack buffer | Breakpoints/threads buffer |
265 | Source buffer | I/O buffer (of debugged program) |
266 | | (comint-mode) |
267 | | |
268 | | |
269 | | |
270 | | |
271 | | |
272 | | |
273 +-----------------------------------+----------------------------------+
274 | Stack buffer | Breakpoints buffer |
275 | RET gdb-frames-select | SPC gdb-toggle-breakpoint |
276 | | RET gdb-goto-breakpoint |
277 | | D gdb-delete-breakpoint |
278 +-----------------------------------+----------------------------------+ 266 +-----------------------------------+----------------------------------+
279 267
280 To run GDB in text command mode, replace the GDB \"--annotate=3\" 268 To run GDB in text command mode, replace the GDB \"--annotate=3\"
281 option with \"--fullname\" either in the minibuffer for the 269 option with \"--fullname\" either in the minibuffer for the
282 current Emacs session, or the custom variable 270 current Emacs session, or the custom variable
332 (setq gdb-ready nil) 320 (setq gdb-ready nil)
333 (setq gdb-stack-update nil) 321 (setq gdb-stack-update nil)
334 (setq gdb-flush-pending-output nil) 322 (setq gdb-flush-pending-output nil)
335 (setq gdb-early-user-input nil) 323 (setq gdb-early-user-input nil)
336 (setq gud-filter-pending-text nil) 324 (setq gud-filter-pending-text nil)
325 (gdb-thread-identification)
337 (run-hooks 'gdb-mode-hook)) 326 (run-hooks 'gdb-mode-hook))
338 327
339 ;; Keep as an alias for compatibility with Emacs 22.1. 328 ;; Keep as an alias for compatibility with Emacs 22.1.
340 ;;;###autoload 329 ;;;###autoload
341 (defalias 'gdba 'gdb) 330 (defalias 'gdba 'gdb)
2013 "Set/clear breakpoint in left fringe/margin at mouse click. 2002 "Set/clear breakpoint in left fringe/margin at mouse click.
2014 If not in a source or disassembly buffer just set point." 2003 If not in a source or disassembly buffer just set point."
2015 (interactive "e") 2004 (interactive "e")
2016 (mouse-minibuffer-check event) 2005 (mouse-minibuffer-check event)
2017 (let ((posn (event-end event))) 2006 (let ((posn (event-end event)))
2018 (if (or (buffer-file-name) (eq major-mode 'gdb-assembler-mode)) 2007 (with-selected-window (posn-window posn)
2019 (if (numberp (posn-point posn)) 2008 (if (or (buffer-file-name) (eq major-mode 'gdb-assembler-mode))
2020 (with-selected-window (posn-window posn) 2009 (if (numberp (posn-point posn))
2021 (save-excursion 2010 (save-excursion
2022 (goto-char (posn-point posn)) 2011 (goto-char (posn-point posn))
2023 (if (or (posn-object posn) 2012 (if (or (posn-object posn)
2024 (eq (car (fringe-bitmaps-at-pos (posn-point posn))) 2013 (eq (car (fringe-bitmaps-at-pos (posn-point posn)))
2025 'breakpoint)) 2014 'breakpoint))
2116 "Delete frame if there is only one window. Otherwise delete the window." 2105 "Delete frame if there is only one window. Otherwise delete the window."
2117 (interactive) 2106 (interactive)
2118 (if (one-window-p) (delete-frame) 2107 (if (one-window-p) (delete-frame)
2119 (delete-window))) 2108 (delete-window)))
2120 2109
2110 ;;from make-mode-line-mouse-map
2111 (defun gdb-make-header-line-mouse-map (mouse function) "\
2112 Return a keymap with single entry for mouse key MOUSE on the header line.
2113 MOUSE is defined to run function FUNCTION with no args in the buffer
2114 corresponding to the mode line clicked."
2115 (let ((map (make-sparse-keymap)))
2116 (define-key map (vector 'header-line mouse) function)
2117 (define-key map (vector 'header-line 'down-mouse-1) 'ignore)
2118 map))
2119
2120 (defvar gdb-breakpoints-header
2121 `(,(propertize "Breakpoints"
2122 'help-echo "mouse-1: select"
2123 'mouse-face 'mode-line-highlight
2124 'face 'mode-line
2125 'local-map
2126 (gdb-make-header-line-mouse-map
2127 'mouse-1
2128 (lambda (event) (interactive "e")
2129 (save-selected-window
2130 (select-window (posn-window (event-start event)))
2131 (set-window-dedicated-p (selected-window) nil)
2132 (switch-to-buffer
2133 (gdb-get-buffer-create 'gdb-breakpoints-buffer))
2134 (set-window-dedicated-p (selected-window) t)))))
2135 " "
2136 ,(propertize "Threads"
2137 'help-echo "mouse-1: select"
2138 'mouse-face 'mode-line-highlight
2139 'face 'mode-line
2140 'local-map
2141 (gdb-make-header-line-mouse-map
2142 'mouse-1
2143 (lambda (event) (interactive "e")
2144 (save-selected-window
2145 (select-window (posn-window (event-start event)))
2146 (set-window-dedicated-p (selected-window) nil)
2147 (switch-to-buffer
2148 (gdb-get-buffer-create 'gdb-threads-buffer))
2149 (set-window-dedicated-p (selected-window) t)))))))
2150
2121 (defun gdb-breakpoints-mode () 2151 (defun gdb-breakpoints-mode ()
2122 "Major mode for gdb breakpoints. 2152 "Major mode for gdb breakpoints.
2123 2153
2124 \\{gdb-breakpoints-mode-map}" 2154 \\{gdb-breakpoints-mode-map}"
2125 (kill-all-local-variables) 2155 (kill-all-local-variables)
2126 (setq major-mode 'gdb-breakpoints-mode) 2156 (setq major-mode 'gdb-breakpoints-mode)
2127 (setq mode-name "Breakpoints") 2157 (setq mode-name "Breakpoints")
2128 (use-local-map gdb-breakpoints-mode-map) 2158 (use-local-map gdb-breakpoints-mode-map)
2129 (setq buffer-read-only t) 2159 (setq buffer-read-only t)
2160 (setq header-line-format gdb-breakpoints-header)
2130 (run-mode-hooks 'gdb-breakpoints-mode-hook) 2161 (run-mode-hooks 'gdb-breakpoints-mode-hook)
2131 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) 2162 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
2132 'gdb-invalidate-breakpoints 2163 'gdb-invalidate-breakpoints
2133 'gdbmi-invalidate-breakpoints)) 2164 'gdbmi-invalidate-breakpoints))
2134 2165
2434 \\{gdb-threads-mode-map}" 2465 \\{gdb-threads-mode-map}"
2435 (kill-all-local-variables) 2466 (kill-all-local-variables)
2436 (setq major-mode 'gdb-threads-mode) 2467 (setq major-mode 'gdb-threads-mode)
2437 (setq mode-name "Threads") 2468 (setq mode-name "Threads")
2438 (setq buffer-read-only t) 2469 (setq buffer-read-only t)
2470 (setq header-line-format gdb-breakpoints-header)
2439 (use-local-map gdb-threads-mode-map) 2471 (use-local-map gdb-threads-mode-map)
2440 (set (make-local-variable 'font-lock-defaults) 2472 (set (make-local-variable 'font-lock-defaults)
2441 '(gdb-threads-font-lock-keywords)) 2473 '(gdb-threads-font-lock-keywords))
2442 (run-mode-hooks 'gdb-threads-mode-hook) 2474 (run-mode-hooks 'gdb-threads-mode-hook)
2443 ;; Force "info threads" onto queue. 2475 ;; Force "info threads" onto queue.
2765 (select-window (posn-window (event-start event))) 2797 (select-window (posn-window (event-start event)))
2766 (let* ((selection (gdb-memory-unit-menu event)) 2798 (let* ((selection (gdb-memory-unit-menu event))
2767 (binding (and selection (lookup-key gdb-memory-unit-menu 2799 (binding (and selection (lookup-key gdb-memory-unit-menu
2768 (vector (car selection)))))) 2800 (vector (car selection))))))
2769 (if binding (call-interactively binding))))) 2801 (if binding (call-interactively binding)))))
2770
2771 ;;from make-mode-line-mouse-map
2772 (defun gdb-make-header-line-mouse-map (mouse function) "\
2773 Return a keymap with single entry for mouse key MOUSE on the header line.
2774 MOUSE is defined to run function FUNCTION with no args in the buffer
2775 corresponding to the mode line clicked."
2776 (let ((map (make-sparse-keymap)))
2777 (define-key map (vector 'header-line mouse) function)
2778 (define-key map (vector 'header-line 'down-mouse-1) 'ignore)
2779 map))
2780 2802
2781 (defvar gdb-memory-font-lock-keywords 2803 (defvar gdb-memory-font-lock-keywords
2782 '(;; <__function.name+n> 2804 '(;; <__function.name+n>
2783 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" (1 font-lock-function-name-face)) 2805 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" (1 font-lock-function-name-face))
2784 ) 2806 )