Mercurial > emacs
comparison lisp/gud.el @ 22734:09db8bddedc5
(gud-speedbar-key-map) New variable.
(gud-install-speedbar-variables) New function
Install speedbar keymap only when speedbar is loaded.
(gud-gdb-get-stackframe) Added : to regex for c++.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Fri, 10 Jul 1998 16:47:28 +0000 |
parents | 5988c3c973db |
children | 9392dd2e6137 |
comparison
equal
deleted
inserted
replaced
22733:8d8e664f1f6c | 22734:09db8bddedc5 |
---|---|
172 ;; by the car of gud-tag-frame. This may be a file name, a tag name, or | 172 ;; by the car of gud-tag-frame. This may be a file name, a tag name, or |
173 ;; something else. It would be good if it also copied the Gud menubar entry. | 173 ;; something else. It would be good if it also copied the Gud menubar entry. |
174 | 174 |
175 ;; ====================================================================== | 175 ;; ====================================================================== |
176 ;; speedbar support functions and variables. | 176 ;; speedbar support functions and variables. |
177 (eval-when-compile (require 'speedbar)) | |
178 | |
177 (defvar gud-last-speedbar-buffer nil | 179 (defvar gud-last-speedbar-buffer nil |
178 "The last GUD buffer used.") | 180 "The last GUD buffer used.") |
179 | 181 |
180 (defvar gud-last-speedbar-stackframe nil | 182 (defvar gud-last-speedbar-stackframe nil |
181 "Description of the currently displayed GUD stack. | 183 "Description of the currently displayed GUD stack. |
182 t means that there is no stack, and we are in display-file mode.") | 184 t means that there is no stack, and we are in display-file mode.") |
185 | |
186 (defvar gud-speedbar-key-map nil | |
187 "Keymap used when in the buffers display mode.") | |
188 | |
189 (defun gud-install-speedbar-variables () | |
190 "Install those variables used by speedbar to enhance gud/gdb." | |
191 (if gud-speedbar-key-map | |
192 nil | |
193 (setq gud-speedbar-key-map (speedbar-make-specialized-keymap)) | |
194 | |
195 (define-key gud-speedbar-key-map "j" 'speedbar-edit-line) | |
196 (define-key gud-speedbar-key-map "e" 'speedbar-edit-line) | |
197 (define-key gud-speedbar-key-map "\C-m" 'speedbar-edit-line))) | |
183 | 198 |
184 (defvar gud-speedbar-menu-items | 199 (defvar gud-speedbar-menu-items |
185 ;; Note to self. Add expand, and turn off items when not available. | 200 ;; Note to self. Add expand, and turn off items when not available. |
186 '(["Jump to stack frame" speedbar-edit-line t]) | 201 '(["Jump to stack frame" speedbar-edit-line t]) |
187 "Additional menu items to add the the speedbar frame.") | 202 "Additional menu items to add the the speedbar frame.") |
203 | |
204 ;; Make sure our special speedbar mode is loaded | |
205 (if (featurep 'speedbar) | |
206 (gud-install-speedbar-variables) | |
207 (add-hook 'speedbar-load-hook 'gud-install-speedbar-variables)) | |
188 | 208 |
189 (defun gud-speedbar-buttons (buffer) | 209 (defun gud-speedbar-buttons (buffer) |
190 "Create a speedbar display based on the current state of GUD. | 210 "Create a speedbar display based on the current state of GUD. |
191 If the GUD BUFFER is not running a supported debugger, then turn | 211 If the GUD BUFFER is not running a supported debugger, then turn |
192 off the specialized speedbar mode." | 212 off the specialized speedbar mode." |
485 (defun gud-gdb-get-stackframe (buffer) | 505 (defun gud-gdb-get-stackframe (buffer) |
486 "Extract the current stack frame out of the GUD GDB BUFFER." | 506 "Extract the current stack frame out of the GUD GDB BUFFER." |
487 (let ((newlst nil) | 507 (let ((newlst nil) |
488 (gud-gdb-fetched-stack-frame-list nil)) | 508 (gud-gdb-fetched-stack-frame-list nil)) |
489 (gud-gdb-run-command-fetch-lines "backtrace" buffer) | 509 (gud-gdb-run-command-fetch-lines "backtrace" buffer) |
490 (if (string-match "No stack" (car gud-gdb-fetched-stack-frame-list)) | 510 (if (and (car gud-gdb-fetched-stack-frame-list) |
511 (string-match "No stack" (car gud-gdb-fetched-stack-frame-list))) | |
491 ;; Go into some other mode??? | 512 ;; Go into some other mode??? |
492 nil | 513 nil |
493 (while gud-gdb-fetched-stack-frame-list | 514 (while gud-gdb-fetched-stack-frame-list |
494 (let ((e (car gud-gdb-fetched-stack-frame-list)) | 515 (let ((e (car gud-gdb-fetched-stack-frame-list)) |
495 (name nil) (num nil)) | 516 (name nil) (num nil)) |
496 (if (not (or | 517 (if (not (or |
497 (string-match "^#\\([0-9]+\\) +[0-9a-fx]+ in \\([0-9a-zA-Z_]+\\) (" e) | 518 (string-match "^#\\([0-9]+\\) +[0-9a-fx]+ in \\([:0-9a-zA-Z_]+\\) (" e) |
498 (string-match "^#\\([0-9]+\\) +\\([0-9a-zA-Z_]+\\) (" e))) | 519 (string-match "^#\\([0-9]+\\) +\\([:0-9a-zA-Z_]+\\) (" e))) |
499 (if (not (string-match | 520 (if (not (string-match |
500 "at \\([-0-9a-zA-Z_.]+\\):\\([0-9]+\\)$" e)) | 521 "at \\([-0-9a-zA-Z_.]+\\):\\([0-9]+\\)$" e)) |
501 nil | 522 nil |
502 (setcar newlst | 523 (setcar newlst |
503 (list (nth 0 (car newlst)) | 524 (list (nth 0 (car newlst)) |