unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* GDB over TRAMP: problem with user I/O
@ 2017-12-06 14:18 Vladilen Kozin
  2017-12-10 10:19 ` Michael Albinus
       [not found] ` <87y3mar6p9.fsf@aol.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Vladilen Kozin @ 2017-12-06 14:18 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-15 16:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-06 14:18 GDB over TRAMP: problem with user I/O Vladilen Kozin
2017-12-10 10:19 ` Michael Albinus
2017-12-15 16:38   ` Vladilen Kozin
     [not found] ` <87y3mar6p9.fsf@aol.com>
2017-12-10 15:16   ` Michael Albinus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).