Mercurial > emacs
comparison lisp/progmodes/gdb-ui.el @ 90159:08185296b491
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-44
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 272-288)
- src/xdisp.c (dump_glyph_row): Don't display overlay_arrow_p field.
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 67)
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 05 May 2005 00:04:55 +0000 |
parents | 146c086df160 115b0152e8bb |
children | 62afea0771d8 |
comparison
equal
deleted
inserted
replaced
90158:bf4846baba9a | 90159:08185296b491 |
---|---|
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 "Alist of breakpoint numbers and full filenames.") | 82 (defvar gdb-location-alist nil |
83 "Alist of breakpoint numbers and full filenames.") | |
83 (defvar gdb-find-file-unhook nil) | 84 (defvar gdb-find-file-unhook nil) |
85 (defvar gdb-active-process nil "GUD tooltips display variable values when t, \ | |
86 and #define directives otherwise.") | |
84 | 87 |
85 (defvar gdb-buffer-type nil | 88 (defvar gdb-buffer-type nil |
86 "One of the symbols bound in `gdb-buffer-rules'.") | 89 "One of the symbols bound in `gdb-buffer-rules'.") |
87 | 90 |
88 (defvar gdb-input-queue () | 91 (defvar gdb-input-queue () |
191 "Non-nil means display output from the inferior in a separate buffer." | 194 "Non-nil means display output from the inferior in a separate buffer." |
192 :type 'boolean | 195 :type 'boolean |
193 :group 'gud | 196 :group 'gud |
194 :version "22.1") | 197 :version "22.1") |
195 | 198 |
199 (defcustom gdb-cpp-define-alist-program | |
200 (cond ((eq system-type 'ms-dos) "gcc -E -dM -o - -") | |
201 (t "gcc -E -dM -")) | |
202 "The program name for generating an alist of #define directives. | |
203 This list is used to display the #define directive associated | |
204 with an identifier as a tooltip. It works in a debug session with | |
205 GDB, when tooltip-gud-tips-p is t." | |
206 :type 'string | |
207 :group 'gud | |
208 :version "22.1") | |
209 | |
210 (defcustom gdb-cpp-define-alist-flags "" | |
211 "*Preprocessor flags used by `gdb-create-define-alist'." | |
212 :type 'string | |
213 :group 'gud | |
214 :version "22.1") | |
215 | |
216 (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.") | |
217 | |
218 (defun gdb-create-define-alist () | |
219 "Create an alist of #define directives for GUD tooltips." | |
220 (let* ((file (buffer-file-name)) | |
221 (output | |
222 (with-output-to-string | |
223 (with-current-buffer standard-output | |
224 (call-process shell-file-name | |
225 (if (file-exists-p file) file nil) | |
226 (list t nil) nil "-c" | |
227 (concat gdb-cpp-define-alist-program " " | |
228 gdb-cpp-define-alist-flags))))) | |
229 (define-list (split-string output "\n" t)) | |
230 (name)) | |
231 (setq gdb-define-alist nil) | |
232 (dolist (define define-list) | |
233 (setq name (nth 1 (split-string define "[( ]"))) | |
234 (push (cons name define) gdb-define-alist)))) | |
235 | |
196 (defun gdb-set-gud-minor-mode (buffer) | 236 (defun gdb-set-gud-minor-mode (buffer) |
197 "Set gud-minor-mode from find-file if appropriate." | 237 "Set gud-minor-mode from find-file if appropriate." |
198 (goto-char (point-min)) | 238 (goto-char (point-min)) |
199 (unless (search-forward "No source file named " nil t) | 239 (unless (search-forward "No source file named " nil t) |
200 (condition-case nil | 240 (condition-case nil |
203 `(lambda () (gdb-set-gud-minor-mode-1 ,buffer)))) | 243 `(lambda () (gdb-set-gud-minor-mode-1 ,buffer)))) |
204 (error (setq gdb-find-file-unhook t))))) | 244 (error (setq gdb-find-file-unhook t))))) |
205 | 245 |
206 (defun gdb-set-gud-minor-mode-1 (buffer) | 246 (defun gdb-set-gud-minor-mode-1 (buffer) |
207 (goto-char (point-min)) | 247 (goto-char (point-min)) |
208 (if (and (search-forward "Located in " nil t) | 248 (when (and (search-forward "Located in " nil t) |
209 (looking-at "\\S-*") | 249 (looking-at "\\S-*") |
210 (string-equal (buffer-file-name buffer) | 250 (string-equal (buffer-file-name buffer) |
211 (match-string 0))) | 251 (match-string 0))) |
212 (with-current-buffer buffer | 252 (with-current-buffer buffer |
213 (set (make-local-variable 'gud-minor-mode) 'gdba) | 253 (set (make-local-variable 'gud-minor-mode) 'gdba) |
214 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)))) | 254 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
255 (make-local-variable 'gdb-define-alist) | |
256 (gdb-create-define-alist) | |
257 (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))) | |
215 | 258 |
216 (defun gdb-set-gud-minor-mode-existing-buffers () | 259 (defun gdb-set-gud-minor-mode-existing-buffers () |
217 (dolist (buffer (buffer-list)) | 260 (dolist (buffer (buffer-list)) |
218 (let ((file (buffer-file-name buffer))) | 261 (let ((file (buffer-file-name buffer))) |
219 (if file | 262 (if file |
279 (setq gdb-current-item nil) | 322 (setq gdb-current-item nil) |
280 (setq gdb-pending-triggers nil) | 323 (setq gdb-pending-triggers nil) |
281 (setq gdb-output-sink 'user) | 324 (setq gdb-output-sink 'user) |
282 (setq gdb-server-prefix "server ") | 325 (setq gdb-server-prefix "server ") |
283 (setq gdb-flush-pending-output nil) | 326 (setq gdb-flush-pending-output nil) |
284 (setq gdb-location-list nil) | 327 (setq gdb-location-alist nil) |
285 (setq gdb-find-file-unhook nil) | 328 (setq gdb-find-file-unhook nil) |
286 ;; | 329 ;; |
287 (setq gdb-buffer-type 'gdba) | 330 (setq gdb-buffer-type 'gdba) |
288 ;; | 331 ;; |
289 (if gdb-use-inferior-io-buffer (gdb-clear-inferior-io)) | 332 (if gdb-use-inferior-io-buffer (gdb-clear-inferior-io)) |
299 ;; | 342 ;; |
300 (gdb-set-gud-minor-mode-existing-buffers) | 343 (gdb-set-gud-minor-mode-existing-buffers) |
301 (run-hooks 'gdba-mode-hook)) | 344 (run-hooks 'gdba-mode-hook)) |
302 | 345 |
303 (defcustom gdb-use-colon-colon-notation nil | 346 (defcustom gdb-use-colon-colon-notation nil |
304 "If non-nil use FUN::VAR format to display variables in the speedbar." ; | 347 "If non-nil use FUN::VAR format to display variables in the speedbar." |
305 :type 'boolean | 348 :type 'boolean |
306 :group 'gud | 349 :group 'gud |
307 :version "22.1") | 350 :version "22.1") |
308 | 351 |
309 (defun gud-watch () | 352 (defun gud-watch () |
428 (goto-char (point-min)) | 471 (goto-char (point-min)) |
429 (while (re-search-forward gdb-var-update-regexp nil t) | 472 (while (re-search-forward gdb-var-update-regexp nil t) |
430 (let ((varnum (match-string 1))) | 473 (let ((varnum (match-string 1))) |
431 (gdb-enqueue-input | 474 (gdb-enqueue-input |
432 (list | 475 (list |
433 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 476 (if (with-current-buffer gud-comint-buffer |
477 (eq gud-minor-mode 'gdba)) | |
434 (concat "server interpreter mi \"-var-evaluate-expression " | 478 (concat "server interpreter mi \"-var-evaluate-expression " |
435 varnum "\"\n") | 479 varnum "\"\n") |
436 (concat "-var-evaluate-expression " varnum "\n")) | 480 (concat "-var-evaluate-expression " varnum "\n")) |
437 `(lambda () (gdb-var-evaluate-expression-handler | 481 `(lambda () (gdb-var-evaluate-expression-handler |
438 ,varnum t))))))) | 482 ,varnum t))))))) |
480 (setq value (read-string "New value: ")) | 524 (setq value (read-string "New value: ")) |
481 (gdb-enqueue-input | 525 (gdb-enqueue-input |
482 (list | 526 (list |
483 (if (with-current-buffer gud-comint-buffer | 527 (if (with-current-buffer gud-comint-buffer |
484 (eq gud-minor-mode 'gdba)) | 528 (eq gud-minor-mode 'gdba)) |
485 (concat "server interpreter mi \"-var-assign " varnum " " value "\"\n") | 529 (concat "server interpreter mi \"-var-assign " |
530 varnum " " value "\"\n") | |
486 (concat "-var-assign " varnum " " value "\n")) | 531 (concat "-var-assign " varnum " " value "\n")) |
487 'ignore)))) | 532 'ignore)))) |
488 | 533 |
489 (defcustom gdb-show-changed-values t | 534 (defcustom gdb-show-changed-values t |
490 "If non-nil highlight values that have recently changed in the speedbar. | 535 "If non-nil highlight values that have recently changed in the speedbar. |
771 ("nquery" gdb-subprompt) | 816 ("nquery" gdb-subprompt) |
772 ("prompt-for-continue" gdb-subprompt) | 817 ("prompt-for-continue" gdb-subprompt) |
773 ("post-prompt" gdb-post-prompt) | 818 ("post-prompt" gdb-post-prompt) |
774 ("source" gdb-source) | 819 ("source" gdb-source) |
775 ("starting" gdb-starting) | 820 ("starting" gdb-starting) |
776 ("exited" gdb-stopping) | 821 ("exited" gdb-exited) |
777 ("signalled" gdb-stopping) | 822 ("signalled" gdb-exited) |
778 ("signal" gdb-stopping) | 823 ("signal" gdb-stopping) |
779 ("breakpoint" gdb-stopping) | 824 ("breakpoint" gdb-stopping) |
780 ("watchpoint" gdb-stopping) | 825 ("watchpoint" gdb-stopping) |
781 ("frame-begin" gdb-frame-begin) | 826 ("frame-begin" gdb-frame-begin) |
782 ("stopped" gdb-stopped) | 827 ("stopped" gdb-stopped) |
798 (string-match gdb-source-spec-regexp args) | 843 (string-match gdb-source-spec-regexp args) |
799 ;; Extract the frame position from the marker. | 844 ;; Extract the frame position from the marker. |
800 (setq gud-last-frame | 845 (setq gud-last-frame |
801 (cons | 846 (cons |
802 (match-string 1 args) | 847 (match-string 1 args) |
803 (string-to-int (match-string 2 args)))) | 848 (string-to-number (match-string 2 args)))) |
804 (setq gdb-current-address (match-string 3 args)) | 849 (setq gdb-current-address (match-string 3 args)) |
805 ;; cover for auto-display output which comes *before* | 850 ;; cover for auto-display output which comes *before* |
806 ;; stopped annotation | 851 ;; stopped annotation |
807 (if (eq gdb-output-sink 'inferior) (setq gdb-output-sink 'user))) | 852 (if (eq gdb-output-sink 'inferior) (setq gdb-output-sink 'user))) |
808 | 853 |
848 | 893 |
849 (defun gdb-starting (ignored) | 894 (defun gdb-starting (ignored) |
850 "An annotation handler for `starting'. | 895 "An annotation handler for `starting'. |
851 This says that I/O for the subprocess is now the program being debugged, | 896 This says that I/O for the subprocess is now the program being debugged, |
852 not GDB." | 897 not GDB." |
898 (setq gdb-active-process t) | |
853 (let ((sink gdb-output-sink)) | 899 (let ((sink gdb-output-sink)) |
854 (cond | 900 (cond |
855 ((eq sink 'user) | 901 ((eq sink 'user) |
856 (progn | 902 (progn |
857 (setq gud-running t) | 903 (setq gud-running t) |
860 (t | 906 (t |
861 (gdb-resync) | 907 (gdb-resync) |
862 (error "Unexpected `starting' annotation"))))) | 908 (error "Unexpected `starting' annotation"))))) |
863 | 909 |
864 (defun gdb-stopping (ignored) | 910 (defun gdb-stopping (ignored) |
865 "An annotation handler for `exited' and other annotations. | 911 "An annotation handler for `breakpoint' and other annotations. |
866 They say that I/O for the subprocess is now GDB, not the program | 912 They say that I/O for the subprocess is now GDB, not the program |
867 being debugged." | 913 being debugged." |
868 (if gdb-use-inferior-io-buffer | 914 (if gdb-use-inferior-io-buffer |
869 (let ((sink gdb-output-sink)) | 915 (let ((sink gdb-output-sink)) |
870 (cond | 916 (cond |
872 (setq gdb-output-sink 'user)) | 918 (setq gdb-output-sink 'user)) |
873 (t | 919 (t |
874 (gdb-resync) | 920 (gdb-resync) |
875 (error "Unexpected stopping annotation")))))) | 921 (error "Unexpected stopping annotation")))))) |
876 | 922 |
923 (defun gdb-exited (ignored) | |
924 "An annotation handler for `exited' and `signalled'. | |
925 They say that I/O for the subprocess is now GDB, not the program | |
926 being debugged and that the program is no longer running. This | |
927 function is used to change the focus of GUD tooltips to #define | |
928 directives." | |
929 (setq gdb-active-process nil) | |
930 (gdb-stopping ignored)) | |
931 | |
877 (defun gdb-frame-begin (ignored) | 932 (defun gdb-frame-begin (ignored) |
878 (let ((sink gdb-output-sink)) | 933 (let ((sink gdb-output-sink)) |
879 (cond | 934 (cond |
880 ((eq sink 'inferior) | 935 ((eq sink 'inferior) |
881 (setq gdb-output-sink 'user)) | 936 (setq gdb-output-sink 'user)) |
979 (gdb-concat-output output | 1034 (gdb-concat-output output |
980 (substring gud-marker-acc 0 | 1035 (substring gud-marker-acc 0 |
981 (match-beginning 0)))) | 1036 (match-beginning 0)))) |
982 ;; | 1037 ;; |
983 ;; Everything after, we save, to combine with later input. | 1038 ;; Everything after, we save, to combine with later input. |
984 (setq gud-marker-acc (substring gud-marker-acc (match-beginning 0)))) | 1039 (setq gud-marker-acc (substring gud-marker-acc |
1040 (match-beginning 0)))) | |
985 ;; | 1041 ;; |
986 ;; In case we know the gud-marker-acc contains no partial annotations: | 1042 ;; In case we know the gud-marker-acc contains no partial annotations: |
987 (progn | 1043 (progn |
988 (setq output (gdb-concat-output output gud-marker-acc)) | 1044 (setq output (gdb-concat-output output gud-marker-acc)) |
989 (setq gud-marker-acc ""))) | 1045 (setq gud-marker-acc ""))) |
1043 ;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES | 1099 ;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES |
1044 ;; It adds an input for the command we are tracking. It should be the | 1100 ;; It adds an input for the command we are tracking. It should be the |
1045 ;; annotation rule binding of whatever gdb sends to tell us this command | 1101 ;; annotation rule binding of whatever gdb sends to tell us this command |
1046 ;; might have changed it's output. | 1102 ;; might have changed it's output. |
1047 ;; | 1103 ;; |
1048 ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed. | 1104 ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed. |
1049 ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the | 1105 ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the |
1050 ;; input in the input queue (see comment about ``gdb communications'' above). | 1106 ;; input in the input queue (see comment about ``gdb communications'' above). |
1051 | 1107 |
1052 (defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command | 1108 (defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command |
1053 output-handler) | 1109 output-handler) |
1075 'gdb-partial-output-buffer)) | 1131 'gdb-partial-output-buffer)) |
1076 (goto-char p))))) | 1132 (goto-char p))))) |
1077 ;; put customisation here | 1133 ;; put customisation here |
1078 (,custom-defun))) | 1134 (,custom-defun))) |
1079 | 1135 |
1080 (defmacro def-gdb-auto-updated-buffer (buffer-key trigger-name gdb-command | 1136 (defmacro def-gdb-auto-updated-buffer (buffer-key |
1081 output-handler-name custom-defun) | 1137 trigger-name gdb-command |
1138 output-handler-name custom-defun) | |
1082 `(progn | 1139 `(progn |
1083 (def-gdb-auto-update-trigger ,trigger-name | 1140 (def-gdb-auto-update-trigger ,trigger-name |
1084 ;; The demand predicate: | 1141 ;; The demand predicate: |
1085 (lambda () (gdb-get-buffer ',buffer-key)) | 1142 (lambda () (gdb-get-buffer ',buffer-key)) |
1086 ,gdb-command | 1143 ,gdb-command |
1223 (file (match-string 1))) | 1280 (file (match-string 1))) |
1224 (add-text-properties (point-at-bol) (point-at-eol) | 1281 (add-text-properties (point-at-bol) (point-at-eol) |
1225 '(mouse-face highlight | 1282 '(mouse-face highlight |
1226 help-echo "mouse-2, RET: visit breakpoint")) | 1283 help-echo "mouse-2, RET: visit breakpoint")) |
1227 (unless (file-exists-p file) | 1284 (unless (file-exists-p file) |
1228 (setq file (cdr (assoc bptno gdb-location-list)))) | 1285 (setq file (cdr (assoc bptno gdb-location-alist)))) |
1229 (unless (string-equal file "File not found") | 1286 (unless (string-equal file "File not found") |
1230 (if file | 1287 (if file |
1231 (with-current-buffer (find-file-noselect file) | 1288 (with-current-buffer (find-file-noselect file) |
1232 (set (make-local-variable 'gud-minor-mode) | 1289 (set (make-local-variable 'gud-minor-mode) |
1233 'gdba) | 1290 'gdba) |
1234 (set (make-local-variable 'tool-bar-map) | 1291 (set (make-local-variable 'tool-bar-map) |
1235 gud-tool-bar-map) | 1292 gud-tool-bar-map) |
1236 ;; only want one breakpoint icon at each location | 1293 ;; only want one breakpoint icon at each |
1294 ;; location | |
1237 (save-excursion | 1295 (save-excursion |
1238 (goto-line (string-to-number line)) | 1296 (goto-line (string-to-number line)) |
1239 (gdb-put-breakpoint-icon (eq flag ?y) bptno))) | 1297 (gdb-put-breakpoint-icon (eq flag ?y) bptno))) |
1240 (gdb-enqueue-input | 1298 (gdb-enqueue-input |
1241 (list (concat "list " | 1299 (list |
1242 (match-string-no-properties 1) ":1\n") | 1300 (concat "list " |
1301 (match-string-no-properties 1) ":1\n") | |
1243 'ignore)) | 1302 'ignore)) |
1244 (gdb-enqueue-input | 1303 (gdb-enqueue-input |
1245 (list "info source\n" | 1304 (list "info source\n" |
1246 `(lambda () (gdb-get-location | 1305 `(lambda () (gdb-get-location |
1247 ,bptno ,line ,flag))))))))))) | 1306 ,bptno ,line ,flag))))))))))) |
1349 (save-excursion | 1408 (save-excursion |
1350 (beginning-of-line 1) | 1409 (beginning-of-line 1) |
1351 (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 1410 (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
1352 (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)") | 1411 (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)") |
1353 (looking-at | 1412 (looking-at |
1354 "\\([0-9]+\\)\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*\\S-*\\s-*\\S-*:[0-9]+")) | 1413 "\\([0-9]+\\)\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*\\S-*\\s-*\\S-*:[0-9]+")) |
1355 (gdb-enqueue-input | 1414 (gdb-enqueue-input |
1356 (list | 1415 (list |
1357 (concat gdb-server-prefix | 1416 (concat gdb-server-prefix |
1358 (if (eq ?y (char-after (match-beginning 2))) | 1417 (if (eq ?y (char-after (match-beginning 2))) |
1359 "disable " | 1418 "disable " |
1381 (save-excursion | 1440 (save-excursion |
1382 (beginning-of-line 1) | 1441 (beginning-of-line 1) |
1383 (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 1442 (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) |
1384 (looking-at "\\([0-9]+\\) .* in .* at\\s-+\\(\\S-*\\):\\([0-9]+\\)") | 1443 (looking-at "\\([0-9]+\\) .* in .* at\\s-+\\(\\S-*\\):\\([0-9]+\\)") |
1385 (looking-at | 1444 (looking-at |
1386 "\\([0-9]+\\)\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\\(\\S-*\\):\\([0-9]+\\)")) | 1445 "\\([0-9]+\\)\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\ |
1446 \\(\\S-*\\):\\([0-9]+\\)")) | |
1387 (let ((bptno (match-string 1)) | 1447 (let ((bptno (match-string 1)) |
1388 (file (match-string 2)) | 1448 (file (match-string 2)) |
1389 (line (match-string 3))) | 1449 (line (match-string 3))) |
1390 (save-selected-window | 1450 (save-selected-window |
1391 (let* ((buf (find-file-noselect | 1451 (let* ((buf (find-file-noselect |
1392 (if (file-exists-p file) file | 1452 (if (file-exists-p file) file |
1393 (cdr (assoc bptno gdb-location-list))))) | 1453 (cdr (assoc bptno gdb-location-alist))))) |
1394 (window (display-buffer buf))) | 1454 (window (display-buffer buf))) |
1395 (with-current-buffer buf | 1455 (with-current-buffer buf |
1396 (goto-line (string-to-number line)) | 1456 (goto-line (string-to-number line)) |
1397 (set-window-point window (point)))))) | 1457 (set-window-point window (point)))))) |
1398 (error "Not recognized as break/watchpoint line")))) | 1458 (error "Not recognized as break/watchpoint line")))) |
1479 (defun gdb-frames-select (&optional event) | 1539 (defun gdb-frames-select (&optional event) |
1480 "Select the frame and display the relevant source." | 1540 "Select the frame and display the relevant source." |
1481 (interactive (list last-input-event)) | 1541 (interactive (list last-input-event)) |
1482 (if event (mouse-set-point event)) | 1542 (if event (mouse-set-point event)) |
1483 (gdb-enqueue-input | 1543 (gdb-enqueue-input |
1484 (list (concat gdb-server-prefix "frame " (gdb-get-frame-number) "\n") 'ignore)) | 1544 (list (concat gdb-server-prefix "frame " |
1545 (gdb-get-frame-number) "\n") 'ignore)) | |
1485 (gud-display-frame)) | 1546 (gud-display-frame)) |
1486 | 1547 |
1487 | 1548 |
1488 ;; Threads buffer. This displays a selectable thread list. | 1549 ;; Threads buffer. This displays a selectable thread list. |
1489 ;; | 1550 ;; |
1666 "Set the number of data items in memory window." | 1727 "Set the number of data items in memory window." |
1667 (interactive "e") | 1728 (interactive "e") |
1668 (save-selected-window | 1729 (save-selected-window |
1669 (select-window (posn-window (event-start event))) | 1730 (select-window (posn-window (event-start event))) |
1670 (let* ((arg (read-from-minibuffer "Repeat count: ")) | 1731 (let* ((arg (read-from-minibuffer "Repeat count: ")) |
1671 (count (string-to-int arg))) | 1732 (count (string-to-number arg))) |
1672 (if (< count 0) | 1733 (if (< count 0) |
1673 (error "Non-negative numbers only") | 1734 (error "Non-negative numbers only") |
1674 (customize-set-variable 'gdb-memory-repeat-count count) | 1735 (customize-set-variable 'gdb-memory-repeat-count count) |
1675 (gdb-invalidate-memory))))) | 1736 (gdb-invalidate-memory))))) |
1676 | 1737 |
1974 | 2035 |
1975 ;;; Shared keymap initialization: | 2036 ;;; Shared keymap initialization: |
1976 | 2037 |
1977 (let ((menu (make-sparse-keymap "GDB-Windows"))) | 2038 (let ((menu (make-sparse-keymap "GDB-Windows"))) |
1978 (define-key gud-menu-map [displays] | 2039 (define-key gud-menu-map [displays] |
1979 `(menu-item "GDB-Windows" ,menu :visible (eq gud-minor-mode 'gdba))) | 2040 `(menu-item "GDB-Windows" ,menu |
2041 :visible (memq gud-minor-mode '(gdbmi gdba)))) | |
1980 (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer)) | 2042 (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer)) |
1981 (define-key menu [threads] '("Threads" . gdb-display-threads-buffer)) | 2043 (define-key menu [threads] '("Threads" . gdb-display-threads-buffer)) |
1982 (define-key menu [memory] '("Memory" . gdb-display-memory-buffer)) | 2044 (define-key menu [memory] '("Memory" . gdb-display-memory-buffer)) |
1983 (define-key menu [assembler] '("Machine" . gdb-display-assembler-buffer)) | 2045 (define-key menu [assembler] '("Machine" . gdb-display-assembler-buffer)) |
1984 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) | 2046 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) |
1985 (define-key menu [inferior] | 2047 (define-key menu [inferior] |
1986 '(menu-item "Inferior IO" gdb-display-inferior-io-buffer | 2048 '(menu-item "Inferior IO" gdb-display-inferior-io-buffer |
1987 :enable gdb-use-inferior-io-buffer)) | 2049 :enable gdb-use-inferior-io-buffer)) |
1988 (define-key menu [locals] '("Locals" . gdb-display-locals-buffer)) | 2050 (define-key menu [locals] '("Locals" . gdb-display-locals-buffer)) |
1989 (define-key menu [frames] '("Stack" . gdb-display-stack-buffer)) | 2051 (define-key menu [frames] '("Stack" . gdb-display-stack-buffer)) |
1990 (define-key menu [breakpoints] '("Breakpoints" . gdb-display-breakpoints-buffer))) | 2052 (define-key menu [breakpoints] |
2053 '("Breakpoints" . gdb-display-breakpoints-buffer))) | |
1991 | 2054 |
1992 (let ((menu (make-sparse-keymap "GDB-Frames"))) | 2055 (let ((menu (make-sparse-keymap "GDB-Frames"))) |
1993 (define-key gud-menu-map [frames] | 2056 (define-key gud-menu-map [frames] |
1994 `(menu-item "GDB-Frames" ,menu :visible (eq gud-minor-mode 'gdba))) | 2057 `(menu-item "GDB-Frames" ,menu |
2058 :visible (memq gud-minor-mode '(gdbmi gdba)))) | |
1995 (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer)) | 2059 (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer)) |
1996 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) | 2060 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) |
1997 (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer)) | 2061 (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer)) |
1998 (define-key menu [assembler] '("Machine" . gdb-frame-assembler-buffer)) | 2062 (define-key menu [assembler] '("Machine" . gdb-frame-assembler-buffer)) |
1999 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer)) | 2063 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer)) |
2000 (define-key menu [inferior] | 2064 (define-key menu [inferior] |
2001 '(menu-item "Inferior IO" gdb-frame-inferior-io-buffer | 2065 '(menu-item "Inferior IO" gdb-frame-inferior-io-buffer |
2002 :enable gdb-use-inferior-io-buffer)) | 2066 :enable gdb-use-inferior-io-buffer)) |
2003 (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer)) | 2067 (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer)) |
2004 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer)) | 2068 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer)) |
2005 (define-key menu [breakpoints] '("Breakpoints" . gdb-frame-breakpoints-buffer))) | 2069 (define-key menu [breakpoints] |
2070 '("Breakpoints" . gdb-frame-breakpoints-buffer))) | |
2006 | 2071 |
2007 (let ((menu (make-sparse-keymap "GDB-UI"))) | 2072 (let ((menu (make-sparse-keymap "GDB-UI"))) |
2008 (define-key gud-menu-map [ui] | 2073 (define-key gud-menu-map [ui] |
2009 `(menu-item "GDB-UI" ,menu :visible (eq gud-minor-mode 'gdba))) | 2074 `(menu-item "GDB-UI" ,menu :visible (eq gud-minor-mode 'gdba))) |
2010 (define-key menu [gdb-restore-windows] | 2075 (define-key menu [gdb-restore-windows] |
2127 (if (string-match "\\`\\*.+\\*\\'" (buffer-name)) | 2192 (if (string-match "\\`\\*.+\\*\\'" (buffer-name)) |
2128 (kill-buffer nil) | 2193 (kill-buffer nil) |
2129 (gdb-remove-breakpoint-icons (point-min) (point-max) t) | 2194 (gdb-remove-breakpoint-icons (point-min) (point-max) t) |
2130 (setq gud-minor-mode nil) | 2195 (setq gud-minor-mode nil) |
2131 (kill-local-variable 'tool-bar-map) | 2196 (kill-local-variable 'tool-bar-map) |
2132 (setq gud-running nil)))))) | 2197 (kill-local-variable 'gdb-define-alist)))))) |
2133 (when (markerp gdb-overlay-arrow-position) | 2198 (when (markerp gdb-overlay-arrow-position) |
2134 (move-marker gdb-overlay-arrow-position nil) | 2199 (move-marker gdb-overlay-arrow-position nil) |
2135 (setq gdb-overlay-arrow-position nil)) | 2200 (setq gdb-overlay-arrow-position nil)) |
2136 (setq overlay-arrow-variable-list | 2201 (setq overlay-arrow-variable-list |
2137 (delq 'gdb-overlay-arrow-position overlay-arrow-variable-list))) | 2202 (delq 'gdb-overlay-arrow-position overlay-arrow-variable-list)) |
2203 (setq gud-running nil) | |
2204 (setq gdb-active-process nil) | |
2205 (remove-hook 'after-save-hook 'gdb-create-define-alist t)) | |
2138 | 2206 |
2139 (defun gdb-source-info () | 2207 (defun gdb-source-info () |
2140 "Find the source file where the program starts and displays it with related | 2208 "Find the source file where the program starts and displays it with related |
2141 buffers." | 2209 buffers." |
2142 (goto-char (point-min)) | 2210 (goto-char (point-min)) |
2155 Put in buffer and place breakpoint icon." | 2223 Put in buffer and place breakpoint icon." |
2156 (goto-char (point-min)) | 2224 (goto-char (point-min)) |
2157 (catch 'file-not-found | 2225 (catch 'file-not-found |
2158 (if (search-forward "Located in " nil t) | 2226 (if (search-forward "Located in " nil t) |
2159 (if (looking-at "\\S-*") | 2227 (if (looking-at "\\S-*") |
2160 (push (cons bptno (match-string 0)) gdb-location-list)) | 2228 (push (cons bptno (match-string 0)) gdb-location-alist)) |
2161 (gdb-resync) | 2229 (gdb-resync) |
2162 (push (cons bptno "File not found") gdb-location-list) | 2230 (push (cons bptno "File not found") gdb-location-alist) |
2163 (message-box "Cannot find source file for breakpoint location.\n\ | 2231 (message-box "Cannot find source file for breakpoint location.\n\ |
2164 Add directory to search path for source files using the GDB command, dir.") | 2232 Add directory to search path for source files using the GDB command, dir.") |
2165 (throw 'file-not-found nil)) | 2233 (throw 'file-not-found nil)) |
2166 (with-current-buffer | 2234 (with-current-buffer |
2167 (find-file-noselect (match-string 0)) | 2235 (find-file-noselect (match-string 0)) |
2212 Remove only strings that were put in BUFFER with calls to `gdb-put-string'. | 2280 Remove only strings that were put in BUFFER with calls to `gdb-put-string'. |
2213 BUFFER nil or omitted means use the current buffer." | 2281 BUFFER nil or omitted means use the current buffer." |
2214 (unless buffer | 2282 (unless buffer |
2215 (setq buffer (current-buffer))) | 2283 (setq buffer (current-buffer))) |
2216 (dolist (overlay (overlays-in start end)) | 2284 (dolist (overlay (overlays-in start end)) |
2217 (when (overlay-get overlay 'put-break) | 2285 (when (overlay-get overlay 'put-break) |
2218 (delete-overlay overlay)))) | 2286 (delete-overlay overlay)))) |
2219 | 2287 |
2220 (defun gdb-put-breakpoint-icon (enabled bptno) | 2288 (defun gdb-put-breakpoint-icon (enabled bptno) |
2221 (let ((start (progn (beginning-of-line) (- (point) 1))) | 2289 (let ((start (progn (beginning-of-line) (- (point) 1))) |
2222 (end (progn (end-of-line) (+ (point) 1))) | 2290 (end (progn (end-of-line) (+ (point) 1))) |
2414 (dolist (item queue) | 2482 (dolist (item queue) |
2415 (if (equal (cdr item) '(gdb-assembler-handler)) | 2483 (if (equal (cdr item) '(gdb-assembler-handler)) |
2416 (setq gdb-input-queue | 2484 (setq gdb-input-queue |
2417 (delete item gdb-input-queue)))))) | 2485 (delete item gdb-input-queue)))))) |
2418 (gdb-enqueue-input | 2486 (gdb-enqueue-input |
2419 (list (concat gdb-server-prefix "disassemble " gdb-current-address "\n") | 2487 (list (concat gdb-server-prefix "disassemble " |
2488 gdb-current-address "\n") | |
2420 'gdb-assembler-handler)) | 2489 'gdb-assembler-handler)) |
2421 (push 'gdb-invalidate-assembler gdb-pending-triggers) | 2490 (push 'gdb-invalidate-assembler gdb-pending-triggers) |
2422 (setq gdb-previous-address gdb-current-address) | 2491 (setq gdb-previous-address gdb-current-address) |
2423 (setq gdb-previous-frame gdb-current-frame))))))) | 2492 (setq gdb-previous-frame gdb-current-frame))))))) |
2424 | 2493 |