Mercurial > emacs
comparison lisp/progmodes/gdb-ui.el @ 90105:7e3f621f1dd4
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-15
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-95
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-96
Move Gnus images into etc/images
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-97
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-105
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-14
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-15
Update from CVS: lisp/imap.el (imap-log): Doc fix.
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-16
Merge from emacs--cvs-trunk--0
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 18 Feb 2005 00:41:50 +0000 |
parents | 3ebd9bdb4fe5 106946a8423d |
children | bf0d492ea2d5 |
comparison
equal
deleted
inserted
replaced
90104:a01e7a9f1659 | 90105:7e3f621f1dd4 |
---|---|
77 (defvar gdb-var-changed nil "Non-nil means that gdb-var-list has changed.") | 77 (defvar gdb-var-changed nil "Non-nil means that gdb-var-list has changed.") |
78 (defvar gdb-buffer-type nil) | 78 (defvar gdb-buffer-type nil) |
79 (defvar gdb-overlay-arrow-position nil) | 79 (defvar gdb-overlay-arrow-position nil) |
80 (defvar gdb-server-prefix nil) | 80 (defvar gdb-server-prefix nil) |
81 (defvar gdb-flush-pending-output nil) | 81 (defvar gdb-flush-pending-output nil) |
82 (defvar gdb-location-list nil "List of directories for source files.") | |
83 (defvar gdb-find-file-unhook nil) | |
82 | 84 |
83 (defvar gdb-buffer-type nil | 85 (defvar gdb-buffer-type nil |
84 "One of the symbols bound in `gdb-buffer-rules'.") | 86 "One of the symbols bound in `gdb-buffer-rules'.") |
85 | 87 |
86 (defvar gdb-input-queue () | 88 (defvar gdb-input-queue () |
189 "Non-nil means display output from the inferior in a separate buffer." | 191 "Non-nil means display output from the inferior in a separate buffer." |
190 :type 'boolean | 192 :type 'boolean |
191 :group 'gud | 193 :group 'gud |
192 :version "22.1") | 194 :version "22.1") |
193 | 195 |
196 (defun gdb-set-gud-minor-mode (buffer) | |
197 "Set gud-minor-mode from find-file if appropriate." | |
198 (goto-char (point-min)) | |
199 (unless (search-forward "No source file named " nil t) | |
200 (condition-case nil | |
201 (gdb-enqueue-input | |
202 (list (concat gdb-server-prefix "info source\n") | |
203 `(lambda () (gdb-set-gud-minor-mode-1 ,buffer)))) | |
204 (error (setq gdb-find-file-unhook t))))) | |
205 | |
206 (defun gdb-set-gud-minor-mode-1 (buffer) | |
207 (goto-char (point-min)) | |
208 (if (and (search-forward "Located in " nil t) | |
209 (looking-at "\\S-*") | |
210 (string-equal (buffer-file-name buffer) | |
211 (match-string 0))) | |
212 (with-current-buffer buffer | |
213 (set (make-local-variable 'gud-minor-mode) 'gdba) | |
214 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)))) | |
215 | |
216 (defun gdb-set-gud-minor-mode-existing-buffers () | |
217 (dolist (buffer (buffer-list)) | |
218 (let ((file (buffer-file-name buffer))) | |
219 (if file | |
220 (progn | |
221 (gdb-enqueue-input | |
222 (list (concat gdb-server-prefix "list " | |
223 (file-name-nondirectory file) ":1\n") | |
224 `(lambda () (gdb-set-gud-minor-mode ,buffer))))))))) | |
225 | |
194 (defun gdb-ann3 () | 226 (defun gdb-ann3 () |
195 (setq gdb-debug-log nil) | 227 (setq gdb-debug-log nil) |
196 (set (make-local-variable 'gud-minor-mode) 'gdba) | 228 (set (make-local-variable 'gud-minor-mode) 'gdba) |
197 (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter) | 229 (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter) |
198 ;; | 230 ;; |
247 (setq gdb-pending-triggers nil) | 279 (setq gdb-pending-triggers nil) |
248 (setq gdb-output-sink 'user) | 280 (setq gdb-output-sink 'user) |
249 (setq gdb-server-prefix "server ") | 281 (setq gdb-server-prefix "server ") |
250 (setq gdb-flush-pending-output nil) | 282 (setq gdb-flush-pending-output nil) |
251 (setq gdb-location-list nil) | 283 (setq gdb-location-list nil) |
284 (setq gdb-find-file-unhook nil) | |
252 ;; | 285 ;; |
253 (setq gdb-buffer-type 'gdba) | 286 (setq gdb-buffer-type 'gdba) |
254 ;; | 287 ;; |
255 (if gdb-use-inferior-io-buffer (gdb-clear-inferior-io)) | 288 (if gdb-use-inferior-io-buffer (gdb-clear-inferior-io)) |
256 ;; | 289 ;; |
261 ;; find source file and compilation directory here | 294 ;; find source file and compilation directory here |
262 (gdb-enqueue-input (list "server list main\n" 'ignore)) ; C program | 295 (gdb-enqueue-input (list "server list main\n" 'ignore)) ; C program |
263 (gdb-enqueue-input (list "server list MAIN__\n" 'ignore)) ; Fortran program | 296 (gdb-enqueue-input (list "server list MAIN__\n" 'ignore)) ; Fortran program |
264 (gdb-enqueue-input (list "server info source\n" 'gdb-source-info)) | 297 (gdb-enqueue-input (list "server info source\n" 'gdb-source-info)) |
265 ;; | 298 ;; |
299 (gdb-set-gud-minor-mode-existing-buffers) | |
266 (run-hooks 'gdba-mode-hook)) | 300 (run-hooks 'gdba-mode-hook)) |
267 | 301 |
268 (defcustom gdb-use-colon-colon-notation nil | 302 (defcustom gdb-use-colon-colon-notation nil |
269 "If non-nil use FUN::VAR format to display variables in the speedbar." ; | 303 "If non-nil use FUN::VAR format to display variables in the speedbar." ; |
270 :type 'boolean | 304 :type 'boolean |
1046 ;; the appropriately typed buffer. That function will be called: | 1080 ;; the appropriately typed buffer. That function will be called: |
1047 gdb-info-breakpoints-handler | 1081 gdb-info-breakpoints-handler |
1048 ;; buffer specific functions | 1082 ;; buffer specific functions |
1049 gdb-info-breakpoints-custom) | 1083 gdb-info-breakpoints-custom) |
1050 | 1084 |
1051 (defvar gdb-location-list nil "List of directories for source files.") | |
1052 | |
1053 (defconst breakpoint-xpm-data | 1085 (defconst breakpoint-xpm-data |
1054 "/* XPM */ | 1086 "/* XPM */ |
1055 static char *magick[] = { | 1087 static char *magick[] = { |
1056 /* columns rows colors chars-per-pixel */ | 1088 /* columns rows colors chars-per-pixel */ |
1057 \"10 10 2 1\", | 1089 \"10 10 2 1\", |
1157 help-echo "mouse-2, RET: visit breakpoint")) | 1189 help-echo "mouse-2, RET: visit breakpoint")) |
1158 (unless (file-exists-p file) | 1190 (unless (file-exists-p file) |
1159 (setq file (cdr (assoc bptno gdb-location-list)))) | 1191 (setq file (cdr (assoc bptno gdb-location-list)))) |
1160 (unless (string-equal file "File not found") | 1192 (unless (string-equal file "File not found") |
1161 (if file | 1193 (if file |
1162 (with-current-buffer | 1194 (with-current-buffer (find-file-noselect file) |
1163 (find-file-noselect file) | 1195 (set (make-local-variable 'gud-minor-mode) |
1164 (save-current-buffer | |
1165 (set (make-local-variable 'gud-minor-mode) | |
1166 'gdba) | 1196 'gdba) |
1167 (set (make-local-variable 'tool-bar-map) | 1197 (set (make-local-variable 'tool-bar-map) |
1168 gud-tool-bar-map)) | 1198 gud-tool-bar-map) |
1169 ;; only want one breakpoint icon at each location | 1199 ;; only want one breakpoint icon at each location |
1170 (save-excursion | 1200 (save-excursion |
1171 (goto-line (string-to-number line)) | 1201 (goto-line (string-to-number line)) |
1172 (gdb-put-breakpoint-icon (eq flag ?y) bptno))) | 1202 (gdb-put-breakpoint-icon (eq flag ?y) bptno))) |
1173 (gdb-enqueue-input | 1203 (gdb-enqueue-input |
2052 | 2082 |
2053 (defun gdb-source-info () | 2083 (defun gdb-source-info () |
2054 "Find the source file where the program starts and displays it with related | 2084 "Find the source file where the program starts and displays it with related |
2055 buffers." | 2085 buffers." |
2056 (goto-char (point-min)) | 2086 (goto-char (point-min)) |
2057 (if (search-forward "Located in " nil t) | 2087 (if (and (search-forward "Located in " nil t) |
2058 (if (looking-at "\\S-*") | 2088 (looking-at "\\S-*")) |
2059 (setq gdb-main-file (match-string 0)))) | 2089 (setq gdb-main-file (match-string 0))) |
2060 (if gdb-many-windows | 2090 (if gdb-many-windows |
2061 (gdb-setup-windows) | 2091 (gdb-setup-windows) |
2062 (gdb-get-create-buffer 'gdb-breakpoints-buffer) | 2092 (gdb-get-create-buffer 'gdb-breakpoints-buffer) |
2063 (if gdb-show-main | 2093 (if gdb-show-main |
2064 (let ((pop-up-windows t)) | 2094 (let ((pop-up-windows t)) |
2065 (display-buffer (gud-find-file gdb-main-file)))))) | 2095 (display-buffer (gud-find-file gdb-main-file)))))) |
2066 | 2096 |
2067 (defun gdb-get-location (bptno line flag) | 2097 (defun gdb-get-location (bptno line flag) |
2068 "Find the directory containing the relevant source file. | 2098 "Find the directory containing the relevant source file. |
2069 Put in buffer and place breakpoint icon." | 2099 Put in buffer and place breakpoint icon." |
2070 (goto-char (point-min)) | 2100 (goto-char (point-min)) |
2082 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)) | 2112 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)) |
2083 ;; only want one breakpoint icon at each location | 2113 ;; only want one breakpoint icon at each location |
2084 (save-excursion | 2114 (save-excursion |
2085 (goto-line (string-to-number line)) | 2115 (goto-line (string-to-number line)) |
2086 (gdb-put-breakpoint-icon (eq flag ?y) bptno)))) | 2116 (gdb-put-breakpoint-icon (eq flag ?y) bptno)))) |
2117 | |
2118 (add-hook 'find-file-hook 'gdb-find-file-hook) | |
2119 | |
2120 (defun gdb-find-file-hook () | |
2121 (if (and (not gdb-find-file-unhook) | |
2122 ;; in case gud or gdb-ui is just loaded | |
2123 gud-comint-buffer | |
2124 (buffer-name gud-comint-buffer) | |
2125 (with-current-buffer gud-comint-buffer | |
2126 (eq gud-minor-mode 'gdba))) | |
2127 (condition-case nil | |
2128 (gdb-enqueue-input | |
2129 (list (concat gdb-server-prefix "list " | |
2130 (file-name-nondirectory buffer-file-name) | |
2131 ":1\n") | |
2132 `(lambda () (gdb-set-gud-minor-mode ,(current-buffer))))) | |
2133 (error (setq gdb-find-file-unhook t))))) | |
2087 | 2134 |
2088 ;;from put-image | 2135 ;;from put-image |
2089 (defun gdb-put-string (putstring pos &optional dprop) | 2136 (defun gdb-put-string (putstring pos &optional dprop) |
2090 "Put string PUTSTRING in front of POS in the current buffer. | 2137 "Put string PUTSTRING in front of POS in the current buffer. |
2091 PUTSTRING is displayed by putting an overlay into the current buffer with a | 2138 PUTSTRING is displayed by putting an overlay into the current buffer with a |