From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Vladilen Kozin Newsgroups: gmane.emacs.help Subject: GDB over TRAMP: problem with user I/O Date: Wed, 6 Dec 2017 14:18:25 +0000 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1512577034 6967 195.159.176.226 (6 Dec 2017 16:17:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 6 Dec 2017 16:17:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 06 17:17:08 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eMcNg-0001Nn-Gz for geh-help-gnu-emacs@m.gmane.org; Wed, 06 Dec 2017 17:17:08 +0100 Original-Received: from localhost ([::1]:56187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMbPQ-0002Pi-5S for geh-help-gnu-emacs@m.gmane.org; Wed, 06 Dec 2017 10:14:52 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMaWs-0000Uy-E1 for help-gnu-emacs@gnu.org; Wed, 06 Dec 2017 09:18:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eMaWq-0003M2-JX for help-gnu-emacs@gnu.org; Wed, 06 Dec 2017 09:18:30 -0500 Original-Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]:36497) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eMaWq-0003Kg-6V for help-gnu-emacs@gnu.org; Wed, 06 Dec 2017 09:18:28 -0500 Original-Received: by mail-lf0-x22e.google.com with SMTP id f20so4421312lfe.3 for ; Wed, 06 Dec 2017 06:18:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=R/CCSD3huF9dYR94Ln1MXTfrJIsFd6LLEAGUnMepD+o=; b=VP+bhLAvZO5sBymJ+TlUCP8S5Q9ho0YYPGrevIK4P1ssLnt0Os8FZ8pySOei3HRV+f g4v9w8A6q923TfYwnmSNx/yc8kgM7Dj0I8lUP6ipOdfk98ktqSLplYXag50W+DHpkQyF Q554hAoLtzvp8+X/83t89ydNEy86knt6NREpOKao0i22pWZ60hhXhcVWXUq+kRW8XcT2 i0ReXZoUeyUF1tRC3hUoUnpQYnVDt3/Y51NRPmQCXEkgNWIZ7wJ7bXPmMe+3eXf/LduU C8Cd/HL5dh6NTY4EGoXhSK5oJ7wvALeQaox6NTzuJCy221px892Z7efCT7aKDjfJOIQT oE6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=R/CCSD3huF9dYR94Ln1MXTfrJIsFd6LLEAGUnMepD+o=; b=F++dZ8uD5wOCtvozuxu7qcbI8bz4M1pQdWgo1RW+BIE+hTetBxse9BT/a93BYgb3an VutzhnNtbQvebucRWukBrD/CAY5E05cWBWuATpUFh4QsDL5LkrsQZAksEQefmVHrXwcx f9ko2scBk1fVRQUl5lNggT/rFvtDwOlKH5ZPF/qOk+tqq2Vne0cZSCdM/on6rgFXjm1U I9UG4Vefczz6Fe5H23EsOFJ4ceO87G6RgWSqKvBHaulyH7fKjD4exzyBWq2OdxnxDk+e jm7ffCvtSIuzELqELJelZx8KOuJ3RsA+0Qrzf1T23HsqGWMyR1JQ6gLEXpKr+nEdnr9Q nOgA== X-Gm-Message-State: AJaThX5vyzEA0D9Hjw8LmPaN6YYEcvTvPsY5VVuYgYWeG7bqPysVx+J2 x9xmOqkzvJTaeqZ1uEhRux+Vzb2POQ36EHAKqMdNmOlA X-Google-Smtp-Source: AGs4zMYHDFxVY1jZYOatNqyx2TsT02iqSfGisozwEQGRfCxP0EVOCrDM8Dza8tsZC5Z4x2ekCRSG+QRrPBYdDcvOIEU= X-Received: by 10.46.91.79 with SMTP id p76mr13741137ljb.22.1512569905801; Wed, 06 Dec 2017 06:18:25 -0800 (PST) Original-Received: by 10.25.206.139 with HTTP; Wed, 6 Dec 2017 06:18:25 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::22e X-Mailman-Approved-At: Wed, 06 Dec 2017 10:14:18 -0500 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:115243 Archived-At: 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 #include 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