From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id jtfqHDq+g2TI+yIAWB0awg (envelope-from ) for ; Fri, 09 Jun 2023 20:05:14 -0400 Received: by simark.ca (Postfix, from userid 112) id 614951E124; Fri, 9 Jun 2023 20:05:14 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=MYQ5/kiO; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5CAF61E0D4 for ; Fri, 9 Jun 2023 20:05:13 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A054A3858028 for ; Sat, 10 Jun 2023 00:05:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A054A3858028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1686355512; bh=6LvPiQ1iqpoFp26zSpBlQkeAlK4Fge8pgDhOPDHY+ik=; h=Date:To:Cc:Subject:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=MYQ5/kiOvr0FgooXsfnoU6vLou4PUoU7ArqjU/JFIOiv/59YOtxLWu9tWbKJEclB2 +GL7kAg4nxAaCwnq/sXyE79x4NXnt8tOSLBSgeVqqKGIxoWJ53yTXOKILuVJ6Qzub/ GCq+5vnNgZvDoiVcrq+NvabuQtXq8cYk/vFX4aXs= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 5FD0B3858D3C for ; Sat, 10 Jun 2023 00:04:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5FD0B3858D3C Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-612-UbGxjZY9PY-aaJWUa0J8pQ-1; Fri, 09 Jun 2023 20:04:47 -0400 X-MC-Unique: UbGxjZY9PY-aaJWUa0J8pQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B73A802E58 for ; Sat, 10 Jun 2023 00:04:47 +0000 (UTC) Received: from f38-zws-nv (unknown [10.22.32.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 55A8040CFD00; Sat, 10 Jun 2023 00:04:47 +0000 (UTC) Date: Fri, 9 Jun 2023 17:04:45 -0700 To: Andrew Burgess via Gdb-patches Cc: Andrew Burgess Subject: Re: [PATCH 1/3] gdb: split inferior and thread setup when opening a core file Message-ID: <20230609170445.021dbed2@f38-zws-nv> In-Reply-To: References: Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: , From: Kevin Buettner via Gdb-patches Reply-To: Kevin Buettner Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On Mon, 5 Jun 2023 10:11:07 +0100 Andrew Burgess via Gdb-patches wrote: > I noticed that in corelow.c, when a core file is opened, both the > thread and inferior setup is done in add_to_thread_list. In this > patch I propose hoisting the inferior setup out of add_to_thread_list > into core_target_open. > > The only thing about this change that gave me cause for concern is > that in add_to_thread_list, we only setup the inferior after finding > the first section with a name like ".reg/NN". If we find no such > section then the inferior will never be setup. > > Is this important? > > Well, I don't think so. Back in core_target_open, if there is no > current thread (which there will not be if no ".reg/NN" section was > found), then we look for a thread in the current inferior. If there > are no threads (which there will not be if no ".reg/NN" is found), > then we once again setup the current inferior. > > What I think this means, is that, in all cases, the current inferior > will end up being setup. By moving the inferior setup code earlier in > core_target_open and making it non-conditional, we can remove the > later code that sets up the inferior, we now know this will always > have been done. > > There should be no user visible changes after this commit. > --- > gdb/corelow.c | 62 ++++++++++++++++++++++++--------------------------- > 1 file changed, 29 insertions(+), 33 deletions(-) LGTM. Reviewed-by: Kevin Buettner