comparison lisp/progmodes/gdb-ui.el @ 65973:ae4953c24452

(gdba): Improve diagram. (def-gdb-auto-update-handler, gdb-info-locals-handler) (gdb-put-breakpoint-icon, gdb-remove-breakpoint-icons): Call get-buffer-window once.
author Nick Roberts <nickrob@snap.net.nz>
date Mon, 10 Oct 2005 12:26:05 +0000
parents 7246b6fe556e
children 9698655085d3 08b4dd6a6e87 5e2d3828e89f
comparison
equal deleted inserted replaced
65972:8bd4c2112a50 65973:ae4953c24452
171 171
172 See Info node `(emacs)GDB Graphical Interface' for a more 172 See Info node `(emacs)GDB Graphical Interface' for a more
173 detailed description of this mode. 173 detailed description of this mode.
174 174
175 175
176 --------------------------------------------------------------------- 176 +--------------------------------------------------------------+
177 GDB Toolbar 177 | GDB Toolbar |
178 --------------------------------------------------------------------- 178 +-------------------------------+------------------------------+
179 GUD buffer (I/O of GDB) | Locals buffer 179 | GUD buffer (I/O of GDB) | Locals buffer |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 --------------------------------------------------------------------- 183 +-------------------------------+------------------------------+
184 Source buffer | Input/Output (of inferior) buffer 184 | Source buffer | I/O buffer (of inferior) |
185 | (comint-mode) 185 | | (comint-mode) |
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 --------------------------------------------------------------------- 192 +-------------------------------+------------------------------+
193 Stack buffer | Breakpoints buffer 193 | Stack buffer | Breakpoints buffer |
194 RET gdb-frames-select | SPC gdb-toggle-breakpoint 194 | RET gdb-frames-select | SPC gdb-toggle-breakpoint |
195 | RET gdb-goto-breakpoint 195 | | RET gdb-goto-breakpoint |
196 | d gdb-delete-breakpoint 196 | | d gdb-delete-breakpoint |
197 ---------------------------------------------------------------------" 197 +-------------------------------+------------------------------+"
198 ;; 198 ;;
199 (interactive (list (gud-query-cmdline 'gdba))) 199 (interactive (list (gud-query-cmdline 'gdba)))
200 ;; 200 ;;
201 ;; Let's start with a basic gud-gdb buffer and then modify it a bit. 201 ;; Let's start with a basic gud-gdb buffer and then modify it a bit.
202 (gdb command-line) 202 (gdb command-line)
1190 (delq ',trigger 1190 (delq ',trigger
1191 gdb-pending-triggers)) 1191 gdb-pending-triggers))
1192 (let ((buf (gdb-get-buffer ',buf-key))) 1192 (let ((buf (gdb-get-buffer ',buf-key)))
1193 (and buf 1193 (and buf
1194 (with-current-buffer buf 1194 (with-current-buffer buf
1195 (let ((p (window-point (get-buffer-window buf 0))) 1195 (let* ((window (get-buffer-window buf 0))
1196 (p (window-point window))
1196 (buffer-read-only nil)) 1197 (buffer-read-only nil))
1197 (erase-buffer) 1198 (erase-buffer)
1198 (insert-buffer-substring (gdb-get-create-buffer 1199 (insert-buffer-substring (gdb-get-create-buffer
1199 'gdb-partial-output-buffer)) 1200 'gdb-partial-output-buffer))
1200 (set-window-point (get-buffer-window buf 0) p))))) 1201 (set-window-point window p)))))
1201 ;; put customisation here 1202 ;; put customisation here
1202 (,custom-defun))) 1203 (,custom-defun)))
1203 1204
1204 (defmacro def-gdb-auto-updated-buffer (buffer-key 1205 (defmacro def-gdb-auto-updated-buffer (buffer-key
1205 trigger-name gdb-command 1206 trigger-name gdb-command
2123 (replace-match "(structure);\n" nil nil)) 2124 (replace-match "(structure);\n" nil nil))
2124 (goto-char (point-min)) 2125 (goto-char (point-min))
2125 (while (re-search-forward "\\s-*{.*\n" nil t) 2126 (while (re-search-forward "\\s-*{.*\n" nil t)
2126 (replace-match " (array);\n" nil nil)))) 2127 (replace-match " (array);\n" nil nil))))
2127 (let ((buf (gdb-get-buffer 'gdb-locals-buffer))) 2128 (let ((buf (gdb-get-buffer 'gdb-locals-buffer)))
2128 (and buf (with-current-buffer buf 2129 (and buf
2129 (let ((p (window-point (get-buffer-window buf 0))) 2130 (with-current-buffer buf
2131 (let* ((window (get-buffer-window buf 0))
2132 (p (window-point window))
2130 (buffer-read-only nil)) 2133 (buffer-read-only nil))
2131 (erase-buffer) 2134 (erase-buffer)
2132 (insert-buffer-substring (gdb-get-create-buffer 2135 (insert-buffer-substring (gdb-get-create-buffer
2133 'gdb-partial-output-buffer)) 2136 'gdb-partial-output-buffer))
2134 (set-window-point (get-buffer-window buf 0) p))))) 2137 (set-window-point window p)))))
2135 (run-hooks 'gdb-info-locals-hook)) 2138 (run-hooks 'gdb-info-locals-hook))
2136 2139
2137 (defun gdb-info-locals-custom () 2140 (defun gdb-info-locals-custom ()
2138 nil) 2141 nil)
2139 2142
2526 putstring 2529 putstring
2527 'left-margin)) 2530 'left-margin))
2528 (when (< left-margin-width 2) 2531 (when (< left-margin-width 2)
2529 (save-current-buffer 2532 (save-current-buffer
2530 (setq left-margin-width 2) 2533 (setq left-margin-width 2)
2531 (if (get-buffer-window (current-buffer) 0) 2534 (let ((window (get-buffer-window (current-buffer) 0)))
2535 (if window
2532 (set-window-margins 2536 (set-window-margins
2533 (get-buffer-window (current-buffer) 0) 2537 window left-margin-width right-margin-width)))))
2534 left-margin-width right-margin-width))))
2535 (gdb-put-string 2538 (gdb-put-string
2536 (propertize putstring 2539 (propertize putstring
2537 'face (if enabled 'breakpoint-enabled 'breakpoint-disabled)) 2540 'face (if enabled 'breakpoint-enabled 'breakpoint-disabled))
2538 (1+ start))))) 2541 (1+ start)))))
2539 2542
2541 (gdb-remove-strings start end) 2544 (gdb-remove-strings start end)
2542 (if (display-images-p) 2545 (if (display-images-p)
2543 (remove-images start end)) 2546 (remove-images start end))
2544 (when remove-margin 2547 (when remove-margin
2545 (setq left-margin-width 0) 2548 (setq left-margin-width 0)
2546 (if (get-buffer-window (current-buffer) 0) 2549 (let ((window (get-buffer-window (current-buffer) 0)))
2547 (set-window-margins 2550 (if window
2548 (get-buffer-window (current-buffer) 0) 2551 (set-window-margins
2549 left-margin-width right-margin-width)))) 2552 window left-margin-width right-margin-width)))))
2550 2553
2551 2554
2552 ;; 2555 ;;
2553 ;; Assembler buffer. 2556 ;; Assembler buffer.
2554 ;; 2557 ;;