changeset 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 8d8e664f1f6c
children ca02f300fc41
files lisp/gud.el
diffstat 1 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gud.el	Fri Jul 10 16:46:59 1998 +0000
+++ b/lisp/gud.el	Fri Jul 10 16:47:28 1998 +0000
@@ -174,6 +174,8 @@
 
 ;; ======================================================================
 ;; speedbar support functions and variables.
+(eval-when-compile (require 'speedbar))
+
 (defvar gud-last-speedbar-buffer nil
   "The last GUD buffer used.")
 
@@ -181,11 +183,29 @@
   "Description of the currently displayed GUD stack.
 t means that there is no stack, and we are in display-file mode.")
 
+(defvar gud-speedbar-key-map nil
+  "Keymap used when in the buffers display mode.")
+
+(defun gud-install-speedbar-variables ()
+  "Install those variables used by speedbar to enhance gud/gdb."
+  (if gud-speedbar-key-map
+      nil
+    (setq gud-speedbar-key-map (speedbar-make-specialized-keymap))
+
+    (define-key gud-speedbar-key-map "j" 'speedbar-edit-line)
+    (define-key gud-speedbar-key-map "e" 'speedbar-edit-line)
+    (define-key gud-speedbar-key-map "\C-m" 'speedbar-edit-line)))
+
 (defvar gud-speedbar-menu-items
   ;; Note to self.  Add expand, and turn off items when not available.
   '(["Jump to stack frame" speedbar-edit-line t])
   "Additional menu items to add the the speedbar frame.")
 
+;; Make sure our special speedbar mode is loaded
+(if (featurep 'speedbar)
+    (gud-install-speedbar-variables)
+  (add-hook 'speedbar-load-hook 'gud-install-speedbar-variables))
+
 (defun gud-speedbar-buttons (buffer)
   "Create a speedbar display based on the current state of GUD.
 If the GUD BUFFER is not running a supported debugger, then turn
@@ -487,15 +507,16 @@
   (let ((newlst nil)
 	(gud-gdb-fetched-stack-frame-list nil))
     (gud-gdb-run-command-fetch-lines "backtrace" buffer)
-    (if (string-match "No stack" (car gud-gdb-fetched-stack-frame-list))
+    (if (and (car gud-gdb-fetched-stack-frame-list)
+	     (string-match "No stack" (car gud-gdb-fetched-stack-frame-list)))
 	;; Go into some other mode???
 	nil
       (while gud-gdb-fetched-stack-frame-list
 	(let ((e (car gud-gdb-fetched-stack-frame-list))
 	      (name nil) (num nil))
 	  (if (not (or
-		    (string-match "^#\\([0-9]+\\) +[0-9a-fx]+ in \\([0-9a-zA-Z_]+\\) (" e)
-		    (string-match "^#\\([0-9]+\\) +\\([0-9a-zA-Z_]+\\) (" e)))
+		    (string-match "^#\\([0-9]+\\) +[0-9a-fx]+ in \\([:0-9a-zA-Z_]+\\) (" e)
+		    (string-match "^#\\([0-9]+\\) +\\([:0-9a-zA-Z_]+\\) (" e)))
 	      (if (not (string-match
 			"at \\([-0-9a-zA-Z_.]+\\):\\([0-9]+\\)$" e))
 		  nil