From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97045 invoked by alias); 7 Mar 2017 00:18:20 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 97020 invoked by uid 89); 7 Mar 2017 00:18:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=D*ca, simonmarchipolymtlca, simon.marchi@polymtl.ca, D*polymtl.ca X-HELO: mail-qk0-f179.google.com Received: from mail-qk0-f179.google.com (HELO mail-qk0-f179.google.com) (209.85.220.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 07 Mar 2017 00:18:18 +0000 Received: by mail-qk0-f179.google.com with SMTP id 1so182771849qkl.3 for ; Mon, 06 Mar 2017 16:18:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=v4r9nuGJPAznrZoeKzvBkIk8r6vcEQoFa9iCtQap9MY=; b=pZ1vDyEd+ak+5WnD76Vu5or7HjBGqoKzcn8IhEJsebOnpZwHLZsKFhRyi4YObLuZ3d DglNDQV+T3uJOg5Ckul4RHmnXRECV3o+mbOJ55kJfVLyfjI6hK37Zx+tyNdAy4M6G+Xo KKag2iJ/TnlZonHgbB+Z/AX/rQNBU+g0kxIn8M164uSqJ6zWjluNLofxsb+uwfjN//el LgDKWu8yhgk/mQWtFt3/2i9/skv+z0IXURkdELxASNTV6C58/Pz8iPhSVCPviFuMJ6D+ x6W+bbX0X+oKz3SBxOV6Zoo+BfPp+aQf59ERBiC0fQBRRSmXVgqImrXmqYjzUjNEtL12 BBWg== X-Gm-Message-State: AMke39ko5ZP5HpH1iP8YJznpBDVrlQdMkXvkVVyz7DTDSjXEJ4VhNTVWgb7eJVLX+aG92jDDgRGlZ1D0B+RLew== X-Received: by 10.55.99.18 with SMTP id x18mr18793080qkb.185.1488845897116; Mon, 06 Mar 2017 16:18:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.53.226 with HTTP; Mon, 6 Mar 2017 16:18:16 -0800 (PST) In-Reply-To: <6772c1a27c8a5fbd846dd98561184568@polymtl.ca> References: <6772c1a27c8a5fbd846dd98561184568@polymtl.ca> From: Matt Date: Tue, 07 Mar 2017 00:18:00 -0000 Message-ID: Subject: Re: redirect gdbserver stderr/debug vim via gdbserver To: Simon Marchi Cc: gdb@sourceware.org Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2017-03/txt/msg00005.txt.bz2 thanks for the help. Truth is I found a solution today. I first checked if file descriptors were correctly passed to nvim and it seemed so. On the gdb client, I was receiving SIGTTIN and SIGTTOU signals, which after some research revealed to me that the nvim terminal UI was running as a background process. I checked gdbserver code and saw that it was correctly changing the foreground process so the problem had to lie with nvim. Indeed it was running the UI in another process and as such, in background. I've added those 2 lines to neovim src/nvim/tui.c and it worked perfectly, even when redirecting gdbserver stderr ! signal (SIGTTOU, SIG_IGN); if (!tcsetpgrp(data->input.in_fd, getpid())) { perror("tcsetpgrp failed"); } Thanks for the help Cheers Matt 2017-03-07 1:12 GMT+01:00 Simon Marchi : > On 2017-03-03 19:09, Matt wrote: >> >> Hi, >> >> I am trying to debug a console application (neovim) with gdbserver. >> I've tried turning off all debug info from gdbserver (via monitor set >> debug/remote-debug ...), yet I still see "Detaching from process" >> mixed up with the debugged CLI application. > > > If it's just a cosmetic thing and want to clean up nvim's UI, you can type > ctrl-L to make nvim redraw it. > > I don't think it's possible currently to make gdbserver silent or output > somewhere else than stderr. The easiest workaround, if that fits your > needs, would be to first start nvim and then attach gdbserver from another > terminal. e.g.: > > $ gdbserver --once --attach :1234 $(pidof nvim) > > If you need to debug a problem that happens at the startup of the program, > then it's not ideal. You can always resort to adding a sleep at the > beginning to give you time to attach, or a while loop on a volatile variable > that you change from GDB to let the program run. > >> In order to make these >> messages disappear, I tried redirecting gdbserver stderr (zsh) to >> 'temp': >> $ gdbserver localhost:7777 ./build/bin/nvim toto 2>temp >> on the other side (same computer) I connect with: >> $ gdb ./build/bin/nvim >> (gdb) target remote :7777 >> (gdb) c >> >> but then nothing appears on the gdbserver terminal, i.e., I can't see >> neovim interface. Why is that ? > > > I don't know, but I would assume that nvim inherits that redirected stderr, > maybe that's not good. > > Simon