help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gdb mode with gdb command from the docker


From: William Xu
Subject: Re: gdb mode with gdb command from the docker
Date: Tue, 20 Oct 2020 21:54:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin)

Eli Zaretskii <eliz@gnu.org> writes:

>> Also as I mentioned, if I run the gdbWrapper directly outside emacs, on
>> the terminal app (i'm running Terminal on macOS), there is no problem
>> seen at all.
>
> Of course: when the program is run from GDB under Emacs, the standard
> output and standard input of the program are connected to a PTY
> (pseudo-terminal), not to a real console device.  So it is a small
> wonder that the behavior is different.
>
>> I think it is more likely something wrong inside emacs's
>> gdb mode.
>
> Maybe so, but I don't see what would cause this in gdb mode.

I manage to make it work by disabling the gdb "-inferior-tty-set"
command in gdb-inferior-io--init-proc.

It seems that the problem is that, process.c::allocate_pty allocates a
pseudo-terminal for the *host*, I can find the same tty name in /dev on
the host. It then confuses the gdb command from the docker container.

Is there any reason to call "-inferior-tty-set" commands here? Can we
simply remove it? 

---------------------------------8<-------------------------------------
 $ git diff
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index e785acd284..63dae4b248 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1590,12 +1590,13 @@ gdb-inferior-io--init-proc
   (set-process-filter proc 'gdb-inferior-filter)
   (set-process-sentinel proc 'gdb-inferior-io-sentinel)
   ;; The process can run on a remote host.
-  (let ((tty (or (process-get proc 'remote-tty)
-                (process-tty-name proc))))
-    (unless (or (null tty)
-               (string= tty ""))
-      (gdb-input
-       (concat "-inferior-tty-set " tty) 'ignore))))
+  ;; (let ((tty (or (process-get proc 'remote-tty)
+  ;;            (process-tty-name proc))))
+  ;;   (unless (or (null tty)
+  ;;           (string= tty ""))
+  ;;     (gdb-input
+  ;;      (concat "-inferior-tty-set " tty) 'ignore)))
+  )
 
 (defun gdb-inferior-io-sentinel (proc _str)
   (when (eq (process-status proc) 'failed)
---------------------------------8<-------------------------------------

-- 
William




reply via email to

[Prev in Thread] Current Thread [Next in Thread]