From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118495 invoked by alias); 23 Oct 2018 09:01:34 -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 117789 invoked by uid 89); 23 Oct 2018 09:00:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS,TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy=H*F:D*ca, H*u:1.3.6, H*UA:1.3.6, H*r:112 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 09:00:40 +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 w9N90XDA018626 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 23 Oct 2018 05:00:38 -0400 Received: by simark.ca (Postfix, from userid 112) id 860031EA6F; Tue, 23 Oct 2018 05:00:33 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 7B7E01E50C; Tue, 23 Oct 2018 05:00:32 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 23 Oct 2018 09:01:00 -0000 From: Simon Marchi To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/3] Pass inferior to terminal_save_inferior In-Reply-To: <3cd4ddb6-b791-858e-58c9-721b6f7177af@redhat.com> References: <20181016033835.17594-1-simon.marchi@polymtl.ca> <3cd4ddb6-b791-858e-58c9-721b6f7177af@redhat.com> Message-ID: <7a8c48b3033d53f0c6031843b6424ba7@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00496.txt.bz2 On 2018-10-22 16:54, Pedro Alves wrote: > On 10/16/2018 04:38 AM, Simon Marchi wrote: >> Instead of relying on the current inferior, pass an inferior pointer >> to >> the target implementing terminal_save_inferior. There should be no >> change in behavior. >> > > Your original patch 3/3 ended up not using the inferior pointer. :-) > > I suppose that this doesn't hurt, like the equivalent target_detach > change. Well, the original 3/3 patch doesn't change the implementation of terminal_save_inferior, it changes the inferior_exit observer, so it's not really related to this change. >> I added documentation to terminal_save_inferior, as I understand it >> (maybe I understood it wrong, so please take a look). > > That looks good. (please recall to update commit log.) > >> diff --git a/gdb/target.c b/gdb/target.c >> index 2d98954b54ac..93d16b90f179 100644 >> --- a/gdb/target.c >> +++ b/gdb/target.c >> @@ -511,10 +511,7 @@ target_terminal_is_ours_kind >> (target_terminal_state desired_state) >> ALL_INFERIORS (inf) >> { >> if (inf->terminal_state == target_terminal_state::is_inferior) >> - { >> - set_current_inferior (inf); >> - current_top_target ()->terminal_save_inferior (); >> - } >> + current_top_target ()->terminal_save_inferior (inf); >> } > With multi-target, current_top_target() will depend on > the current inferior, so I'll need to put that > set_current_inferior call back. Can't you access the inferior's target stack directly instead of changing the current inferior? Simon