changeset 54729:7bfccd78beed

(gdb-use-inferior-io-buffer): New option. (gdb-ann3, gdb-send, gdb-starting, gdb-stopping) (gdb-setup-windows): Only use separate IO buffer if required.
author Nick Roberts <nickrob@snap.net.nz>
date Mon, 05 Apr 2004 21:45:28 +0000
parents 51c3bc39a016
children c33e4ac43939
files lisp/progmodes/gdb-ui.el
diffstat 1 files changed, 26 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gdb-ui.el	Mon Apr 05 21:44:38 2004 +0000
+++ b/lisp/progmodes/gdb-ui.el	Mon Apr 05 21:45:28 2004 +0000
@@ -28,10 +28,11 @@
 ;; This mode acts as a graphical user interface to GDB. You can interact with
 ;; GDB through the GUD buffer in the usual way, but there are also further
 ;; buffers which control the execution and describe the state of your program.
-;; It separates the input/output of your program from that of GDB and displays
-;; expressions and their current values in their own buffers. It also uses
-;; features of Emacs 21 such as the display margin for breakpoints, and the
-;; toolbar (see the GDB Graphical Interface section in the Emacs info manual).
+;; It separates the input/output of your program from that of GDB, if
+;; required, and displays expressions and their current values in their own
+;; buffers. It also uses features of Emacs 21 such as the display margin for
+;; breakpoints, and the toolbar (see the GDB Graphical Interface section in
+;; the Emacs info manual).
 
 ;; Start the debugger with M-x gdba.
 
@@ -131,6 +132,11 @@
   :type 'boolean
   :group 'gud)
 
+(defcustom gdb-use-inferior-io-buffer nil
+ "Non-nil means display output from the inferior in a separate buffer."
+  :type 'boolean
+  :group 'gud)
+
 (defun gdb-ann3 ()
   (setq gdb-debug-log nil)
   (set (make-local-variable 'gud-minor-mode) 'gdba)
@@ -181,7 +187,7 @@
   (mapc 'make-local-variable gdb-variables)
   (setq gdb-buffer-type 'gdba)
   ;;
-  (gdb-clear-inferior-io)
+  (if gdb-use-inferior-io-buffer (gdb-clear-inferior-io))
   ;;
   (if (eq window-system 'w32)
       (gdb-enqueue-input (list "set new-console off\n" 'ignore)))
@@ -604,7 +610,9 @@
 (defun gdb-send (proc string)
   "A comint send filter for gdb.
 This filter may simply queue output for a later time."
-  (gdb-enqueue-input (concat string "\n")))
+  (if gud-running
+      (process-send-string proc (concat string "\n"))
+    (gdb-enqueue-input (concat string "\n"))))
 
 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it
 ;; is a query, or other non-top-level prompt.
@@ -742,17 +750,19 @@
      ((eq sink 'user)
       (progn
 	(setq gud-running t)
-	(gdb-set-output-sink 'inferior)))
+	(if gdb-use-inferior-io-buffer
+	    (gdb-set-output-sink 'inferior))))
      (t (error "Unexpected `starting' annotation")))))
 
 (defun gdb-stopping (ignored)
   "An annotation handler for `exited' and other annotations which say that I/O
 for the subprocess is now GDB, not the program being debugged."
-  (let ((sink (gdb-get-output-sink)))
-    (cond
-     ((eq sink 'inferior)
-      (gdb-set-output-sink 'user))
-     (t (error "Unexpected stopping annotation")))))
+  (if gdb-use-inferior-io-buffer
+      (let ((sink (gdb-get-output-sink)))
+	(cond
+	 ((eq sink 'inferior)
+	  (gdb-set-output-sink 'user))
+	 (t (error "Unexpected stopping annotation"))))))
 
 (defun gdb-frame-begin (ignored)
   (let ((sink (gdb-get-output-sink)))
@@ -1657,9 +1667,10 @@
 	 (gud-find-file gdb-main-file))
      (gdb-get-create-buffer 'gdb-assembler-buffer)))
   (setq gdb-source-window (get-buffer-window (current-buffer)))
-  (split-window-horizontally)
-  (other-window 1)
-  (switch-to-buffer (gdb-inferior-io-name))
+  (when gdb-use-inferior-io-buffer
+    (split-window-horizontally)
+    (other-window 1)
+    (switch-to-buffer (gdb-inferior-io-name)))
   (other-window 1)
   (switch-to-buffer (gdb-stack-buffer-name))
   (split-window-horizontally)