diff lisp/progmodes/gud.el @ 53345:c3cf2ae8eba0

(gud-gdb-command-name): Set default to "gdb --annotate=3". (gud-gdb-marker-filter): Look out for annotations. (gdb-first-pre-prompt): New variable. Remove trailing white space.
author Nick Roberts <nickrob@snap.net.nz>
date Sun, 28 Dec 2003 13:51:51 +0000
parents d0090d33e7d8
children 03788e9f1efb
line wrap: on
line diff
--- a/lisp/progmodes/gud.el	Sun Dec 28 13:50:43 2003 +0000
+++ b/lisp/progmodes/gud.el	Sun Dec 28 13:51:51 2003 +0000
@@ -319,10 +319,10 @@
 If the GUD BUFFER is not running a supported debugger, then turn
 off the specialized speedbar mode."
   (let ((minor-mode (with-current-buffer buffer gud-minor-mode)))
-    (cond 
+    (cond
      ((eq minor-mode 'gdba)
       (when (or gdb-var-changed
-		(not (save-excursion 
+		(not (save-excursion
 		       (goto-char (point-min))
 		       (let ((case-fold-search t))
 			 (looking-at "Watch Expressions:")))))
@@ -339,8 +339,8 @@
 		  (speedbar-make-tag-line 'bracket ?? nil nil
 					  (concat (car var) "\t" (nth 4 var))
 					  'gdb-edit-value
-					  nil 
-					  (if (and (nth 5 var) 
+					  nil
+					  (if (and (nth 5 var)
 						   gdb-show-changed-values)
 					      'font-lock-warning-face
 					    nil) depth)
@@ -354,7 +354,7 @@
 					nil nil depth)))
 	    (setq var-list (cdr var-list))))
 	(setq gdb-var-changed nil)))
-     (t (if (and (save-excursion 
+     (t (if (and (save-excursion
 		   (goto-char (point-min))
 		   (looking-at "Current Stack"))
 		 (equal gud-last-last-frame gud-last-speedbar-stackframe))
@@ -406,7 +406,7 @@
 ;; History of argument lists passed to gdb.
 (defvar gud-gdb-history nil)
 
-(defcustom gud-gdb-command-name "gdb --fullname"
+(defcustom gud-gdb-command-name "gdb --annotate=3"
   "Default command to execute an executable under the GDB debugger."
    :type 'string
    :group 'gud)
@@ -447,6 +447,19 @@
        ;; Set the accumulator to the remaining text.
        gud-marker-acc (substring gud-marker-acc (match-end 0))))
 
+    (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc)
+      (when (string-equal (match-string 1 gud-marker-acc) "prompt")
+	(require 'gdb-ui)
+	(gdb-prompt nil))
+      (setq
+       ;; Append any text before the marker to the output we're going
+       ;; to return - we don't include the marker in this text.
+       output (concat output
+		      (substring gud-marker-acc 0 (match-beginning 0)))
+
+       ;; Set the accumulator to the remaining text.
+       gud-marker-acc (substring gud-marker-acc (match-end 0))))
+
     ;; Does the remaining text look like it might end with the
     ;; beginning of another marker?  If it does, then keep it in
     ;; gud-marker-acc until we receive the rest of it.	Since we
@@ -492,6 +505,8 @@
      gud-minibuffer-local-map nil
      hist-sym)))
 
+(defvar gdb-first-pre-prompt t)
+
 ;;;###autoload
 (defun gdb (command-line)
   "Run gdb on program FILE in buffer *gud-FILE*.
@@ -522,8 +537,8 @@
   (local-set-key "\C-i" 'gud-gdb-complete-command)
   (setq comint-prompt-regexp "^(.*gdb[+]?) *")
   (setq paragraph-start comint-prompt-regexp)
-  (run-hooks 'gdb-mode-hook)
-  )
+  (setq gdb-first-pre-prompt t)
+  (run-hooks 'gdb-mode-hook))
 
 ;; One of the nice features of GDB is its impressive support for
 ;; context-sensitive command completion.  We preserve that feature