comparison lisp/progmodes/gdb-ui.el @ 80214:062c5adc0b00

(gdb-pc-address, gdb-source-file-list, gdb-cpp-define-alist-program, gdb-mouse-jump, gdb-get-buffer-create, gdb-debug-log, gdb-set-gud-minor-mode-existing-buffers-1): Fix typos in docstrings. (gdb-pending-triggers): Reflow docstring. (gdb, gdb-init-1): Fix typos in docstrings of gud-def definitions.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 26 Feb 2008 02:01:49 +0000
parents b48b70b93856
children 84f75770f0f3 4054054dd212
comparison
equal deleted inserted replaced
80213:88522cc27ada 80214:062c5adc0b00
98 98
99 (defvar tool-bar-map) 99 (defvar tool-bar-map)
100 (defvar speedbar-initial-expansion-list-name) 100 (defvar speedbar-initial-expansion-list-name)
101 101
102 (defvar gdb-pc-address nil "Initialization for Assembler buffer. 102 (defvar gdb-pc-address nil "Initialization for Assembler buffer.
103 Set to \"main\" at start if gdb-show-main is t.") 103 Set to \"main\" at start if `gdb-show-main' is t.")
104 (defvar gdb-frame-address nil "Identity of frame for watch expression.") 104 (defvar gdb-frame-address nil "Identity of frame for watch expression.")
105 (defvar gdb-previous-frame-address nil) 105 (defvar gdb-previous-frame-address nil)
106 (defvar gdb-memory-address "main") 106 (defvar gdb-memory-address "main")
107 (defvar gdb-previous-frame nil) 107 (defvar gdb-previous-frame nil)
108 (defvar gdb-selected-frame nil) 108 (defvar gdb-selected-frame nil)
109 (defvar gdb-frame-number nil) 109 (defvar gdb-frame-number nil)
110 (defvar gdb-current-language nil) 110 (defvar gdb-current-language nil)
111 (defvar gdb-var-list nil 111 (defvar gdb-var-list nil
112 "List of variables in watch window. 112 "List of variables in watch window.
113 Each element has the form (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS FP) 113 Each element has the form (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS FP)
114 where STATUS is nil (`unchanged'), `changed' or `out-of-scope', FP the frame 114 where STATUS is nil (`unchanged'), `changed' or `out-of-scope', FP the frame
115 address for root variables.") 115 address for root variables.")
116 (defvar gdb-main-file nil "Source file from which program execution begins.") 116 (defvar gdb-main-file nil "Source file from which program execution begins.")
117 (defvar gud-old-arrow nil) 117 (defvar gud-old-arrow nil)
172 172
173 (defvar gdb-current-item nil 173 (defvar gdb-current-item nil
174 "The most recent command item sent to gdb.") 174 "The most recent command item sent to gdb.")
175 175
176 (defvar gdb-pending-triggers '() 176 (defvar gdb-pending-triggers '()
177 "A list of trigger functions that have run later than their output 177 "A list of trigger functions that have run later than their output handlers.")
178 handlers.")
179 178
180 (defvar gdb-first-post-prompt nil) 179 (defvar gdb-first-post-prompt nil)
181 (defvar gdb-version nil) 180 (defvar gdb-version nil)
182 (defvar gdb-locals-font-lock-keywords nil) 181 (defvar gdb-locals-font-lock-keywords nil)
183 (defvar gdb-source-file-list nil 182 (defvar gdb-source-file-list nil
184 "List of source files for the current executable") 183 "List of source files for the current executable.")
185 (defconst gdb-error-regexp "\\^error,msg=\"\\(.+\\)\"") 184 (defconst gdb-error-regexp "\\^error,msg=\"\\(.+\\)\"")
186 185
187 (defvar gdb-locals-font-lock-keywords-1 186 (defvar gdb-locals-font-lock-keywords-1
188 '( 187 '(
189 ;; var = (struct struct_tag) value 188 ;; var = (struct struct_tag) value
286 (set (make-local-variable 'gud-minor-mode) 'gdba) 285 (set (make-local-variable 'gud-minor-mode) 'gdba)
287 286
288 (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.") 287 (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.")
289 (gud-def gud-tbreak "tbreak %f:%l" "\C-t" 288 (gud-def gud-tbreak "tbreak %f:%l" "\C-t"
290 "Set temporary breakpoint at current line.") 289 "Set temporary breakpoint at current line.")
291 (gud-def gud-remove "clear %f:%l" "\C-d" "Remove breakpoint at current line") 290 (gud-def gud-remove "clear %f:%l" "\C-d" "Remove breakpoint at current line.")
292 (gud-def gud-step "step %p" "\C-s" "Step one source line with display.") 291 (gud-def gud-step "step %p" "\C-s" "Step one source line with display.")
293 (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with display.") 292 (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with display.")
294 (gud-def gud-next "next %p" "\C-n" "Step one line (skip functions).") 293 (gud-def gud-next "next %p" "\C-n" "Step one line (skip functions).")
295 (gud-def gud-nexti "nexti %p" nil "Step one instruction (skip functions).") 294 (gud-def gud-nexti "nexti %p" nil "Step one instruction (skip functions).")
296 (gud-def gud-cont "cont" "\C-r" "Continue with display.") 295 (gud-def gud-cont "cont" "\C-r" "Continue with display.")
331 :type '(choice (integer :tag "Number of elements") 330 :type '(choice (integer :tag "Number of elements")
332 (const :tag "Unlimited" nil)) 331 (const :tag "Unlimited" nil))
333 :version "22.1") 332 :version "22.1")
334 333
335 (defvar gdb-debug-log nil 334 (defvar gdb-debug-log nil
336 "List of commands sent to and replies received from GDB. Most 335 "List of commands sent to and replies received from GDB.
337 recent commands are listed first. This list stores only the last 336 Most recent commands are listed first. This list stores only the last
338 'gdb-debug-log-max' values. This variable is used to debug 337 `gdb-debug-log-max' values. This variable is used to debug GDB-UI.")
339 GDB-UI.")
340 338
341 ;;;###autoload 339 ;;;###autoload
342 (defcustom gdb-enable-debug nil 340 (defcustom gdb-enable-debug nil
343 "Non-nil means record the process input and output in `gdb-debug-log'." 341 "Non-nil means record the process input and output in `gdb-debug-log'."
344 :type 'boolean 342 :type 'boolean
347 345
348 (defcustom gdb-cpp-define-alist-program "gcc -E -dM -" 346 (defcustom gdb-cpp-define-alist-program "gcc -E -dM -"
349 "Shell command for generating a list of defined macros in a source file. 347 "Shell command for generating a list of defined macros in a source file.
350 This list is used to display the #define directive associated 348 This list is used to display the #define directive associated
351 with an identifier as a tooltip. It works in a debug session with 349 with an identifier as a tooltip. It works in a debug session with
352 GDB, when gud-tooltip-mode is t. 350 GDB, when `gud-tooltip-mode' is t.
353 351
354 Set `gdb-cpp-define-alist-flags' for any include paths or 352 Set `gdb-cpp-define-alist-flags' for any include paths or
355 predefined macros." 353 predefined macros."
356 :type 'string 354 :type 'string
357 :group 'gud 355 :group 'gud
548 (gud-call 546 (gud-call
549 (concat 547 (concat
550 "pp1 " (if (eq (buffer-local-value 548 "pp1 " (if (eq (buffer-local-value
551 'major-mode (window-buffer)) 'speedbar-mode) 549 'major-mode (window-buffer)) 'speedbar-mode)
552 (gdb-find-watch-expression) "%e")) arg) 550 (gdb-find-watch-expression) "%e")) arg)
553 nil "Print the emacs s-expression.") 551 nil "Print the Emacs s-expression.")
554 552
555 (define-key gud-minor-mode-map [left-margin mouse-1] 553 (define-key gud-minor-mode-map [left-margin mouse-1]
556 'gdb-mouse-set-clear-breakpoint) 554 'gdb-mouse-set-clear-breakpoint)
557 (define-key gud-minor-mode-map [left-fringe mouse-1] 555 (define-key gud-minor-mode-map [left-fringe mouse-1]
558 'gdb-mouse-set-clear-breakpoint) 556 'gdb-mouse-set-clear-breakpoint)
684 682
685 (defun gdb-mouse-jump (event) 683 (defun gdb-mouse-jump (event)
686 "Set execution address/line. 684 "Set execution address/line.
687 The destination source line can be selected either by clicking with C-mouse-3 685 The destination source line can be selected either by clicking with C-mouse-3
688 on the fringe/margin or dragging the arrow with C-mouse-1 (default bindings). 686 on the fringe/margin or dragging the arrow with C-mouse-1 (default bindings).
689 Unlike gdb-mouse-until the destination address can be before the current 687 Unlike `gdb-mouse-until' the destination address can be before the current
690 line, and no execution takes place." 688 line, and no execution takes place."
691 (interactive "e") 689 (interactive "e")
692 (let ((start (event-start event)) 690 (let ((start (event-start event))
693 (end (event-end event))) 691 (end (event-end event)))
694 (gdb-if-arrow gud-overlay-arrow-position 692 (gdb-if-arrow gud-overlay-arrow-position
822 (gdb-enqueue-input 820 (gdb-enqueue-input
823 (list (concat "server interpreter mi \"-var-list-children " varnum "\"\n") 821 (list (concat "server interpreter mi \"-var-list-children " varnum "\"\n")
824 `(lambda () (gdb-var-list-children-handler ,varnum))))) 822 `(lambda () (gdb-var-list-children-handler ,varnum)))))
825 823
826 (defconst gdb-var-list-children-regexp 824 (defconst gdb-var-list-children-regexp
827 "child={.*?name=\"\\(.*?\\)\",.*?exp=\"\\(.*?\\)\",.*?\ 825 "child={.*?name=\"\\(.*?\\)\",.*?exp=\"\\(.*?\\)\",.*?\
828 numchild=\"\\(.*?\\)\"\\(}\\|,.*?\\(type=\"\\(.*?\\)\"\\)?.*?}\\)") 826 numchild=\"\\(.*?\\)\"\\(}\\|,.*?\\(type=\"\\(.*?\\)\"\\)?.*?}\\)")
829 827
830 (defun gdb-var-list-children-handler (varnum) 828 (defun gdb-var-list-children-handler (varnum)
831 (goto-char (point-min)) 829 (goto-char (point-min))
832 (let ((var-list nil)) 830 (let ((var-list nil))
1030 The key should be one of the cars in `gdb-buffer-rules-assoc'." 1028 The key should be one of the cars in `gdb-buffer-rules-assoc'."
1031 (save-excursion 1029 (save-excursion
1032 (gdb-look-for-tagged-buffer key (buffer-list)))) 1030 (gdb-look-for-tagged-buffer key (buffer-list))))
1033 1031
1034 (defun gdb-get-buffer-create (key) 1032 (defun gdb-get-buffer-create (key)
1035 "Create a new gdb buffer of the type specified by KEY. 1033 "Create a new gdb buffer of the type specified by KEY.
1036 The key should be one of the cars in `gdb-buffer-rules-assoc'." 1034 The key should be one of the cars in `gdb-buffer-rules-assoc'."
1037 (or (gdb-get-buffer key) 1035 (or (gdb-get-buffer key)
1038 (let* ((rules (assoc key gdb-buffer-rules-assoc)) 1036 (let* ((rules (assoc key gdb-buffer-rules-assoc))
1039 (name (funcall (gdb-rules-name-maker rules))) 1037 (name (funcall (gdb-rules-name-maker rules)))
1040 (new (get-buffer-create name))) 1038 (new (get-buffer-create name)))
1343 1341
1344 (defun gdb-prompt (ignored) 1342 (defun gdb-prompt (ignored)
1345 "An annotation handler for `prompt'. 1343 "An annotation handler for `prompt'.
1346 This sends the next command (if any) to gdb." 1344 This sends the next command (if any) to gdb."
1347 (when gdb-first-prompt 1345 (when gdb-first-prompt
1348 (gdb-force-mode-line-update 1346 (gdb-force-mode-line-update
1349 (propertize "initializing..." 'face font-lock-variable-name-face)) 1347 (propertize "initializing..." 'face font-lock-variable-name-face))
1350 (gdb-init-1) 1348 (gdb-init-1)
1351 (setq gdb-first-prompt nil)) 1349 (setq gdb-first-prompt nil))
1352 (let ((sink gdb-output-sink)) 1350 (let ((sink gdb-output-sink))
1353 (cond 1351 (cond
2271 2269
2272 \\{gdb-frames-mode-map}" 2270 \\{gdb-frames-mode-map}"
2273 (kill-all-local-variables) 2271 (kill-all-local-variables)
2274 (setq major-mode 'gdb-frames-mode) 2272 (setq major-mode 'gdb-frames-mode)
2275 (setq mode-name "Frames") 2273 (setq mode-name "Frames")
2276 (setq gdb-stack-position nil) 2274 (setq gdb-stack-position nil)
2277 (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position) 2275 (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position)
2278 (setq truncate-lines t) ;; Make it easier to see overlay arrow. 2276 (setq truncate-lines t) ;; Make it easier to see overlay arrow.
2279 (setq buffer-read-only t) 2277 (setq buffer-read-only t)
2280 (use-local-map gdb-frames-mode-map) 2278 (use-local-map gdb-frames-mode-map)
2281 (run-mode-hooks 'gdb-frames-mode-hook) 2279 (run-mode-hooks 'gdb-frames-mode-hook)
2600 2598
2601 (defvar gdb-memory-format-map 2599 (defvar gdb-memory-format-map
2602 (let ((map (make-sparse-keymap))) 2600 (let ((map (make-sparse-keymap)))
2603 (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1) 2601 (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1)
2604 map) 2602 map)
2605 "Keymap to select format in the header line.") 2603 "Keymap to select format in the header line.")
2606 2604
2607 (defvar gdb-memory-format-menu (make-sparse-keymap "Format") 2605 (defvar gdb-memory-format-menu (make-sparse-keymap "Format")
2608 "Menu of display formats in the header line.") 2606 "Menu of display formats in the header line.")
2609 2607
2610 (define-key gdb-memory-format-menu [binary] 2608 (define-key gdb-memory-format-menu [binary]
2611 '(menu-item "Binary" gdb-memory-format-binary 2609 '(menu-item "Binary" gdb-memory-format-binary
2612 :button (:radio . (equal gdb-memory-format "t")))) 2610 :button (:radio . (equal gdb-memory-format "t"))))
2613 (define-key gdb-memory-format-menu [octal] 2611 (define-key gdb-memory-format-menu [octal]
2662 2660
2663 (defvar gdb-memory-unit-map 2661 (defvar gdb-memory-unit-map
2664 (let ((map (make-sparse-keymap))) 2662 (let ((map (make-sparse-keymap)))
2665 (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1) 2663 (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1)
2666 map) 2664 map)
2667 "Keymap to select units in the header line.") 2665 "Keymap to select units in the header line.")
2668 2666
2669 (defvar gdb-memory-unit-menu (make-sparse-keymap "Unit") 2667 (defvar gdb-memory-unit-menu (make-sparse-keymap "Unit")
2670 "Menu of units in the header line.") 2668 "Menu of units in the header line.")
2671 2669
2672 (define-key gdb-memory-unit-menu [giantwords] 2670 (define-key gdb-memory-unit-menu [giantwords]
2673 '(menu-item "Giant words" gdb-memory-unit-giant 2671 '(menu-item "Giant words" gdb-memory-unit-giant
2674 :button (:radio . (equal gdb-memory-unit "g")))) 2672 :button (:radio . (equal gdb-memory-unit "g"))))
2675 (define-key gdb-memory-unit-menu [words] 2673 (define-key gdb-memory-unit-menu [words]
2828 (define-key map [mouse-2] (lambda (event) (interactive "e") 2826 (define-key map [mouse-2] (lambda (event) (interactive "e")
2829 (mouse-set-point event) 2827 (mouse-set-point event)
2830 (beginning-of-line) 2828 (beginning-of-line)
2831 (gud-watch))) 2829 (gud-watch)))
2832 map) 2830 map)
2833 "Keymap to create watch expression of a complex data type local variable.") 2831 "Keymap to create watch expression of a complex data type local variable.")
2834 2832
2835 (defconst gdb-struct-string 2833 (defconst gdb-struct-string
2836 (concat (propertize "[struct/union]" 2834 (concat (propertize "[struct/union]"
2837 'mouse-face 'highlight 2835 'mouse-face 'highlight
2838 'help-echo "mouse-2: create watch expression" 2836 'help-echo "mouse-2: create watch expression"
3477 ;; Code specific to GDB 6.4 3475 ;; Code specific to GDB 6.4
3478 (defconst gdb-source-file-regexp-1 "fullname=\"\\(.*?\\)\"") 3476 (defconst gdb-source-file-regexp-1 "fullname=\"\\(.*?\\)\"")
3479 3477
3480 (defun gdb-set-gud-minor-mode-existing-buffers-1 () 3478 (defun gdb-set-gud-minor-mode-existing-buffers-1 ()
3481 "Create list of source files for current GDB session. 3479 "Create list of source files for current GDB session.
3482 If buffers already exist for any of these files, gud-minor-mode 3480 If buffers already exist for any of these files, `gud-minor-mode'
3483 is set in them." 3481 is set in them."
3484 (goto-char (point-min)) 3482 (goto-char (point-min))
3485 (while (re-search-forward gdb-source-file-regexp-1 nil t) 3483 (while (re-search-forward gdb-source-file-regexp-1 nil t)
3486 (push (match-string 1) gdb-source-file-list)) 3484 (push (match-string 1) gdb-source-file-list))
3487 (dolist (buffer (buffer-list)) 3485 (dolist (buffer (buffer-list))
3688 (let ((map (make-sparse-keymap))) 3686 (let ((map (make-sparse-keymap)))
3689 (suppress-keymap map) 3687 (suppress-keymap map)
3690 (define-key map "\r" 'gud-watch) 3688 (define-key map "\r" 'gud-watch)
3691 (define-key map [mouse-2] 'gud-watch) 3689 (define-key map [mouse-2] 'gud-watch)
3692 map) 3690 map)
3693 "Keymap to create watch expression of a complex data type local variable.") 3691 "Keymap to create watch expression of a complex data type local variable.")
3694 3692
3695 (defvar gdb-edit-locals-map-1 3693 (defvar gdb-edit-locals-map-1
3696 (let ((map (make-sparse-keymap))) 3694 (let ((map (make-sparse-keymap)))
3697 (suppress-keymap map) 3695 (suppress-keymap map)
3698 (define-key map "\r" 'gdb-edit-locals-value) 3696 (define-key map "\r" 'gdb-edit-locals-value)
3699 (define-key map [mouse-2] 'gdb-edit-locals-value) 3697 (define-key map [mouse-2] 'gdb-edit-locals-value)
3700 map) 3698 map)
3701 "Keymap to edit value of a simple data type local variable.") 3699 "Keymap to edit value of a simple data type local variable.")
3702 3700
3703 (defun gdb-edit-locals-value (&optional event) 3701 (defun gdb-edit-locals-value (&optional event)
3704 "Assign a value to a variable displayed in the locals buffer." 3702 "Assign a value to a variable displayed in the locals buffer."
3705 (interactive (list last-input-event)) 3703 (interactive (list last-input-event))
3706 (save-excursion 3704 (save-excursion