diff options
| author | Nick Roberts | 2007-01-21 10:49:42 +0000 |
|---|---|---|
| committer | Nick Roberts | 2007-01-21 10:49:42 +0000 |
| commit | 0ebd837a75cc34d8b2434dda9ceaa5a7705057b9 (patch) | |
| tree | 8d9619bdb9905635d3d212d0be1e67301a9996e2 | |
| parent | c08455ad722d013a5615cf15c7858c4b22b1dd90 (diff) | |
| download | emacs-0ebd837a75cc34d8b2434dda9ceaa5a7705057b9.tar.gz emacs-0ebd837a75cc34d8b2434dda9ceaa5a7705057b9.zip | |
(gdb-var-create-regexp)
(gdb-var-create-handler): Handle value field in GDB output of
-var-create.
(gdb-max-frames): New variable.
(gdb-stack-buffer, gdb-frames-select): Use it.
(gdb-info-stack-custom): Help user customize gdb-max-frames,
if necessary.
(gdb-get-frame-number): Simplify.
| -rw-r--r-- | lisp/progmodes/gdb-ui.el | 82 |
1 files changed, 52 insertions, 30 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 0902b7e462f..5a081687622 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el | |||
| @@ -123,9 +123,10 @@ address for root variables.") | |||
| 123 | (defvar gdb-server-prefix nil) | 123 | (defvar gdb-server-prefix nil) |
| 124 | (defvar gdb-flush-pending-output nil) | 124 | (defvar gdb-flush-pending-output nil) |
| 125 | (defvar gdb-location-alist nil | 125 | (defvar gdb-location-alist nil |
| 126 | "Alist of breakpoint numbers and full filenames.") | 126 | "Alist of breakpoint numbers and full filenames. Only used for files that |
| 127 | (defvar gdb-active-process nil "GUD tooltips display variable values when t, \ | 127 | Emacs can't find.") |
| 128 | and #define directives otherwise.") | 128 | (defvar gdb-active-process nil |
| 129 | "GUD tooltips display variable values when t, and macro definitions otherwise.") | ||
| 129 | (defvar gdb-error "Non-nil when GDB is reporting an error.") | 130 | (defvar gdb-error "Non-nil when GDB is reporting an error.") |
| 130 | (defvar gdb-macro-info nil | 131 | (defvar gdb-macro-info nil |
| 131 | "Non-nil if GDB knows that the inferior includes preprocessor macro info.") | 132 | "Non-nil if GDB knows that the inferior includes preprocessor macro info.") |
| @@ -280,8 +281,8 @@ detailed description of this mode. | |||
| 280 | :version "22.1") | 281 | :version "22.1") |
| 281 | 282 | ||
| 282 | (defvar gdb-debug-ring nil | 283 | (defvar gdb-debug-ring nil |
| 283 | "List of commands, most recent first, sent to and replies received from GDB. | 284 | "List of commands sent to and replies received from GDB. Most recent |
| 284 | This variable is used to debug GDB-UI.") | 285 | commands are listed first. This variable is used to debug GDB-UI.") |
| 285 | 286 | ||
| 286 | ;;;###autoload | 287 | ;;;###autoload |
| 287 | (defcustom gdb-enable-debug nil | 288 | (defcustom gdb-enable-debug nil |
| @@ -721,7 +722,7 @@ With arg, enter name of variable to be watched in the minibuffer." | |||
| 721 | (message "gud-watch is a no-op in this mode.")))) | 722 | (message "gud-watch is a no-op in this mode.")))) |
| 722 | 723 | ||
| 723 | (defconst gdb-var-create-regexp | 724 | (defconst gdb-var-create-regexp |
| 724 | "name=\"\\(.*?\\)\",.*numchild=\"\\(.*?\\)\",.*type=\"\\(.*?\\)\"") | 725 | "name=\"\\(.*?\\)\",.*numchild=\"\\(.*?\\)\",\\(?:.*value=\\(\".*\"\\),\\)?.*type=\"\\(.*?\\)\"") |
| 725 | 726 | ||
| 726 | (defun gdb-var-create-handler (expr) | 727 | (defun gdb-var-create-handler (expr) |
| 727 | (goto-char (point-min)) | 728 | (goto-char (point-min)) |
| @@ -733,20 +734,23 @@ With arg, enter name of variable to be watched in the minibuffer." | |||
| 733 | (setq expr (concat gdb-selected-frame "::" expr)) | 734 | (setq expr (concat gdb-selected-frame "::" expr)) |
| 734 | expr) | 735 | expr) |
| 735 | (match-string 2) | 736 | (match-string 2) |
| 736 | (match-string 3) | 737 | (match-string 4) |
| 737 | nil nil gdb-frame-address))) | 738 | (if (match-string 3) (read (match-string 3))) |
| 739 | nil gdb-frame-address))) | ||
| 738 | (push var gdb-var-list) | 740 | (push var gdb-var-list) |
| 739 | (unless (string-equal | 741 | (unless (string-equal |
| 740 | speedbar-initial-expansion-list-name "GUD") | 742 | speedbar-initial-expansion-list-name "GUD") |
| 741 | (speedbar-change-initial-expansion-list "GUD")) | 743 | (speedbar-change-initial-expansion-list "GUD")) |
| 742 | (gdb-enqueue-input | 744 | (unless (nth 4 var) |
| 743 | (list | 745 | (gdb-enqueue-input |
| 744 | (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) | 746 | (list |
| 745 | (concat "server interpreter mi \"0-var-evaluate-expression " | 747 | (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
| 746 | (car var) "\"\n") | 748 | 'gdba) |
| 747 | (concat "0-var-evaluate-expression " (car var) "\n")) | 749 | (concat "server interpreter mi \"0-var-evaluate-expression " |
| 748 | `(lambda () (gdb-var-evaluate-expression-handler | 750 | (car var) "\"\n") |
| 749 | ,(car var) nil))))) | 751 | (concat "0-var-evaluate-expression " (car var) "\n")) |
| 752 | `(lambda () (gdb-var-evaluate-expression-handler | ||
| 753 | ,(car var) nil)))))) | ||
| 750 | (if (search-forward "Undefined command" nil t) | 754 | (if (search-forward "Undefined command" nil t) |
| 751 | (message-box "Watching expressions requires GDB 6.0 onwards") | 755 | (message-box "Watching expressions requires GDB 6.0 onwards") |
| 752 | (message-box "No symbol \"%s\" in current context." expr)))) | 756 | (message-box "No symbol \"%s\" in current context." expr)))) |
| @@ -897,7 +901,7 @@ Changed values are highlighted with the face `font-lock-warning-face'." | |||
| 897 | :version "22.1") | 901 | :version "22.1") |
| 898 | 902 | ||
| 899 | (defcustom gdb-max-children 40 | 903 | (defcustom gdb-max-children 40 |
| 900 | "Maximum number of children allowed before Emacs asks" | 904 | "Maximum number of children before expansion requires confirmation." |
| 901 | :type 'integer | 905 | :type 'integer |
| 902 | :group 'gud | 906 | :group 'gud |
| 903 | :version "22.1") | 907 | :version "22.1") |
| @@ -2029,13 +2033,19 @@ static char *magick[] = { | |||
| 2029 | ;; | 2033 | ;; |
| 2030 | ;; Alas, if your stack is deep, it is costly. | 2034 | ;; Alas, if your stack is deep, it is costly. |
| 2031 | ;; | 2035 | ;; |
| 2036 | (defcustom gdb-max-frames 40 | ||
| 2037 | "Maximum number of frames displayed in call stack." | ||
| 2038 | :type 'integer | ||
| 2039 | :group 'gud | ||
| 2040 | :version "22.1") | ||
| 2041 | |||
| 2032 | (gdb-set-buffer-rules 'gdb-stack-buffer | 2042 | (gdb-set-buffer-rules 'gdb-stack-buffer |
| 2033 | 'gdb-stack-buffer-name | 2043 | 'gdb-stack-buffer-name |
| 2034 | 'gdb-frames-mode) | 2044 | 'gdb-frames-mode) |
| 2035 | 2045 | ||
| 2036 | (def-gdb-auto-updated-buffer gdb-stack-buffer | 2046 | (def-gdb-auto-updated-buffer gdb-stack-buffer |
| 2037 | gdb-invalidate-frames | 2047 | gdb-invalidate-frames |
| 2038 | "server info stack\n" | 2048 | (concat "server info stack " (number-to-string gdb-max-frames) "\n") |
| 2039 | gdb-info-stack-handler | 2049 | gdb-info-stack-handler |
| 2040 | gdb-info-stack-custom) | 2050 | gdb-info-stack-custom) |
| 2041 | 2051 | ||
| @@ -2077,7 +2087,14 @@ static char *magick[] = { | |||
| 2077 | (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t) | 2087 | (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t) |
| 2078 | (put-text-property (match-beginning 1) (match-end 1) | 2088 | (put-text-property (match-beginning 1) (match-end 1) |
| 2079 | 'face font-lock-variable-name-face)))) | 2089 | 'face font-lock-variable-name-face)))) |
| 2080 | (forward-line 1)))) | 2090 | (forward-line 1)) |
| 2091 | (forward-line -1) | ||
| 2092 | (when (looking-at "(More stack frames follow...)") | ||
| 2093 | (add-text-properties (match-beginning 0) (match-end 0) | ||
| 2094 | '(mouse-face highlight | ||
| 2095 | gdb-max-frames t | ||
| 2096 | help-echo | ||
| 2097 | "mouse-2, RET: customize gdb-max-frames to see more frames"))))) | ||
| 2081 | (when gdb-look-up-stack | 2098 | (when gdb-look-up-stack |
| 2082 | (goto-char (point-min)) | 2099 | (goto-char (point-min)) |
| 2083 | (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t) | 2100 | (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t) |
| @@ -2147,16 +2164,21 @@ static char *magick[] = { | |||
| 2147 | (end-of-line) | 2164 | (end-of-line) |
| 2148 | (let* ((start (line-beginning-position)) | 2165 | (let* ((start (line-beginning-position)) |
| 2149 | (pos (re-search-backward "^#*\\([0-9]+\\)" start t)) | 2166 | (pos (re-search-backward "^#*\\([0-9]+\\)" start t)) |
| 2150 | (n (or (and pos (match-string-no-properties 1)) "0"))) | 2167 | (n (or (and pos (match-string 1)) "0"))) |
| 2151 | n))) | 2168 | n))) |
| 2152 | 2169 | ||
| 2153 | (defun gdb-frames-select (&optional event) | 2170 | (defun gdb-frames-select (&optional event) |
| 2154 | "Select the frame and display the relevant source." | 2171 | "Select the frame and display the relevant source." |
| 2155 | (interactive (list last-input-event)) | 2172 | (interactive (list last-input-event)) |
| 2156 | (if event (posn-set-point (event-end event))) | 2173 | (if event (posn-set-point (event-end event))) |
| 2157 | (gdb-enqueue-input | 2174 | (if (get-text-property (point) 'gdb-max-frames) |
| 2158 | (list (concat gdb-server-prefix "frame " | 2175 | (progn |
| 2159 | (gdb-get-frame-number) "\n") 'ignore))) | 2176 | (message-box "After setting gdb-max-frames, you need to enter\n\ |
| 2177 | another GDB command e.g pwd, to see new frames") | ||
| 2178 | (customize-variable-other-window 'gdb-max-frames)) | ||
| 2179 | (gdb-enqueue-input | ||
| 2180 | (list (concat gdb-server-prefix "frame " | ||
| 2181 | (gdb-get-frame-number) "\n") 'ignore)))) | ||
| 2160 | 2182 | ||
| 2161 | 2183 | ||
| 2162 | ;; Threads buffer. This displays a selectable thread list. | 2184 | ;; Threads buffer. This displays a selectable thread list. |
| @@ -2581,7 +2603,7 @@ corresponding to the mode line clicked." | |||
| 2581 | (propertize | 2603 | (propertize |
| 2582 | "-" | 2604 | "-" |
| 2583 | 'face font-lock-warning-face | 2605 | 'face font-lock-warning-face |
| 2584 | 'help-echo "mouse-1: Decrement address" | 2606 | 'help-echo "mouse-1: decrement address" |
| 2585 | 'mouse-face 'mode-line-highlight | 2607 | 'mouse-face 'mode-line-highlight |
| 2586 | 'local-map | 2608 | 'local-map |
| 2587 | (gdb-make-header-line-mouse-map | 2609 | (gdb-make-header-line-mouse-map |
| @@ -2601,7 +2623,7 @@ corresponding to the mode line clicked." | |||
| 2601 | "|" | 2623 | "|" |
| 2602 | (propertize "+" | 2624 | (propertize "+" |
| 2603 | 'face font-lock-warning-face | 2625 | 'face font-lock-warning-face |
| 2604 | 'help-echo "mouse-1: Increment address" | 2626 | 'help-echo "mouse-1: increment address" |
| 2605 | 'mouse-face 'mode-line-highlight | 2627 | 'mouse-face 'mode-line-highlight |
| 2606 | 'local-map (gdb-make-header-line-mouse-map | 2628 | 'local-map (gdb-make-header-line-mouse-map |
| 2607 | 'mouse-1 | 2629 | 'mouse-1 |
| @@ -2611,7 +2633,7 @@ corresponding to the mode line clicked." | |||
| 2611 | "]: " | 2633 | "]: " |
| 2612 | (propertize gdb-memory-address | 2634 | (propertize gdb-memory-address |
| 2613 | 'face font-lock-warning-face | 2635 | 'face font-lock-warning-face |
| 2614 | 'help-echo "mouse-1: Set memory address" | 2636 | 'help-echo "mouse-1: set memory address" |
| 2615 | 'mouse-face 'mode-line-highlight | 2637 | 'mouse-face 'mode-line-highlight |
| 2616 | 'local-map (gdb-make-header-line-mouse-map | 2638 | 'local-map (gdb-make-header-line-mouse-map |
| 2617 | 'mouse-1 | 2639 | 'mouse-1 |
| @@ -2619,7 +2641,7 @@ corresponding to the mode line clicked." | |||
| 2619 | " Repeat Count: " | 2641 | " Repeat Count: " |
| 2620 | (propertize (number-to-string gdb-memory-repeat-count) | 2642 | (propertize (number-to-string gdb-memory-repeat-count) |
| 2621 | 'face font-lock-warning-face | 2643 | 'face font-lock-warning-face |
| 2622 | 'help-echo "mouse-1: Set repeat count" | 2644 | 'help-echo "mouse-1: set repeat count" |
| 2623 | 'mouse-face 'mode-line-highlight | 2645 | 'mouse-face 'mode-line-highlight |
| 2624 | 'local-map (gdb-make-header-line-mouse-map | 2646 | 'local-map (gdb-make-header-line-mouse-map |
| 2625 | 'mouse-1 | 2647 | 'mouse-1 |
| @@ -2627,13 +2649,13 @@ corresponding to the mode line clicked." | |||
| 2627 | " Display Format: " | 2649 | " Display Format: " |
| 2628 | (propertize gdb-memory-format | 2650 | (propertize gdb-memory-format |
| 2629 | 'face font-lock-warning-face | 2651 | 'face font-lock-warning-face |
| 2630 | 'help-echo "mouse-3: Select display format" | 2652 | 'help-echo "mouse-3: select display format" |
| 2631 | 'mouse-face 'mode-line-highlight | 2653 | 'mouse-face 'mode-line-highlight |
| 2632 | 'local-map gdb-memory-format-map) | 2654 | 'local-map gdb-memory-format-map) |
| 2633 | " Unit Size: " | 2655 | " Unit Size: " |
| 2634 | (propertize gdb-memory-unit | 2656 | (propertize gdb-memory-unit |
| 2635 | 'face font-lock-warning-face | 2657 | 'face font-lock-warning-face |
| 2636 | 'help-echo "mouse-3: Select unit size" | 2658 | 'help-echo "mouse-3: select unit size" |
| 2637 | 'mouse-face 'mode-line-highlight | 2659 | 'mouse-face 'mode-line-highlight |
| 2638 | 'local-map gdb-memory-unit-map)))) | 2660 | 'local-map gdb-memory-unit-map)))) |
| 2639 | (set (make-local-variable 'font-lock-defaults) | 2661 | (set (make-local-variable 'font-lock-defaults) |
| @@ -3011,7 +3033,7 @@ of the current session." | |||
| 3011 | (if (member (if (string-equal gdb-version "pre-6.4") | 3033 | (if (member (if (string-equal gdb-version "pre-6.4") |
| 3012 | (file-name-nondirectory buffer-file-name) | 3034 | (file-name-nondirectory buffer-file-name) |
| 3013 | buffer-file-name) | 3035 | buffer-file-name) |
| 3014 | gdb-source-file-list) | 3036 | gdb-source-file-list) |
| 3015 | (with-current-buffer (find-buffer-visiting buffer-file-name) | 3037 | (with-current-buffer (find-buffer-visiting buffer-file-name) |
| 3016 | (set (make-local-variable 'gud-minor-mode) | 3038 | (set (make-local-variable 'gud-minor-mode) |
| 3017 | (buffer-local-value 'gud-minor-mode gud-comint-buffer)) | 3039 | (buffer-local-value 'gud-minor-mode gud-comint-buffer)) |