Cross-posting from emacs-help, since unfrotunately I haven't received any pointers. This may not even be a bug but some weird interplay between TRAMP / GDB / IO buffer or TTY.
Ran into problem with GDB over TRAMP. To me it looks like a bug in TRAMP but could be that I've missed some settings required for such setup. Hence posting here instead of bugs for now.
Setup is described in more details below, but in a nutshell: - target machine with code to debug runs a vanilla Linux, - Emacs on the host machine starts multi window GDB session over TRAMP, works fine, - excep I/O buffer gets intercepted by (probably) remote shell, so user input can't be passed to the process being debugged (see below).
Source code being debugged -------------------------- #include <stdio.h> #include <stdlib.h>
int main() { int num; printf ("Enter the number: "); scanf ("%d", &num );
Remote debug session started from Host -------------------------------------- M-x gdb gdb -i=mi /fact:/vagrant/debug
Relevant GDB windows:
*gud-debug* ----------- Reading symbols from /vagrant/debug...done. (gdb) run Starting program: /vagrant/debug
*input/output of debug* ----------------------- &"warning: GDB: Failed to set controlling terminal: Operation not permitted\n" Enter the number: 3 /bin/sh: 22: 3: not found ///fe8a2e50a45c66d598f9ae7a276764a2#$
Notice how the input prompt in IO buffer appears fine and awaits for user entry, but said entry gets snatched by /bin/sh and wouldn't let me send it to the process debugged.
Note that running the same debug session locally works out fine, user input doesn't get stolen.
I managed to reproduce this with absolutely barebones setup.
Emacs Host ---------- GNU Emacs 25.3.1 (x86_64-apple-darwin17.2.0, NS appkit-1561.10 Version 10.13.1 (Build 17B48)) of 2017-11-12
Debug Target ------------ address@hidden:/vagrant$ uname -a Linux precise64 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux