comparison lisp/gdb-ui.el @ 51227:a1e2454a02ec

(gdb-info-breakpoints-custom, gdb-assembler-custom): Put string associated with breakpoint at start of line so that it is always visible. (gdb-display-source-buffer): Display assembler during execution, when requested. (gud-menu-map): Add a toggle button to menubar for gdb-many-windows. (gdb-many-windows): Define explicitly as a function and a variable (formerly as a minor mode). These need to be global so layout can be reset from any buffer. (gdb-assembler-mode): Keep fringe outside margin as the overlay arrow is not used for assembler.
author Nick Roberts <nickrob@snap.net.nz>
date Sun, 25 May 2003 16:51:34 +0000
parents 61a988cae9b2
children 39126c23006f
comparison
equal deleted inserted replaced
51226:80443ffc9ffa 51227:a1e2454a02ec
49 ;;; Code: 49 ;;; Code:
50 50
51 (require 'gud) 51 (require 'gud)
52 52
53 (defcustom gdb-window-height 20 53 (defcustom gdb-window-height 20
54 "*Number of lines in a frame for a displayed expression in GDB-UI." 54 "Number of lines in a frame for a displayed expression in GDB-UI."
55 :type 'integer 55 :type 'integer
56 :group 'gud) 56 :group 'gud)
57 57
58 (defcustom gdb-window-width 30 58 (defcustom gdb-window-width 30
59 "Width of a frame for a displayed expression in GDB-UI." 59 "Width of a frame for a displayed expression in GDB-UI."
1382 (if (eq window-system 'x) 1382 (if (eq window-system 'x)
1383 (progn 1383 (progn
1384 (remove-images start end) 1384 (remove-images start end)
1385 (if (eq ?y flag) 1385 (if (eq ?y flag)
1386 (put-image breakpoint-enabled-icon 1386 (put-image breakpoint-enabled-icon
1387 (point) 1387 (+ start 1)
1388 "breakpoint icon enabled" 1388 "breakpoint icon enabled"
1389 'left-margin) 1389 'left-margin)
1390 (put-image breakpoint-disabled-icon (point) 1390 (put-image breakpoint-disabled-icon
1391 (+ start 1)
1391 "breakpoint icon disabled" 1392 "breakpoint icon disabled"
1392 'left-margin))) 1393 'left-margin)))
1393 (gdb-remove-strings start end) 1394 (gdb-remove-strings start end)
1394 (if (eq ?y flag) 1395 (if (eq ?y flag)
1395 (gdb-put-string "B" (point)) 1396 (gdb-put-string "B" (+ start 1))
1396 (gdb-put-string "b" (point)))))))))))) 1397 (gdb-put-string "b" (+ start 1))))))))))))
1397 (end-of-line)))))) 1398 (end-of-line))))))
1398 1399
1399 (defun gdb-breakpoints-buffer-name () 1400 (defun gdb-breakpoints-buffer-name ()
1400 (with-current-buffer gud-comint-buffer 1401 (with-current-buffer gud-comint-buffer
1401 (concat "*breakpoints of " (gdb-get-target-string) "*"))) 1402 (concat "*breakpoints of " (gdb-get-target-string) "*")))
1983 (setq answer (split-window largest new-size)) 1984 (setq answer (split-window largest new-size))
1984 (set-window-buffer answer buf))) 1985 (set-window-buffer answer buf)))
1985 answer)) 1986 answer))
1986 1987
1987 (defun gdb-display-source-buffer (buffer) 1988 (defun gdb-display-source-buffer (buffer)
1988 (set-window-buffer gdb-source-window buffer) 1989 (if (eq gdb-selected-view 'source)
1990 (set-window-buffer gdb-source-window buffer)
1991 (set-window-buffer gdb-source-window
1992 (gdb-get-buffer 'gdb-assembler-buffer)))
1989 gdb-source-window) 1993 gdb-source-window)
1990 1994
1991 1995
1992 ;;; Shared keymap initialization: 1996 ;;; Shared keymap initialization:
1997
1998 (define-key gud-menu-map [gdb-many-windows]
1999 (menu-bar-make-toggle gdb-many-windows gdb-many-windows
2000 "Display other windows" "Many Windows %s"
2001 "Display locals, stack and breakpoint information"))
1993 2002
1994 (let ((menu (make-sparse-keymap "GDB-Frames"))) 2003 (let ((menu (make-sparse-keymap "GDB-Frames")))
1995 (define-key gud-menu-map [frames] 2004 (define-key gud-menu-map [frames]
1996 `(menu-item "GDB-Frames" ,menu :visible (eq gud-minor-mode 'gdba))) 2005 `(menu-item "GDB-Frames" ,menu :visible (eq gud-minor-mode 'gdba)))
1997 (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer)) 2006 (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer))
2089 (split-window-horizontally) 2098 (split-window-horizontally)
2090 (other-window 1) 2099 (other-window 1)
2091 (switch-to-buffer (gdb-breakpoints-buffer-name)) 2100 (switch-to-buffer (gdb-breakpoints-buffer-name))
2092 (other-window 1)) 2101 (other-window 1))
2093 2102
2094 (define-minor-mode gdb-many-windows 2103 (defcustom gdb-many-windows nil
2095 "Toggle the number of windows in the basic arrangement." 2104 "Nil means that gdb starts with just two windows : the GUD and
2096 :group 'gud 2105 the source buffer."
2097 :init-value nil 2106 :type 'boolean
2107 :group 'gud)
2108
2109 (defun gdb-many-windows (arg)
2110 "Toggle the number of windows in the basic arrangement."
2111 (interactive "P")
2112 (setq gdb-many-windows
2113 (if (null arg)
2114 (not gdb-many-windows)
2115 (> (prefix-numeric-value arg) 0)))
2098 (gdb-restore-windows)) 2116 (gdb-restore-windows))
2099 2117
2100 (defun gdb-restore-windows () 2118 (defun gdb-restore-windows ()
2101 "Restore the basic arrangement of windows used by gdba. 2119 "Restore the basic arrangement of windows used by gdba.
2102 This arrangement depends on the value of `gdb-many-windows'." 2120 This arrangement depends on the value of `gdb-many-windows'."
2307 (end (progn (end-of-line) (+ (point) 1)))) 2325 (end (progn (end-of-line) (+ (point) 1))))
2308 (if (eq window-system 'x) 2326 (if (eq window-system 'x)
2309 (progn 2327 (progn
2310 (remove-images start end) 2328 (remove-images start end)
2311 (if (eq ?y flag) 2329 (if (eq ?y flag)
2312 (put-image breakpoint-enabled-icon (point) 2330 (put-image breakpoint-enabled-icon
2331 (+ start 1)
2313 "breakpoint icon enabled" 2332 "breakpoint icon enabled"
2314 'left-margin) 2333 'left-margin)
2315 (put-image breakpoint-disabled-icon (point) 2334 (put-image breakpoint-disabled-icon
2335 (+ start 1)
2316 "breakpoint icon disabled" 2336 "breakpoint icon disabled"
2317 'left-margin))) 2337 'left-margin)))
2318 (gdb-remove-strings start end) 2338 (gdb-remove-strings start end)
2319 (if (eq ?y flag) 2339 (if (eq ?y flag)
2320 (gdb-put-string "B" (point)) 2340 (gdb-put-string "B" (+ start 1))
2321 (gdb-put-string "b" (point))))))))))))) 2341 (gdb-put-string "b" (+ start 1)))))))))))))
2322 2342
2323 (defvar gdb-assembler-mode-map 2343 (defvar gdb-assembler-mode-map
2324 (let ((map (make-sparse-keymap))) 2344 (let ((map (make-sparse-keymap)))
2325 (suppress-keymap map) 2345 (suppress-keymap map)
2326 map)) 2346 map))
2330 2350
2331 \\{gdb-assembler-mode-map}" 2351 \\{gdb-assembler-mode-map}"
2332 (setq major-mode 'gdb-assembler-mode) 2352 (setq major-mode 'gdb-assembler-mode)
2333 (setq mode-name "Assembler") 2353 (setq mode-name "Assembler")
2334 (setq left-margin-width 2) 2354 (setq left-margin-width 2)
2355 (setq fringes-outside-margins t)
2335 (setq buffer-read-only t) 2356 (setq buffer-read-only t)
2336 (use-local-map gdb-assembler-mode-map) 2357 (use-local-map gdb-assembler-mode-map)
2337 (gdb-invalidate-assembler) 2358 (gdb-invalidate-assembler)
2338 (gdb-invalidate-breakpoints)) 2359 (gdb-invalidate-breakpoints))
2339 2360