GDB/MI stream separation

Nick Roberts nick@nick.uklinux.net
Sun Feb 9 15:24:00 GMT 2003


Jim Blandy wrote:

 >                        ...One approach is to use GDB's 'tty' command
 > to have the inferior run on a different tty than GDB itself.  gdb-ui
 > can create a separate process buffer for the inferior's I/O, call
 > process-tty-name to get the name of its pseudo-tty, and then pass that
 > to GDB's 'tty' command.

I have only seen the tty command work in one direction. That is, I can send
the inferior's output to another terminal/buffer easily enough but I can't
seem to receive its input. I could, however, do omething like:

(defun io-mode ()
  "Major mode for io.

\\{comint-mode-map}"
  (make-comint "io-process""/bin/cat")
  (setq major-mode 'io-mode)
  (setq mode-name "Debuggee I/O")
  (setq comint-input-sender 'io-sender))

(defun io-sender (proc string)
  (let ((gud-proc (get-buffer-process  gud-comint-buffer)))
  (save-excursion
    (set-buffer (process-buffer gud-proc))
    (process-send-string gud-proc string)
    (process-send-string gud-proc "\n"))))

(gud-def gud-run (concat "-exec-run > " 
			 (process-tty-name (get-process "io-process"))))

so that `>' sends the inferior's output to another buffer and
process-send-string sends the inferior's input back to GDB. This would
not work if the run command was passed to GDB through the GUD buffer.

Stream separation might not be essential but it would be nice to do if there's
an easy way.

Nick



More information about the Gdb mailing list