From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686355489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6LvPiQ1iqpoFp26zSpBlQkeAlK4Fge8pgDhOPDHY+ik=; b=V+6rkeFHEHXj1fN2ezHlLS7HL5o6GFpExEObhY1b1HzaQNcqMrBLm4F7HTDBMVT0KfYWZE HladJL5gSL7IqRjymzjCnKDWY6nlZv+/wADb8WDo3Xk0Lqy7KXh/YQbyQwAJipdhGzD+D+ 6OEzNrGex7Cv7Zw3ekd40MjbH3pOiAo= 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 From: Kevin Buettner 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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