diff options
| author | Nick Roberts | 2005-11-06 01:31:24 +0000 |
|---|---|---|
| committer | Nick Roberts | 2005-11-06 01:31:24 +0000 |
| commit | 36188c5e3a73572dec29483bd4e45f44865ac7ee (patch) | |
| tree | 2d303be0433e74f9fd197d58efcfc29a48c25424 | |
| parent | 2dd3b43be12ce680ff0a08f09cec05fdddf9645a (diff) | |
| download | emacs-36188c5e3a73572dec29483bd4e45f44865ac7ee.tar.gz emacs-36188c5e3a73572dec29483bd4e45f44865ac7ee.zip | |
(gdb-var-create-handler, gdb-var-delete)
(gdb-edit-value, gdb-speedbar-expand-node)
(gdb-get-create-buffer, gdb-breakpoints-mode)
(gdb-toggle-breakpoint, gdb-delete-breakpoint)
(gdb-goto-breakpoint, gdb-frames-mode, gdb-registers-mode)
(gdb-locals-mode, gdb-find-file-hook): Use buffer-local-value.
(gdb-send-item, ): Use buffer-local-value and simplify.
| -rw-r--r-- | lisp/progmodes/gdb-ui.el | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index c85321176d7..fed5057b9c6 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el | |||
| @@ -241,7 +241,6 @@ Also display the main routine in the disassembly buffer if present." | |||
| 241 | :group 'gud | 241 | :group 'gud |
| 242 | :version "22.1") | 242 | :version "22.1") |
| 243 | 243 | ||
| 244 | |||
| 245 | (defcustom gdb-use-inferior-io-buffer nil | 244 | (defcustom gdb-use-inferior-io-buffer nil |
| 246 | "Non-nil means display output from the inferior in a separate buffer." | 245 | "Non-nil means display output from the inferior in a separate buffer." |
| 247 | :type 'boolean | 246 | :type 'boolean |
| @@ -495,8 +494,8 @@ With arg, use separate IO iff arg is positive." | |||
| 495 | (if (equal (nth 2 var) "0") | 494 | (if (equal (nth 2 var) "0") |
| 496 | (gdb-enqueue-input | 495 | (gdb-enqueue-input |
| 497 | (list | 496 | (list |
| 498 | (if (with-current-buffer | 497 | (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
| 499 | gud-comint-buffer (eq gud-minor-mode 'gdba)) | 498 | 'gdba) |
| 500 | (concat "server interpreter mi \"-var-evaluate-expression " | 499 | (concat "server interpreter mi \"-var-evaluate-expression " |
| 501 | (nth 1 var) "\"\n") | 500 | (nth 1 var) "\"\n") |
| 502 | (concat "-var-evaluate-expression " (nth 1 var) "\n")) | 501 | (concat "-var-evaluate-expression " (nth 1 var) "\n")) |
| @@ -598,8 +597,8 @@ With arg, use separate IO iff arg is positive." | |||
| 598 | (defun gdb-var-delete () | 597 | (defun gdb-var-delete () |
| 599 | "Delete watch expression at point from the speedbar." | 598 | "Delete watch expression at point from the speedbar." |
| 600 | (interactive) | 599 | (interactive) |
| 601 | (if (with-current-buffer | 600 | (if (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
| 602 | gud-comint-buffer (memq gud-minor-mode '(gdbmi gdba))) | 601 | '(gdbmi gdba)) |
| 603 | (let ((text (speedbar-line-text))) | 602 | (let ((text (speedbar-line-text))) |
| 604 | (string-match "\\(\\S-+\\)" text) | 603 | (string-match "\\(\\S-+\\)" text) |
| 605 | (let* ((expr (match-string 1 text)) | 604 | (let* ((expr (match-string 1 text)) |
| @@ -608,8 +607,8 @@ With arg, use separate IO iff arg is positive." | |||
| 608 | (unless (string-match "\\." varnum) | 607 | (unless (string-match "\\." varnum) |
| 609 | (gdb-enqueue-input | 608 | (gdb-enqueue-input |
| 610 | (list | 609 | (list |
| 611 | (if (with-current-buffer gud-comint-buffer | 610 | (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
| 612 | (eq gud-minor-mode 'gdba)) | 611 | 'gdba) |
| 613 | (concat "server interpreter mi \"-var-delete " varnum "\"\n") | 612 | (concat "server interpreter mi \"-var-delete " varnum "\"\n") |
| 614 | (concat "-var-delete " varnum "\n")) | 613 | (concat "-var-delete " varnum "\n")) |
| 615 | 'ignore)) | 614 | 'ignore)) |
| @@ -626,8 +625,7 @@ With arg, use separate IO iff arg is positive." | |||
| 626 | (setq value (read-string "New value: ")) | 625 | (setq value (read-string "New value: ")) |
| 627 | (gdb-enqueue-input | 626 | (gdb-enqueue-input |
| 628 | (list | 627 | (list |
| 629 | (if (with-current-buffer gud-comint-buffer | 628 | (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
| 630 | (eq gud-minor-mode 'gdba)) | ||
| 631 | (concat "server interpreter mi \"-var-assign " | 629 | (concat "server interpreter mi \"-var-assign " |
| 632 | varnum " " value "\"\n") | 630 | varnum " " value "\"\n") |
| 633 | (concat "-var-assign " varnum " " value "\n")) | 631 | (concat "-var-assign " varnum " " value "\n")) |
| @@ -646,7 +644,7 @@ TEXT is the text of the button we clicked on, a + or - item. | |||
| 646 | TOKEN is data related to this node. | 644 | TOKEN is data related to this node. |
| 647 | INDENT is the current indentation depth." | 645 | INDENT is the current indentation depth." |
| 648 | (cond ((string-match "+" text) ;expand this node | 646 | (cond ((string-match "+" text) ;expand this node |
| 649 | (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 647 | (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
| 650 | (gdb-var-list-children token) | 648 | (gdb-var-list-children token) |
| 651 | (progn | 649 | (progn |
| 652 | (gdbmi-var-update) | 650 | (gdbmi-var-update) |
| @@ -697,7 +695,7 @@ The key should be one of the cars in `gdb-buffer-rules-assoc'." | |||
| 697 | (setq trigger (funcall (car (cdr (cdr rules)))))) | 695 | (setq trigger (funcall (car (cdr (cdr rules)))))) |
| 698 | (setq gdb-buffer-type key) | 696 | (setq gdb-buffer-type key) |
| 699 | (set (make-local-variable 'gud-minor-mode) | 697 | (set (make-local-variable 'gud-minor-mode) |
| 700 | (with-current-buffer gud-comint-buffer gud-minor-mode)) | 698 | (buffer-local-value 'gud-minor-mode gud-comint-buffer)) |
| 701 | (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) | 699 | (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
| 702 | (if trigger (funcall trigger))) | 700 | (if trigger (funcall trigger))) |
| 703 | new)))) | 701 | new)))) |
| @@ -884,22 +882,21 @@ This filter may simply queue input for a later time." | |||
| 884 | (setq gdb-flush-pending-output nil) | 882 | (setq gdb-flush-pending-output nil) |
| 885 | (if gdb-enable-debug-log (push (cons 'send-item item) gdb-debug-log)) | 883 | (if gdb-enable-debug-log (push (cons 'send-item item) gdb-debug-log)) |
| 886 | (setq gdb-current-item item) | 884 | (setq gdb-current-item item) |
| 887 | (with-current-buffer gud-comint-buffer | 885 | (let ((process (get-buffer-process gud-comint-buffer))) |
| 888 | (if (eq gud-minor-mode 'gdba) | 886 | (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
| 889 | (if (stringp item) | 887 | (if (stringp item) |
| 890 | (progn | 888 | (progn |
| 891 | (setq gdb-output-sink 'user) | 889 | (setq gdb-output-sink 'user) |
| 892 | (process-send-string (get-buffer-process gud-comint-buffer) item)) | 890 | (process-send-string process item)) |
| 893 | (progn | 891 | (progn |
| 894 | (gdb-clear-partial-output) | 892 | (gdb-clear-partial-output) |
| 895 | (setq gdb-output-sink 'pre-emacs) | 893 | (setq gdb-output-sink 'pre-emacs) |
| 896 | (process-send-string (get-buffer-process gud-comint-buffer) | 894 | (process-send-string process |
| 897 | (car item)))) | 895 | (car item)))) |
| 898 | ;; case: eq gud-minor-mode 'gdbmi | 896 | ;; case: eq gud-minor-mode 'gdbmi |
| 899 | (gdb-clear-partial-output) | 897 | (gdb-clear-partial-output) |
| 900 | (setq gdb-output-sink 'emacs) | 898 | (setq gdb-output-sink 'emacs) |
| 901 | (process-send-string (get-buffer-process gud-comint-buffer) | 899 | (process-send-string process (car item))))) |
| 902 | (car item))))) | ||
| 903 | 900 | ||
| 904 | ;; | 901 | ;; |
| 905 | ;; output -- things gdb prints to emacs | 902 | ;; output -- things gdb prints to emacs |
| @@ -1545,7 +1542,7 @@ static char *magick[] = { | |||
| 1545 | (use-local-map gdb-breakpoints-mode-map) | 1542 | (use-local-map gdb-breakpoints-mode-map) |
| 1546 | (setq buffer-read-only t) | 1543 | (setq buffer-read-only t) |
| 1547 | (run-mode-hooks 'gdb-breakpoints-mode-hook) | 1544 | (run-mode-hooks 'gdb-breakpoints-mode-hook) |
| 1548 | (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 1545 | (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
| 1549 | 'gdb-invalidate-breakpoints | 1546 | 'gdb-invalidate-breakpoints |
| 1550 | 'gdbmi-invalidate-breakpoints)) | 1547 | 'gdbmi-invalidate-breakpoints)) |
| 1551 | 1548 | ||
| @@ -1554,7 +1551,7 @@ static char *magick[] = { | |||
| 1554 | (interactive) | 1551 | (interactive) |
| 1555 | (save-excursion | 1552 | (save-excursion |
| 1556 | (beginning-of-line 1) | 1553 | (beginning-of-line 1) |
| 1557 | (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 1554 | (if (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
| 1558 | (looking-at "\\([0-9]+\\).*?point\\s-+\\S-+\\s-+\\(.\\)\\s-+") | 1555 | (looking-at "\\([0-9]+\\).*?point\\s-+\\S-+\\s-+\\(.\\)\\s-+") |
| 1559 | (looking-at | 1556 | (looking-at |
| 1560 | "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)\\s-+\\S-+\\s-+\\S-+:[0-9]+")) | 1557 | "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\(.\\)\\s-+\\S-+\\s-+\\S-+:[0-9]+")) |
| @@ -1571,7 +1568,7 @@ static char *magick[] = { | |||
| 1571 | "Delete the breakpoint at current line." | 1568 | "Delete the breakpoint at current line." |
| 1572 | (interactive) | 1569 | (interactive) |
| 1573 | (beginning-of-line 1) | 1570 | (beginning-of-line 1) |
| 1574 | (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 1571 | (if (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
| 1575 | (looking-at "\\([0-9]+\\).*?point\\s-+\\S-+\\s-+\\(.\\)") | 1572 | (looking-at "\\([0-9]+\\).*?point\\s-+\\S-+\\s-+\\(.\\)") |
| 1576 | (looking-at | 1573 | (looking-at |
| 1577 | "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\s-+\\S-+\\s-+\\S-+:[0-9]+")) | 1574 | "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+\\s-+\\S-+\\s-+\\S-+:[0-9]+")) |
| @@ -1589,7 +1586,7 @@ static char *magick[] = { | |||
| 1589 | (if window (save-selected-window (select-window window)))) | 1586 | (if window (save-selected-window (select-window window)))) |
| 1590 | (save-excursion | 1587 | (save-excursion |
| 1591 | (beginning-of-line 1) | 1588 | (beginning-of-line 1) |
| 1592 | (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 1589 | (if (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
| 1593 | (looking-at "\\([0-9]+\\) .+ in .+ at\\s-+\\(\\S-+\\):\\([0-9]+\\)") | 1590 | (looking-at "\\([0-9]+\\) .+ in .+ at\\s-+\\(\\S-+\\):\\([0-9]+\\)") |
| 1594 | (looking-at | 1591 | (looking-at |
| 1595 | "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+.\\s-+\\S-+\\s-+\ | 1592 | "\\([0-9]+\\)\\s-+\\S-+\\s-+\\S-+\\s-+.\\s-+\\S-+\\s-+\ |
| @@ -1694,7 +1691,7 @@ static char *magick[] = { | |||
| 1694 | (use-local-map gdb-frames-mode-map) | 1691 | (use-local-map gdb-frames-mode-map) |
| 1695 | (font-lock-mode -1) | 1692 | (font-lock-mode -1) |
| 1696 | (run-mode-hooks 'gdb-frames-mode-hook) | 1693 | (run-mode-hooks 'gdb-frames-mode-hook) |
| 1697 | (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 1694 | (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
| 1698 | 'gdb-invalidate-frames | 1695 | 'gdb-invalidate-frames |
| 1699 | 'gdbmi-invalidate-frames)) | 1696 | 'gdbmi-invalidate-frames)) |
| 1700 | 1697 | ||
| @@ -1849,7 +1846,7 @@ static char *magick[] = { | |||
| 1849 | (setq buffer-read-only t) | 1846 | (setq buffer-read-only t) |
| 1850 | (use-local-map gdb-registers-mode-map) | 1847 | (use-local-map gdb-registers-mode-map) |
| 1851 | (run-mode-hooks 'gdb-registers-mode-hook) | 1848 | (run-mode-hooks 'gdb-registers-mode-hook) |
| 1852 | (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 1849 | (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
| 1853 | 'gdb-invalidate-registers | 1850 | 'gdb-invalidate-registers |
| 1854 | 'gdbmi-invalidate-registers)) | 1851 | 'gdbmi-invalidate-registers)) |
| 1855 | 1852 | ||
| @@ -2266,7 +2263,7 @@ corresponding to the mode line clicked." | |||
| 2266 | (set (make-local-variable 'font-lock-defaults) | 2263 | (set (make-local-variable 'font-lock-defaults) |
| 2267 | '(gdb-locals-font-lock-keywords)) | 2264 | '(gdb-locals-font-lock-keywords)) |
| 2268 | (run-mode-hooks 'gdb-locals-mode-hook) | 2265 | (run-mode-hooks 'gdb-locals-mode-hook) |
| 2269 | (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) | 2266 | (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) |
| 2270 | 'gdb-invalidate-locals | 2267 | 'gdb-invalidate-locals |
| 2271 | 'gdbmi-invalidate-locals)) | 2268 | 'gdbmi-invalidate-locals)) |
| 2272 | 2269 | ||
| @@ -2528,8 +2525,8 @@ of the current session." | |||
| 2528 | ;; in case gud or gdb-ui is just loaded | 2525 | ;; in case gud or gdb-ui is just loaded |
| 2529 | gud-comint-buffer | 2526 | gud-comint-buffer |
| 2530 | (buffer-name gud-comint-buffer) | 2527 | (buffer-name gud-comint-buffer) |
| 2531 | (with-current-buffer gud-comint-buffer | 2528 | (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
| 2532 | (eq gud-minor-mode 'gdba))) | 2529 | 'gdba)) |
| 2533 | (condition-case nil | 2530 | (condition-case nil |
| 2534 | (gdb-enqueue-input | 2531 | (gdb-enqueue-input |
| 2535 | (list (concat gdb-server-prefix "list " | 2532 | (list (concat gdb-server-prefix "list " |