From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 73943 invoked by alias); 23 Oct 2018 20:56:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 73918 invoked by uid 89); 23 Oct 2018 20:56:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2285 X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 23 Oct 2018 20:56:47 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w9NKucR2010952 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Oct 2018 16:56:43 -0400 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 123461E4C2; Tue, 23 Oct 2018 16:56:37 -0400 (EDT) Subject: Re: [PATCH 1/3] Pass inferior to terminal_save_inferior To: Pedro Alves Cc: gdb-patches@sourceware.org References: <20181016033835.17594-1-simon.marchi@polymtl.ca> <3cd4ddb6-b791-858e-58c9-721b6f7177af@redhat.com> <7a8c48b3033d53f0c6031843b6424ba7@polymtl.ca> <048ffbfd-e9b8-d223-f59d-d0b7dc139f04@redhat.com> From: Simon Marchi Message-ID: <92a6ed25-426a-ef57-604a-1c9de3d83f2e@polymtl.ca> Date: Tue, 23 Oct 2018 20:56:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <048ffbfd-e9b8-d223-f59d-d0b7dc139f04@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00523.txt.bz2 On 2018-10-23 7:11 a.m., Pedro Alves wrote: > Oh, in that case it'd be clearer to not bundle it in the same series then. Right, I happened to write it at the same time (when trying to figure out how things worked) but it's not actually related. >> Can't you access the inferior's target stack directly instead of changing the current inferior? > > I can for the call to the top target, but then the problem is the beneath() > calls in all the target-delegates.c delegating implementations. E.g. here: > > void > -target_ops::terminal_save_inferior () > +target_ops::terminal_save_inferior (inferior *arg0) > { > - this->beneath ()->terminal_save_inferior (); > + this->beneath ()->terminal_save_inferior (arg0); > ^^^^^^^^^ > } > > because beneath() looks at the target stack of the current > inferior. It would need to look for the target beneath in > the target stack of the arg0 inferior instead. Otherwise > you start the top target call in inferior B, and then > cross the the beneath target of inferior A (the current inferior). > Whoops. At some point in the branch I made target_ops::beneath > take an optional inferior pointer, but when I stumbled on this > issue in target-delegates.c I ended up reverting it, as it > wasn't easy to fix. I think that we could maybe teach > make-target-delegates to automatically emit > > void > target_ops::method (inferior *arg0) > { > this->beneath (arg0)->method (arg0); > } > > and: > > void > target_ops::method (thread_info *arg0) > { > this->beneath (arg0->inf)->method (arg0); > } > > iff the method's first parameter is an inferior or thread_info > pointer. But that was just an idea, I never toyed with it, > because it would be a detour. So I gave up on the inferior > parameter to target beneath, and thought I'd better focus instead > of getting the multi-target basics in first, even if that means we > need to swap current inferior/thread here and there, as usual. Ok I understand. At some point I think it would be very nice if it "just worked", but I totally understand the need to go by small increment. In that case, I think I'll drop patches 1 and 2, since they don't really provide any benefit at the moment, and just cause complications going further. Simon