From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127048 invoked by alias); 22 Oct 2018 20:54:47 -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 127026 invoked by uid 89); 22 Oct 2018 20:54:47 -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 autolearn=ham version=3.3.2 spammy=relying, is_inferior, terminal_state, Hx-languages-length:1222 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 Oct 2018 20:54:46 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 46A3D300206F; Mon, 22 Oct 2018 20:54:45 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 80471104C529; Mon, 22 Oct 2018 20:54:44 +0000 (UTC) Subject: Re: [PATCH 1/3] Pass inferior to terminal_save_inferior To: Simon Marchi , gdb-patches@sourceware.org References: <20181016033835.17594-1-simon.marchi@polymtl.ca> From: Pedro Alves Message-ID: <3cd4ddb6-b791-858e-58c9-721b6f7177af@redhat.com> Date: Mon, 22 Oct 2018 20:54:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181016033835.17594-1-simon.marchi@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-10/txt/msg00477.txt.bz2 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. > 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. Thanks, Pedro Alves