From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50406 invoked by alias); 26 Jul 2016 19:32:47 -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 50393 invoked by uid 89); 26 Jul 2016 19:32:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=eof, EOF, Luck, luck! X-HELO: mail-pf0-f195.google.com Received: from mail-pf0-f195.google.com (HELO mail-pf0-f195.google.com) (209.85.192.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 26 Jul 2016 19:32:36 +0000 Received: by mail-pf0-f195.google.com with SMTP id i6so450914pfe.0 for ; Tue, 26 Jul 2016 12:32:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kfvcU8/6/8D57451i9HQ3cm796Szh6BsmCKGcjNc7uY=; b=VMlXDUKaxQAW25JSIrMFFDr3fanGJFrF1uQSl+35Af8vcdJWQpQMYZyYqvccJg78YC QCa3um8kCHHT/FPlmck7e/FdRRiQ1IHKolFvZnLbu2bzV0XtJxdb+ffU7TppqPaoSKSH /wfRIBSUWX5UmtZpVqR4anqUIUFY4r5gHZlVHt5SShxvYyMAqTImnIepuzcggcSk+Yr2 8nROH+uRCOo+Pv7tI+sGQh91uFSTERaDD3zFbtZ/LMpr4zo7A8gtdbZpQ4D1H0IxwDTO zoAeErh6L5QJKdZjiqJyYuXtCiSXSkRAxAX5xBaF0olhc03roWkuXc3PFLPS0e/90jRV c5Ug== X-Gm-Message-State: AEkoousi19Gl1GtsjMs9jxwtb9QrcDa29icobxgi/BpAuzFwpm2GkoK+wF+99BmORP9aDQ== X-Received: by 10.98.66.209 with SMTP id h78mr42653524pfd.11.1469561554867; Tue, 26 Jul 2016 12:32:34 -0700 (PDT) Received: from xubuntu.brasko.net (ip70-181-32-92.ri.ri.cox.net. [70.181.32.92]) by smtp.gmail.com with ESMTPSA id 89sm3320802pft.96.2016.07.26.12.32.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jul 2016 12:32:34 -0700 (PDT) Date: Tue, 26 Jul 2016 19:32:00 -0000 From: Bob Rossi To: Marc Khouzam Cc: Simon Marchi , Pedro Alves , "gdb@sourceware.org" Subject: Re: Is there a way to unset inferior-tty? Message-ID: <20160726193231.GD989@xubuntu.brasko.net> References: <302246af-a394-4a76-5223-5cac924bda9a@redhat.com> <9560791fd070c79f7ab54e5e7b63d433@simark.ca> <20160726184303.GB989@xubuntu.brasko.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-07/txt/msg00031.txt.bz2 On Tue, Jul 26, 2016 at 07:22:34PM +0000, Marc Khouzam wrote: > > On Sat, Jul 02, 2016 at 02:04:39PM +0000, Marc Khouzam wrote: > > > > > I think this should just be fixed to work. > > > > > > > > > > The fix should be very similar to this: > > > > > > > > > > > > > > > https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=811a659a779fdf93293fe1105d99e9db171a8b68 > > > > > > > > > > Thanks, > > > > > Pedro Alves > > > > > > > > Hi Marc, > > > > > > > > Here's a patch. If you like it I'll submit it to gdb-patches with > > > > ChangeLog and all. > > > > > > Thanks! Might as well submit it. > > > > > > In the end I moved to a more complete solution for eclipse. Right > > > after an inferior starts, eclipse will reset the tty to a new and > > > valid value; that way, if the user does a 'run', the tty will already > > > be properly set _and_ will direct inferior output to a valid eclipse > > > console. > > > > I do the same thing in CGDB. > > Great, that helps confirm this is a good approach. > > Do you handle the output of a second inferior? > If the user does 'add-inferior' and then runs it, > I was planning on redirecting that new output to a > new Eclipse console. This is causing me some > trouble though because when the new inferior > starts, I don't know if it was due to a 'run' or > an 'attach', so I'm not sure if I should be expecting > some output or not. > > Have you seen this too? Here's how I solved it, it's sort of ugly. I create a pty in CGDB and tell GDB to assign the inferior to it, using tty /dev/... The inferior then writes to one end of the pty, and CGDB has a select loop which reads from the other end. If GDB or the inferior closes the file handle, I'll read an EOF in the select loop. In that case, I simply create a new pty and rerun the tty command. With that approach in mind, i'm not sure who closed the handle or why. I just open a new one and assign it. I didn't know, until today, that multiple inferiors could exist! Does GDB even support one /tty per inferior in that case? CGDB certainly doesn't support this mode. Good Luck! Thanks, Bob Rossi