From: Vladilen Kozin <vladilen.kozin@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: GDB over TRAMP: problem with user I/O
Date: Wed, 6 Dec 2017 14:18:25 +0000 [thread overview]
Message-ID: <CACw=CXORxs7TzRJ1D_UbfbNsWEAb8ENd6KbWcp3NR+N=S_9mrQ@mail.gmail.com> (raw)
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 );
printf("Your number %d\n", num);
exit(0);
}
Makefile executed on Target
---------------------------
CFLAGS = -std=c99 -pedantic -Wall -O2 -fPIC
DEBUG = -g -std=c99 -pedantic -Wall -O0 -fPIC
debug: fact.c
$(CC) $(DEBUG) $(LDFLAGS) -o $@ $< $(LDLIBS)
clean:
$(RM) -rf *.o *.so fact debug debug.dSYM
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
------------
vagrant@precise64:/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
init.el
-------
(require 'gdb-mi)
(require 'tramp)
(setq gdb-many-windows t
gdb-show-main t)
(setq tramp-default-method "ssh"
tramp-default-user "vagrant")
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(unless (file-exists-p (concat user-emacs-directory "elpa/archives/melpa"))
(package-refresh-contents))
(defvar required-packages '(exec-path-from-shell))
(let ((install #'(lambda (package)
(unless (package-installed-p package)
(package-install package))
(require package))))
(message "Installing required packages %s" required-packages)
(mapc install required-packages)
(delete-other-windows))
(exec-path-from-shell-initialize)
Setting tramp-debug-on-error to true, doesn't show anything.
Could anyone help me figure out how to fix this? Or should I post to the
bug list?
Thanks
--
Best regards
Vlad Kozin
next reply other threads:[~2017-12-06 14:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-06 14:18 Vladilen Kozin [this message]
2017-12-10 10:19 ` GDB over TRAMP: problem with user I/O Michael Albinus
2017-12-15 16:38 ` Vladilen Kozin
[not found] ` <87y3mar6p9.fsf@aol.com>
2017-12-10 15:16 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACw=CXORxs7TzRJ1D_UbfbNsWEAb8ENd6KbWcp3NR+N=S_9mrQ@mail.gmail.com' \
--to=vladilen.kozin@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.