diff options
| author | Nick Roberts | 2002-12-29 20:46:41 +0000 |
|---|---|---|
| committer | Nick Roberts | 2002-12-29 20:46:41 +0000 |
| commit | 5c39e45a0c39044bb781befe4e3e0b3d2e9b65ec (patch) | |
| tree | a939b55ff31bd2bf6dc3d05ed76a05f97ff016cb | |
| parent | d6251dd2a2552795b94c907983388ac0a57d30cf (diff) | |
| download | emacs-5c39e45a0c39044bb781befe4e3e0b3d2e9b65ec.tar.gz emacs-5c39e45a0c39044bb781befe4e3e0b3d2e9b65ec.zip | |
(gdb-delete-display): Rename (gdb-delete-expression).
(gdb-goto-bp-this-line): Rename (gdb-goto-breakpoint).
(gdb-toggle-bp-this-line): Rename (gdb-toggle-breakpoint).
(gdb-delete-bp-this-line): Rename (gdb-delete-breakpoint).
(gdb-toggle-disp-this-line): Rename (gdb-toggle-display).
(gdb-delete-disp-this-line): Rename (gdb-delete-display).
(gud-gdba-marker-filter): Remove unnecessary save-match-data.
(gdb-mouse-goto-breakpoint, gdb-frames-select): New functions.
(gdb-frames-mouse-select): Simplify.
Make keybindings (gdb-goto-breakpoint, gdb-frames-select, etc)
consistent with other modes in emacs.
(gdb-display-source-buffer): Return window of source buffer
for (gud-display-line).
| -rw-r--r-- | lisp/gdb-ui.el | 211 |
1 files changed, 109 insertions, 102 deletions
diff --git a/lisp/gdb-ui.el b/lisp/gdb-ui.el index 5ee9455ce14..0e7c7ba1301 100644 --- a/lisp/gdb-ui.el +++ b/lisp/gdb-ui.el | |||
| @@ -47,6 +47,10 @@ | |||
| 47 | (defvar gdb-current-address nil) | 47 | (defvar gdb-current-address nil) |
| 48 | (defvar gdb-display-in-progress nil) | 48 | (defvar gdb-display-in-progress nil) |
| 49 | (defvar gdb-dive nil) | 49 | (defvar gdb-dive nil) |
| 50 | (defvar gdb-buffer-type nil) | ||
| 51 | (defvar gdb-variables '() | ||
| 52 | "A list of variables that are local to the GUD buffer.") | ||
| 53 | |||
| 50 | 54 | ||
| 51 | ;;;###autoload | 55 | ;;;###autoload |
| 52 | (defun gdba (command-line) | 56 | (defun gdba (command-line) |
| @@ -76,9 +80,9 @@ Source buffer | Input/Output (of debuggee) buffer | |||
| 76 | | | 80 | | |
| 77 | --------------------------------------------------------------------- | 81 | --------------------------------------------------------------------- |
| 78 | Stack buffer | Breakpoints buffer | 82 | Stack buffer | Breakpoints buffer |
| 79 | \[mouse-2\] gdb-frames-mouse-select | SPC gdb-toggle-bp-this-line | 83 | RET gdb-frames-select | SPC gdb-toggle-breakpoint |
| 80 | | g gdb-goto-bp-this-line | 84 | | RET gdb-goto-breakpoint |
| 81 | | d gdb-delete-bp-this-line | 85 | | d gdb-delete-breakpoint |
| 82 | --------------------------------------------------------------------- | 86 | --------------------------------------------------------------------- |
| 83 | 87 | ||
| 84 | All the buffers share the toolbar and source should always display in the same | 88 | All the buffers share the toolbar and source should always display in the same |
| @@ -174,9 +178,6 @@ The following interactive lisp functions help control operation : | |||
| 174 | ;; The list of variables is built up by the expansions of | 178 | ;; The list of variables is built up by the expansions of |
| 175 | ;; def-gdb-variable | 179 | ;; def-gdb-variable |
| 176 | 180 | ||
| 177 | (defvar gdb-variables '() | ||
| 178 | "A list of variables that are local to the GUD buffer.") | ||
| 179 | |||
| 180 | (defmacro def-gdb-var (root-symbol &optional default doc) | 181 | (defmacro def-gdb-var (root-symbol &optional default doc) |
| 181 | (let* ((root (symbol-name root-symbol)) | 182 | (let* ((root (symbol-name root-symbol)) |
| 182 | (accessor (intern (concat "gdb-get-" root))) | 183 | (accessor (intern (concat "gdb-get-" root))) |
| @@ -1043,64 +1044,63 @@ output from the current command if that happens to be appropriate." | |||
| 1043 | 1044 | ||
| 1044 | (defun gud-gdba-marker-filter (string) | 1045 | (defun gud-gdba-marker-filter (string) |
| 1045 | "A gud marker filter for gdb. Handle a burst of output from GDB." | 1046 | "A gud marker filter for gdb. Handle a burst of output from GDB." |
| 1046 | (save-match-data | 1047 | (let ( |
| 1047 | (let ( | 1048 | ;; Recall the left over burst from last time |
| 1048 | ;; Recall the left over burst from last time | 1049 | (burst (concat (gdb-get-burst) string)) |
| 1049 | (burst (concat (gdb-get-burst) string)) | 1050 | ;; Start accumulating output for the GUD buffer |
| 1050 | ;; Start accumulating output for the GUD buffer | 1051 | (output "")) |
| 1051 | (output "")) | 1052 | ;; |
| 1052 | ;; | 1053 | ;; Process all the complete markers in this chunk. |
| 1053 | ;; Process all the complete markers in this chunk. | 1054 | (while (string-match "\n\032\032\\(.*\\)\n" burst) |
| 1054 | (while (string-match "\n\032\032\\(.*\\)\n" burst) | 1055 | (let ((annotation (match-string 1 burst))) |
| 1055 | (let ((annotation (match-string 1 burst))) | 1056 | ;; |
| 1056 | ;; | 1057 | ;; Stuff prior to the match is just ordinary output. |
| 1057 | ;; Stuff prior to the match is just ordinary output. | 1058 | ;; It is either concatenated to OUTPUT or directed |
| 1058 | ;; It is either concatenated to OUTPUT or directed | 1059 | ;; elsewhere. |
| 1059 | ;; elsewhere. | 1060 | (setq output |
| 1060 | (setq output | 1061 | (gdb-concat-output |
| 1061 | (gdb-concat-output | 1062 | output |
| 1062 | output | 1063 | (substring burst 0 (match-beginning 0)))) |
| 1063 | (substring burst 0 (match-beginning 0)))) | 1064 | |
| 1064 | 1065 | ;; Take that stuff off the burst. | |
| 1065 | ;; Take that stuff off the burst. | 1066 | (setq burst (substring burst (match-end 0))) |
| 1066 | (setq burst (substring burst (match-end 0))) | 1067 | |
| 1067 | 1068 | ;; Parse the tag from the annotation, and maybe its arguments. | |
| 1068 | ;; Parse the tag from the annotation, and maybe its arguments. | 1069 | (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation) |
| 1069 | (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation) | 1070 | (let* ((annotation-type (match-string 1 annotation)) |
| 1070 | (let* ((annotation-type (match-string 1 annotation)) | 1071 | (annotation-arguments (match-string 2 annotation)) |
| 1071 | (annotation-arguments (match-string 2 annotation)) | 1072 | (annotation-rule (assoc annotation-type |
| 1072 | (annotation-rule (assoc annotation-type | 1073 | gdb-annotation-rules))) |
| 1073 | gdb-annotation-rules))) | 1074 | ;; Call the handler for this annotation. |
| 1074 | ;; Call the handler for this annotation. | 1075 | (if annotation-rule |
| 1075 | (if annotation-rule | 1076 | (funcall (car (cdr annotation-rule)) |
| 1076 | (funcall (car (cdr annotation-rule)) | 1077 | annotation-arguments) |
| 1077 | annotation-arguments) | 1078 | ;; Else the annotation is not recognized. Ignore it silently, |
| 1078 | ;; Else the annotation is not recognized. Ignore it silently, | 1079 | ;; so that GDB can add new annotations without causing |
| 1079 | ;; so that GDB can add new annotations without causing | 1080 | ;; us to blow up. |
| 1080 | ;; us to blow up. | 1081 | )))) |
| 1081 | )))) | 1082 | ;; |
| 1082 | ;; | 1083 | ;; Does the remaining text end in a partial line? |
| 1083 | ;; Does the remaining text end in a partial line? | 1084 | ;; If it does, then keep part of the burst until we get more. |
| 1084 | ;; If it does, then keep part of the burst until we get more. | 1085 | (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'" |
| 1085 | (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'" | 1086 | burst) |
| 1086 | burst) | ||
| 1087 | (progn | ||
| 1088 | ;; Everything before the potential marker start can be output. | ||
| 1089 | (setq output | ||
| 1090 | (gdb-concat-output output | ||
| 1091 | (substring burst 0 (match-beginning 0)))) | ||
| 1092 | ;; | ||
| 1093 | ;; Everything after, we save, to combine with later input. | ||
| 1094 | (setq burst (substring burst (match-beginning 0)))) | ||
| 1095 | ;; | ||
| 1096 | ;; In case we know the burst contains no partial annotations: | ||
| 1097 | (progn | 1087 | (progn |
| 1098 | (setq output (gdb-concat-output output burst)) | 1088 | ;; Everything before the potential marker start can be output. |
| 1099 | (setq burst ""))) | 1089 | (setq output |
| 1090 | (gdb-concat-output output | ||
| 1091 | (substring burst 0 (match-beginning 0)))) | ||
| 1092 | ;; | ||
| 1093 | ;; Everything after, we save, to combine with later input. | ||
| 1094 | (setq burst (substring burst (match-beginning 0)))) | ||
| 1100 | ;; | 1095 | ;; |
| 1101 | ;; Save the remaining burst for the next call to this function. | 1096 | ;; In case we know the burst contains no partial annotations: |
| 1102 | (gdb-set-burst burst) | 1097 | (progn |
| 1103 | output))) | 1098 | (setq output (gdb-concat-output output burst)) |
| 1099 | (setq burst ""))) | ||
| 1100 | ;; | ||
| 1101 | ;; Save the remaining burst for the next call to this function. | ||
| 1102 | (gdb-set-burst burst) | ||
| 1103 | output)) | ||
| 1104 | 1104 | ||
| 1105 | (defun gdb-concat-output (so-far new) | 1105 | (defun gdb-concat-output (so-far new) |
| 1106 | (let ((sink (gdb-get-output-sink ))) | 1106 | (let ((sink (gdb-get-output-sink ))) |
| @@ -1327,15 +1327,16 @@ output from the current command if that happens to be appropriate." | |||
| 1327 | (defvar gdb-breakpoints-mode-map | 1327 | (defvar gdb-breakpoints-mode-map |
| 1328 | (let ((map (make-sparse-keymap)) | 1328 | (let ((map (make-sparse-keymap)) |
| 1329 | (menu (make-sparse-keymap "Breakpoints"))) | 1329 | (menu (make-sparse-keymap "Breakpoints"))) |
| 1330 | (define-key menu [toggle] '("Toggle" . gdb-toggle-bp-this-line)) | 1330 | (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint)) |
| 1331 | (define-key menu [delete] '("Delete" . gdb-delete-bp-this-line)) | 1331 | (define-key menu [delete] '("Delete" . gdb-delete-breakpoint)) |
| 1332 | (define-key menu [goto] '("Goto" . gdb-goto-bp-this-line)) | 1332 | (define-key menu [goto] '("Goto" . gdb-goto-breakpoint)) |
| 1333 | 1333 | ||
| 1334 | (suppress-keymap map) | 1334 | (suppress-keymap map) |
| 1335 | (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu)) | 1335 | (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu)) |
| 1336 | (define-key map " " 'gdb-toggle-bp-this-line) | 1336 | (define-key map " " 'gdb-toggle-breakpoint) |
| 1337 | (define-key map "d" 'gdb-delete-bp-this-line) | 1337 | (define-key map "d" 'gdb-delete-breakpoint) |
| 1338 | (define-key map "g" 'gdb-goto-bp-this-line) | 1338 | (define-key map "\r" 'gdb-goto-breakpoint) |
| 1339 | (define-key map [mouse-2] 'gdb-mouse-goto-breakpoint) | ||
| 1339 | map)) | 1340 | map)) |
| 1340 | 1341 | ||
| 1341 | (defun gdb-breakpoints-mode () | 1342 | (defun gdb-breakpoints-mode () |
| @@ -1348,8 +1349,8 @@ output from the current command if that happens to be appropriate." | |||
| 1348 | (setq buffer-read-only t) | 1349 | (setq buffer-read-only t) |
| 1349 | (gdb-invalidate-breakpoints)) | 1350 | (gdb-invalidate-breakpoints)) |
| 1350 | 1351 | ||
| 1351 | (defun gdb-toggle-bp-this-line () | 1352 | (defun gdb-toggle-breakpoint () |
| 1352 | "Enable/disable the breakpoint of the current line." | 1353 | "Enable/disable the breakpoint at current line." |
| 1353 | (interactive) | 1354 | (interactive) |
| 1354 | (save-excursion | 1355 | (save-excursion |
| 1355 | (beginning-of-line 1) | 1356 | (beginning-of-line 1) |
| @@ -1364,8 +1365,8 @@ output from the current command if that happens to be appropriate." | |||
| 1364 | (match-string 1) "\n") | 1365 | (match-string 1) "\n") |
| 1365 | 'ignore))))) | 1366 | 'ignore))))) |
| 1366 | 1367 | ||
| 1367 | (defun gdb-delete-bp-this-line () | 1368 | (defun gdb-delete-breakpoint () |
| 1368 | "Delete the breakpoint of the current line." | 1369 | "Delete the breakpoint at current line." |
| 1369 | (interactive) | 1370 | (interactive) |
| 1370 | (beginning-of-line 1) | 1371 | (beginning-of-line 1) |
| 1371 | (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)")) | 1372 | (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)")) |
| @@ -1375,8 +1376,9 @@ output from the current command if that happens to be appropriate." | |||
| 1375 | 1376 | ||
| 1376 | (defvar gdb-source-window nil) | 1377 | (defvar gdb-source-window nil) |
| 1377 | 1378 | ||
| 1378 | (defun gdb-goto-bp-this-line () | 1379 | (defun gdb-goto-breakpoint () |
| 1379 | "Display the file in the source buffer at the specified breakpoint." | 1380 | "Display the file in the source buffer at the breakpoint specified on the |
| 1381 | current line." | ||
| 1380 | (interactive) | 1382 | (interactive) |
| 1381 | (save-excursion | 1383 | (save-excursion |
| 1382 | (beginning-of-line 1) | 1384 | (beginning-of-line 1) |
| @@ -1392,6 +1394,12 @@ output from the current command if that happens to be appropriate." | |||
| 1392 | file | 1394 | file |
| 1393 | (expand-file-name file gdb-cdir)))) | 1395 | (expand-file-name file gdb-cdir)))) |
| 1394 | (goto-line (string-to-number line)))))) | 1396 | (goto-line (string-to-number line)))))) |
| 1397 | |||
| 1398 | (defun gdb-mouse-goto-breakpoint (event) | ||
| 1399 | "Display the file in the source buffer at the selected breakpoint." | ||
| 1400 | (interactive "e") | ||
| 1401 | (mouse-set-point event) | ||
| 1402 | (gdb-goto-breakpoint)) | ||
| 1395 | 1403 | ||
| 1396 | ;; | 1404 | ;; |
| 1397 | ;; Frames buffer. This displays a perpetually correct bactracktrace | 1405 | ;; Frames buffer. This displays a perpetually correct bactracktrace |
| @@ -1437,6 +1445,7 @@ output from the current command if that happens to be appropriate." | |||
| 1437 | (defvar gdb-frames-mode-map | 1445 | (defvar gdb-frames-mode-map |
| 1438 | (let ((map (make-sparse-keymap))) | 1446 | (let ((map (make-sparse-keymap))) |
| 1439 | (suppress-keymap map) | 1447 | (suppress-keymap map) |
| 1448 | (define-key map "\r" 'gdb-frames-select) | ||
| 1440 | (define-key map [mouse-2] 'gdb-frames-mouse-select) | 1449 | (define-key map [mouse-2] 'gdb-frames-mouse-select) |
| 1441 | map)) | 1450 | map)) |
| 1442 | 1451 | ||
| @@ -1453,26 +1462,23 @@ output from the current command if that happens to be appropriate." | |||
| 1453 | (defun gdb-get-frame-number () | 1462 | (defun gdb-get-frame-number () |
| 1454 | (save-excursion | 1463 | (save-excursion |
| 1455 | (let* ((pos (re-search-backward "^#\\([0-9]*\\)" nil t)) | 1464 | (let* ((pos (re-search-backward "^#\\([0-9]*\\)" nil t)) |
| 1456 | (n (or (and pos (string-to-int (match-string 1))) 0))) | 1465 | (n (or (and pos (match-string-no-properties 1)) "0"))) |
| 1457 | n))) | 1466 | n))) |
| 1458 | 1467 | ||
| 1459 | (defun gdb-frames-mouse-select (e) | 1468 | (defun gdb-frames-select () |
| 1460 | "Make the selected frame become the current frame and | 1469 | "Make the frame on the current line become the current frame and display the |
| 1461 | display the source in the source buffer." | 1470 | source in the source buffer." |
| 1462 | (interactive "e") | 1471 | (interactive) |
| 1463 | (let (selection) | 1472 | (gdb-enqueue-input |
| 1464 | (save-excursion | 1473 | (list (concat "server frame " (gdb-get-frame-number) "\n") 'ignore)) |
| 1465 | (set-buffer (window-buffer (posn-window (event-end e)))) | 1474 | (gud-display-frame)) |
| 1466 | (save-excursion | ||
| 1467 | (goto-char (posn-point (event-end e))) | ||
| 1468 | (setq selection (gdb-get-frame-number)))) | ||
| 1469 | (select-window (posn-window (event-end e))) | ||
| 1470 | (save-excursion | ||
| 1471 | (set-buffer gud-comint-buffer) | ||
| 1472 | (gdb-enqueue-input | ||
| 1473 | (list (gud-format-command "server frame %p\n" selection) 'ignore)) | ||
| 1474 | (gud-display-frame)))) | ||
| 1475 | 1475 | ||
| 1476 | (defun gdb-frames-mouse-select (event) | ||
| 1477 | "Make the selected frame become the current frame and display the source in | ||
| 1478 | the source buffer." | ||
| 1479 | (interactive "e") | ||
| 1480 | (mouse-set-point event) | ||
| 1481 | (gdb-frames-select)) | ||
| 1476 | 1482 | ||
| 1477 | ;; | 1483 | ;; |
| 1478 | ;; Registers buffer. | 1484 | ;; Registers buffer. |
| @@ -1639,13 +1645,13 @@ display the source in the source buffer." | |||
| 1639 | (defvar gdb-display-mode-map | 1645 | (defvar gdb-display-mode-map |
| 1640 | (let ((map (make-sparse-keymap)) | 1646 | (let ((map (make-sparse-keymap)) |
| 1641 | (menu (make-sparse-keymap "Display"))) | 1647 | (menu (make-sparse-keymap "Display"))) |
| 1642 | (define-key menu [toggle] '("Toggle" . gdb-toggle-disp-this-line)) | 1648 | (define-key menu [toggle] '("Toggle" . gdb-toggle-display)) |
| 1643 | (define-key menu [delete] '("Delete" . gdb-delete-disp-this-line)) | 1649 | (define-key menu [delete] '("Delete" . gdb-delete-display)) |
| 1644 | 1650 | ||
| 1645 | (suppress-keymap map) | 1651 | (suppress-keymap map) |
| 1646 | (define-key map [menu-bar display] (cons "Display" menu)) | 1652 | (define-key map [menu-bar display] (cons "Display" menu)) |
| 1647 | (define-key map " " 'gdb-toggle-disp-this-line) | 1653 | (define-key map " " 'gdb-toggle-display) |
| 1648 | (define-key map "d" 'gdb-delete-disp-this-line) | 1654 | (define-key map "d" 'gdb-delete-display) |
| 1649 | map)) | 1655 | map)) |
| 1650 | 1656 | ||
| 1651 | (defun gdb-display-mode () | 1657 | (defun gdb-display-mode () |
| @@ -1672,8 +1678,8 @@ display the source in the source buffer." | |||
| 1672 | (switch-to-buffer-other-frame | 1678 | (switch-to-buffer-other-frame |
| 1673 | (gdb-get-create-buffer 'gdb-display-buffer))) | 1679 | (gdb-get-create-buffer 'gdb-display-buffer))) |
| 1674 | 1680 | ||
| 1675 | (defun gdb-toggle-disp-this-line () | 1681 | (defun gdb-toggle-display () |
| 1676 | "Enable/disable the displayed expression of the current line." | 1682 | "Enable/disable the displayed expression at current line." |
| 1677 | (interactive) | 1683 | (interactive) |
| 1678 | (save-excursion | 1684 | (save-excursion |
| 1679 | (beginning-of-line 1) | 1685 | (beginning-of-line 1) |
| @@ -1688,8 +1694,8 @@ display the source in the source buffer." | |||
| 1688 | (match-string 1) "\n") | 1694 | (match-string 1) "\n") |
| 1689 | 'ignore))))) | 1695 | 'ignore))))) |
| 1690 | 1696 | ||
| 1691 | (defun gdb-delete-disp-this-line () | 1697 | (defun gdb-delete-display () |
| 1692 | "Delete the displayed expression of the current line." | 1698 | "Delete the displayed expression at current line." |
| 1693 | (interactive) | 1699 | (interactive) |
| 1694 | (save-excursion | 1700 | (save-excursion |
| 1695 | (set-buffer | 1701 | (set-buffer |
| @@ -1713,7 +1719,7 @@ display the source in the source buffer." | |||
| 1713 | '("GDB Expressions Commands" | 1719 | '("GDB Expressions Commands" |
| 1714 | "----" | 1720 | "----" |
| 1715 | ["Visualise" gdb-array-visualise t] | 1721 | ["Visualise" gdb-array-visualise t] |
| 1716 | ["Delete" gdb-delete-display t]) | 1722 | ["Delete" gdb-delete-expression t]) |
| 1717 | "Menu for `gdb-expressions-mode'.") | 1723 | "Menu for `gdb-expressions-mode'.") |
| 1718 | 1724 | ||
| 1719 | (defun gdb-expressions-popup-menu (event) | 1725 | (defun gdb-expressions-popup-menu (event) |
| @@ -1786,7 +1792,8 @@ display the source in the source buffer." | |||
| 1786 | answer)) | 1792 | answer)) |
| 1787 | 1793 | ||
| 1788 | (defun gdb-display-source-buffer (buffer) | 1794 | (defun gdb-display-source-buffer (buffer) |
| 1789 | (set-window-buffer gdb-source-window buffer)) | 1795 | (set-window-buffer gdb-source-window buffer) |
| 1796 | gdb-source-window) | ||
| 1790 | 1797 | ||
| 1791 | 1798 | ||
| 1792 | ;;; Shared keymap initialization: | 1799 | ;;; Shared keymap initialization: |
| @@ -2059,7 +2066,7 @@ BUFFER nil or omitted means use the current buffer." | |||
| 2059 | (int-to-string (aref gdb-array-stop n)) | 2066 | (int-to-string (aref gdb-array-stop n)) |
| 2060 | " 1 -T X")))))) | 2067 | " 1 -T X")))))) |
| 2061 | 2068 | ||
| 2062 | (defun gdb-delete-display () | 2069 | (defun gdb-delete-expression () |
| 2063 | "Delete displayed expression and its frame." | 2070 | "Delete displayed expression and its frame." |
| 2064 | (interactive) | 2071 | (interactive) |
| 2065 | (gdb-enqueue-input | 2072 | (gdb-enqueue-input |