From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id B456E388C009 for ; Thu, 6 May 2021 16:14:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B456E388C009 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wm1-x332.google.com with SMTP id j3-20020a05600c4843b02901484662c4ebso5627645wmo.0 for ; Thu, 06 May 2021 09:14:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=nvXlfMeWdfhxPYhOJsBo6t+sV+0RZClVJ2cgWmvV9pY=; b=IYuWpLoz1BU7fJ1qjhEEob9PuvyGl5yS5moGif20rflQ4nGa+ZmzeXPuyEO07beE6l /4ipfz1O55K34m745s1Z2Cz5/HphH83PCxx8vn3An0Sdmvlwp9MqiSfee4iGSGtqqAx0 cCKhKd+5NzlXlmfVk6V3WcONIzOP+GejSJSBL1rp35lhaGgSBGhlk3n5RHihrbT9aoNy UHmtrTSwHvISh4wDulFwWGIX91LpQClMQ02bcMGsSpcjE6sEwHSKLgH3uDcIByu3YHPa nhLsFABuM3DrTl3JxP2xP2XWPwNC4mihZKP94WprFCIr8B39SGerQTtEE4jR19fGGCTi rkIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=nvXlfMeWdfhxPYhOJsBo6t+sV+0RZClVJ2cgWmvV9pY=; b=fwQv66KNc5fzbi5G9RNT+VgA0WPDM1+PB/zST5N5K9SvtGjWK555fBuZMsFgwMeS1G oYNIkeJkZeXIUvJfFvDzvcJdaKR2ZXwHf69fTxgHAaXkpMuqcH82AvkRSsWGXRNdl3rZ A1vYJrpWxoGomGrZBBJMK8aKDRa415+krngQBcqY3clbjccipVluvz6tYXwfLIGlebYT IERae7N1pDeXHaXZvgmJVtDmwF49PMkOAFFYrC2gtNciaXIE6F/4sgLpU4fehf/0xC1Z wj6v89zg1KiIsSk/R+qRNeD8Dtwp8bZYhBcbxIOZO+7Xl813F/GYpRKUFMdqTbrnEuqh iAoQ== X-Gm-Message-State: AOAM5306JtQZVN0Co3H/lEVCNUegQM2KjY3lIOimcx6OOoPku4G6RyuT 86qtgeCx/U8YVtKqRh+doBrD8KzGW58Kfg== X-Google-Smtp-Source: ABdhPJxuSTGqYcWllh7K9zGUGwZFQej2TdyS1T3X9shN1N/wBU35/CWGRo8t7yH3pEQrtF74Iqa4KQ== X-Received: by 2002:a7b:cb82:: with SMTP id m2mr16227218wmi.105.1620317682880; Thu, 06 May 2021 09:14:42 -0700 (PDT) Received: from localhost (host109-151-46-70.range109-151.btcentralplus.com. [109.151.46.70]) by smtp.gmail.com with ESMTPSA id 3sm3744543wms.30.2021.05.06.09.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 May 2021 09:14:42 -0700 (PDT) Date: Thu, 6 May 2021 17:14:41 +0100 From: Andrew Burgess To: Simon Marchi Cc: gdb-patches@sourceware.org, Simon Marchi Subject: Re: [PATCH 1/5] gdb: make target_close check that the target isn't pushed in all inferiors Message-ID: <20210506161441.GE6612@embecosm.com> References: <20210506142806.30363-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210506142806.30363-1-simon.marchi@polymtl.ca> X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 17:14:28 up 3 days, 5:08, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 16:14:45 -0000 * Simon Marchi via Gdb-patches [2021-05-06 10:28:02 -0400]: > From: Simon Marchi > > The target_close function currently checks that the target to be closed > isn't pushed in the current inferior: > > gdb_assert (!current_inferior ()->target_is_pushed (targ)); > > When a target is closed, it's normally because its refcount has dropped > to 0, because it's not used in any inferior anymore. I think it would > make sense to change that assert to not only check in the current > inferior, but to check in all inferiors. It would be quite bad (and a > bug) to close a target while it's still pushed in one of the non-current > inferiors. > > gdb/ChangeLog: > > * target.c (target_close): Check in all inferiors that the > target is not pushed. LGTM. Thanks, Andrew > > Change-Id: I6e37fc3f3476a0593da1e476604642b2de90f1d5 > --- > gdb/target.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/gdb/target.c b/gdb/target.c > index 1f0741471d82..00f0acde7586 100644 > --- a/gdb/target.c > +++ b/gdb/target.c > @@ -3734,7 +3734,8 @@ debug_target::info () const > void > target_close (struct target_ops *targ) > { > - gdb_assert (!current_inferior ()->target_is_pushed (targ)); > + for (inferior *inf : all_inferiors ()) > + gdb_assert (!inf->target_is_pushed (targ)); > > fileio_handles_invalidate_target (targ); > > -- > 2.30.1 >