diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2007-01-29 22:21:19 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2007-01-29 22:21:19 +0000 |
commit | 93afd0f1d463bec0fc8d3127c1d34ccaa4dbe99b (patch) | |
tree | 6e4e3bec20b8c65eb1f78b0ad302fa6c1977d355 /lisp/progmodes/gdb-ui.el | |
parent | 38db5c8d522cc1faa8190e77dbc932a5560e6aad (diff) | |
parent | 5c4a60523827062803ab9a55b4325358225d66bf (diff) | |
download | emacs-93afd0f1d463bec0fc8d3127c1d34ccaa4dbe99b.tar.gz |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-599
Merge from erc--main--0
* emacs@sv.gnu.org/emacs--devo--0--patch-600
Merge from erc--main--0
* emacs@sv.gnu.org/emacs--devo--0--patch-601
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-602
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-603
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-604
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-605
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-606
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-607
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-608
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-609
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-610
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-611
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-612
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-613
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-614
Make byte compiler correctly write circular constants
* emacs@sv.gnu.org/emacs--devo--0--patch-615
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-616
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-617
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-618
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-192
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-193
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-194
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-195
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-196
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-594
Diffstat (limited to 'lisp/progmodes/gdb-ui.el')
-rw-r--r-- | lisp/progmodes/gdb-ui.el | 146 |
1 files changed, 92 insertions, 54 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 980c6b3f07b..c2811a9658a 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -4,7 +4,7 @@ ;; Maintainer: FSF ;; Keywords: unix, tools -;; Copyright (C) 2002, 2003, 2004, 2005, 2006 +;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 ;; Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -123,9 +123,10 @@ address for root variables.") (defvar gdb-server-prefix nil) (defvar gdb-flush-pending-output nil) (defvar gdb-location-alist nil - "Alist of breakpoint numbers and full filenames.") -(defvar gdb-active-process nil "GUD tooltips display variable values when t, \ -and #define directives otherwise.") + "Alist of breakpoint numbers and full filenames. Only used for files that +Emacs can't find.") +(defvar gdb-active-process nil + "GUD tooltips display variable values when t, and macro definitions otherwise.") (defvar gdb-error "Non-nil when GDB is reporting an error.") (defvar gdb-macro-info nil "Non-nil if GDB knows that the inferior includes preprocessor macro info.") @@ -273,19 +274,22 @@ detailed description of this mode. (gdb command-line) (gdb-init-1)) -(defcustom gdb-debug-ring-max 128 - "Maximum size of `gdb-debug-ring'." +(defcustom gdb-debug-log-max 128 + "Maximum size of `gdb-debug-log'. If nil, size is unlimited." :group 'gud - :type 'integer + :type '(choice (integer :tag "Number of elements") + (const :tag "Unlimited" nil)) :version "22.1") -(defvar gdb-debug-ring nil - "List of commands, most recent first, sent to and replies received from GDB. -This variable is used to debug GDB-UI.") +(defvar gdb-debug-log nil + "List of commands sent to and replies received from GDB. Most +recent commands are listed first. This list stores only the last +'gdb-debug-log-max' values. This variable is used to debug +GDB-UI.") ;;;###autoload (defcustom gdb-enable-debug nil - "Non-nil means record the process input and output in `gdb-debug-ring'." + "Non-nil means record the process input and output in `gdb-debug-log'." :type 'boolean :group 'gud :version "22.1") @@ -316,7 +320,7 @@ Also display the main routine in the disassembly buffer if present." :version "22.1") (defcustom gdb-many-windows nil - "If nil just pop up the GUD buffer unless `gdb-show-main' is t. + "If nil, just pop up the GUD buffer unless `gdb-show-main' is t. In this case start with two windows: one displaying the GUD buffer and the other with the source file with the main routine of the debugged program. Non-nil means display the layout shown @@ -550,7 +554,7 @@ With arg, use separate IO iff arg is positive." gdb-error nil gdb-macro-info nil gdb-buffer-fringe-width (car (window-fringes)) - gdb-debug-ring nil + gdb-debug-log nil gdb-signalled nil gdb-source-window nil gdb-inferior-status nil @@ -721,7 +725,7 @@ With arg, enter name of variable to be watched in the minibuffer." (message "gud-watch is a no-op in this mode.")))) (defconst gdb-var-create-regexp - "name=\"\\(.*?\\)\",.*numchild=\"\\(.*?\\)\",.*type=\"\\(.*?\\)\"") + "name=\"\\(.*?\\)\",.*numchild=\"\\(.*?\\)\",\\(?:.*value=\\(\".*\"\\),\\)?.*type=\"\\(.*?\\)\"") (defun gdb-var-create-handler (expr) (goto-char (point-min)) @@ -733,20 +737,23 @@ With arg, enter name of variable to be watched in the minibuffer." (setq expr (concat gdb-selected-frame "::" expr)) expr) (match-string 2) - (match-string 3) - nil nil gdb-frame-address))) + (match-string 4) + (if (match-string 3) (read (match-string 3))) + nil gdb-frame-address))) (push var gdb-var-list) (unless (string-equal speedbar-initial-expansion-list-name "GUD") (speedbar-change-initial-expansion-list "GUD")) - (gdb-enqueue-input - (list - (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) - (concat "server interpreter mi \"0-var-evaluate-expression " - (car var) "\"\n") - (concat "0-var-evaluate-expression " (car var) "\n")) - `(lambda () (gdb-var-evaluate-expression-handler - ,(car var) nil))))) + (unless (nth 4 var) + (gdb-enqueue-input + (list + (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) + 'gdba) + (concat "server interpreter mi \"0-var-evaluate-expression " + (car var) "\"\n") + (concat "0-var-evaluate-expression " (car var) "\n")) + `(lambda () (gdb-var-evaluate-expression-handler + ,(car var) nil)))))) (if (search-forward "Undefined command" nil t) (message-box "Watching expressions requires GDB 6.0 onwards") (message-box "No symbol \"%s\" in current context." expr)))) @@ -897,7 +904,7 @@ Changed values are highlighted with the face `font-lock-warning-face'." :version "22.1") (defcustom gdb-max-children 40 - "Maximum number of children allowed before Emacs asks" + "Maximum number of children before expansion requires confirmation." :type 'integer :group 'gud :version "22.1") @@ -1130,7 +1137,7 @@ This filter may simply queue input for a later time." (if gud-running (progn (let ((item (concat string "\n"))) - (if gdb-enable-debug (push (cons 'send item) gdb-debug-ring)) + (if gdb-enable-debug (push (cons 'send item) gdb-debug-log)) (process-send-string proc item))) (if (and (string-match "\\\\$" string) (not comint-input-sender-no-newline)) ;;Try to catch C-d. @@ -1159,7 +1166,7 @@ This filter may simply queue input for a later time." (defun gdb-send-item (item) (setq gdb-flush-pending-output nil) - (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-ring)) + (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-log)) (setq gdb-current-item item) (let ((process (get-buffer-process gud-comint-buffer))) (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) @@ -1510,9 +1517,10 @@ happens to be appropriate." (if gdb-flush-pending-output nil (when gdb-enable-debug - (push (cons 'recv string) gdb-debug-ring) - (if (> (length gdb-debug-ring) gdb-debug-ring-max) - (setcdr (nthcdr (1- gdb-debug-ring-max) gdb-debug-ring) nil))) + (push (cons 'recv string) gdb-debug-log) + (if (and gdb-debug-log-max + (> (length gdb-debug-log) gdb-debug-log-max)) + (setcdr (nthcdr (1- gdb-debug-log-max) gdb-debug-log) nil))) ;; Recall the left over gud-marker-acc from last time. (setq gud-marker-acc (concat gud-marker-acc string)) ;; Start accumulating output for the GUD buffer. @@ -1780,6 +1788,9 @@ static char *magick[] = { "Face for disabled breakpoint icon in fringe." :group 'gud) +(defconst gdb-breakpoint-regexp + "\\([0-9]+\\).*?\\(?:point\\|catch\\s-+\\S-+\\)\\s-+\\S-+\\s-+\\(.\\)\\s-+") + ;; Put breakpoint icons in relevant margins (even those set in the GUD buffer). (defun gdb-info-breakpoints-custom () (let ((flag) (bptno)) @@ -1973,9 +1984,6 @@ static char *magick[] = { 'gdb-invalidate-breakpoints 'gdbmi-invalidate-breakpoints)) -(defconst gdb-breakpoint-regexp - "\\([0-9]+\\).*?\\(?:point\\|catch\\s-+\\S-+\\)\\s-+\\S-+\\s-+\\(.\\)\\s-+") - (defun gdb-toggle-breakpoint () "Enable/disable breakpoint at current line." (interactive) @@ -2029,13 +2037,19 @@ static char *magick[] = { ;; ;; Alas, if your stack is deep, it is costly. ;; +(defcustom gdb-max-frames 40 + "Maximum number of frames displayed in call stack." + :type 'integer + :group 'gud + :version "22.1") + (gdb-set-buffer-rules 'gdb-stack-buffer 'gdb-stack-buffer-name 'gdb-frames-mode) (def-gdb-auto-updated-buffer gdb-stack-buffer gdb-invalidate-frames - "server info stack\n" + (concat "server info stack " (number-to-string gdb-max-frames) "\n") gdb-info-stack-handler gdb-info-stack-custom) @@ -2077,7 +2091,14 @@ static char *magick[] = { (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t) (put-text-property (match-beginning 1) (match-end 1) 'face font-lock-variable-name-face)))) - (forward-line 1)))) + (forward-line 1)) + (forward-line -1) + (when (looking-at "(More stack frames follow...)") + (add-text-properties (match-beginning 0) (match-end 0) + '(mouse-face highlight + gdb-max-frames t + help-echo + "mouse-2, RET: customize gdb-max-frames to see more frames"))))) (when gdb-look-up-stack (goto-char (point-min)) (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t) @@ -2147,16 +2168,21 @@ static char *magick[] = { (end-of-line) (let* ((start (line-beginning-position)) (pos (re-search-backward "^#*\\([0-9]+\\)" start t)) - (n (or (and pos (match-string-no-properties 1)) "0"))) + (n (or (and pos (match-string 1)) "0"))) n))) (defun gdb-frames-select (&optional event) "Select the frame and display the relevant source." (interactive (list last-input-event)) (if event (posn-set-point (event-end event))) - (gdb-enqueue-input - (list (concat gdb-server-prefix "frame " - (gdb-get-frame-number) "\n") 'ignore))) + (if (get-text-property (point) 'gdb-max-frames) + (progn + (message-box "After setting gdb-max-frames, you need to enter\n\ +another GDB command e.g pwd, to see new frames") + (customize-variable-other-window 'gdb-max-frames)) + (gdb-enqueue-input + (list (concat gdb-server-prefix "frame " + (gdb-get-frame-number) "\n") 'ignore)))) ;; Threads buffer. This displays a selectable thread list. @@ -2581,7 +2607,7 @@ corresponding to the mode line clicked." (propertize "-" 'face font-lock-warning-face - 'help-echo "mouse-1: Decrement address" + 'help-echo "mouse-1: decrement address" 'mouse-face 'mode-line-highlight 'local-map (gdb-make-header-line-mouse-map @@ -2601,7 +2627,7 @@ corresponding to the mode line clicked." "|" (propertize "+" 'face font-lock-warning-face - 'help-echo "mouse-1: Increment address" + 'help-echo "mouse-1: increment address" 'mouse-face 'mode-line-highlight 'local-map (gdb-make-header-line-mouse-map 'mouse-1 @@ -2611,7 +2637,7 @@ corresponding to the mode line clicked." "]: " (propertize gdb-memory-address 'face font-lock-warning-face - 'help-echo "mouse-1: Set memory address" + 'help-echo "mouse-1: set memory address" 'mouse-face 'mode-line-highlight 'local-map (gdb-make-header-line-mouse-map 'mouse-1 @@ -2619,7 +2645,7 @@ corresponding to the mode line clicked." " Repeat Count: " (propertize (number-to-string gdb-memory-repeat-count) 'face font-lock-warning-face - 'help-echo "mouse-1: Set repeat count" + 'help-echo "mouse-1: set repeat count" 'mouse-face 'mode-line-highlight 'local-map (gdb-make-header-line-mouse-map 'mouse-1 @@ -2627,13 +2653,13 @@ corresponding to the mode line clicked." " Display Format: " (propertize gdb-memory-format 'face font-lock-warning-face - 'help-echo "mouse-3: Select display format" + 'help-echo "mouse-3: select display format" 'mouse-face 'mode-line-highlight 'local-map gdb-memory-format-map) " Unit Size: " (propertize gdb-memory-unit 'face font-lock-warning-face - 'help-echo "mouse-3: Select unit size" + 'help-echo "mouse-3: select unit size" 'mouse-face 'mode-line-highlight 'local-map gdb-memory-unit-map)))) (set (make-local-variable 'font-lock-defaults) @@ -3011,7 +3037,7 @@ of the current session." (if (member (if (string-equal gdb-version "pre-6.4") (file-name-nondirectory buffer-file-name) buffer-file-name) - gdb-source-file-list) + gdb-source-file-list) (with-current-buffer (find-buffer-visiting buffer-file-name) (set (make-local-variable 'gud-minor-mode) (buffer-local-value 'gud-minor-mode gud-comint-buffer)) @@ -3410,14 +3436,26 @@ in_scope=\"\\(.*?\\)\".*?}") (let* ((varnum (match-string 1)) (var (assoc varnum gdb-var-list))) (when var - (if (string-equal (match-string 3) "false") - (setcar (nthcdr 5 var) 'out-of-scope) - (setcar (nthcdr 5 var) 'changed) - (setcar (nthcdr 4 var) - (read (match-string 2))))))) - (setq gdb-pending-triggers - (delq 'gdb-var-update gdb-pending-triggers)) - (gdb-speedbar-update)) + (let ((match (match-string 3))) + (cond ((string-equal match "false") + (setcar (nthcdr 5 var) 'out-of-scope)) + ((string-equal match "true") + (setcar (nthcdr 5 var) 'changed) + (setcar (nthcdr 4 var) + (read (match-string 2)))) +;; ((string-equal match "invalid") +;; (gdb-enqueue-input +;; (list +;; (if (eq (buffer-local-value +;; 'gud-minor-mode gud-comint-buffer) 'gdba) +;; (concat "server interpreter mi \"-var-delete " +;; varnum "\"\n") +;; (concat "-var-delete " varnum "\n")) +;; 'ignore))) + ))))) + (setq gdb-pending-triggers + (delq 'gdb-var-update gdb-pending-triggers)) + (gdb-speedbar-update)) ;; Registers buffer. ;; |