From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qQSgHDAqNGpN1A0AWB0awg (envelope-from ) for ; Thu, 18 Jun 2026 13:26:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1781803568; bh=x2Sa+CilC2LVdJOMYUdNv0ov8y/ZMnyGzsfyqXkiH94=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=GfAd85XkjfQlVwX3BkxuaAlyKiODDOvBslV5GS247czYCK0P6zsy6OMw6IJlNkA1m A5J9sFOVfPgrib/0DOT3Zp9BsbTgtwmXuDYMhPIynA+w3ZlmATyAA3nmMXAZy62YOA Hbj755wYpNvwVlsJWqs/2Kz6JRRb2L2mHEOOntYA= Received: by simark.ca (Postfix, from userid 112) id 715001E098; Thu, 18 Jun 2026 13:26:08 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=n6l4Bz4X; dkim-atps=neutral Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6D9781E070 for ; Thu, 18 Jun 2026 13:26:07 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 40AFA4BA798D for ; Thu, 18 Jun 2026 17:26:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40AFA4BA798D Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=n6l4Bz4X Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id CC46E4BA2E13 for ; Thu, 18 Jun 2026 17:25:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC46E4BA2E13 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CC46E4BA2E13 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781803541; cv=none; b=i7bguSxRmJeS9rSwIF/jqfy8Ue9vy9g9/LsktYbiiU+GuksiZH5Mo/lLlkI7E8LFTdQ+plg0WknebfqOa+++j4a/xyOQRmcjEZ5Tscmel8vNxnOOZB+7WGbcWLGLjjeXUgfArd9Sh3uw7noceI3A5ZFHFOFShTN02XuE8Og0K1w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781803541; c=relaxed/simple; bh=x2Sa+CilC2LVdJOMYUdNv0ov8y/ZMnyGzsfyqXkiH94=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=W0/iUXYrTQzFc1nSfg58sS8thUHkNJxh2+ZMqhECjs/zN1eiwwIYhJQhAp1kx0sGiMGfZsidzbJIzxAEH0dQJkNEvg9WzQtbmKbs7xZrMjC/26ZsA2wCxHpJCKcABK4WOuHeZMGkJzc9S3LEPYGY8hNyXeZ/W9VGp2/cDZ1g99c= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=n6l4Bz4X DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC46E4BA2E13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1781803541; bh=x2Sa+CilC2LVdJOMYUdNv0ov8y/ZMnyGzsfyqXkiH94=; h=Date:Subject:To:References:From:In-Reply-To:From; b=n6l4Bz4XHD621ccD3uGrioLWw8Z4rv8QNfQNjV4Y7vSI0sutlqXPygpYFsmiFhoU+ ztdShN3EDVJyt+IQYRvrpcbJJE3ysjayNGabM78bJfrL655Y7Q5w+gmQcJa2y3pTF5 DmnL55QnCW9tlUZz0/noMmQZUdtVGqOOFCZTzXrQ= Received: by simark.ca (Postfix) id 5B75A1E070; Thu, 18 Jun 2026 13:25:41 -0400 (EDT) Message-ID: <3c585153-c89e-422b-9236-daaeb9615f8a@simark.ca> Date: Thu, 18 Jun 2026 13:25:40 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb: return raw frame_info pointer from create_sentinel_frame To: Andrew Burgess , gdb-patches@sourceware.org References: Content-Language: en-US From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 2026-06-18 13:00, Andrew Burgess wrote: > The create_sentinel_frame function is static within frame.c and > currently returns a frame_info_ptr. The frame_info_ptr is created at > the last moment, as part of the 'return' statement. > > Every user of create_sentinel_frame immediately pulls the raw > frame_info pointer out of the frame_info_ptr and then discards the > frame_info_ptr object. > > Creating a frame_info_ptr isn't zero work. Not that I'm trying to > sell this as a performance improvement, the work saved here is > negligible, but it's so obviously redundant in this case that I figure > we can just remove the frame_info_ptr and pass back a raw frame_info > pointer instead. > > This patch changes create_sentinel_frame to return a raw frame_info > pointer, which is what the callers actually want, and avoids the > unnecessary creation and destruction of a frame_info_ptr object. > > There should be no user visible changes after this commit. Your patch looks obviously correct to me, so: Approved-By: Simon Marchi I was wondering if you instead considered making the sentinel_frame global a frame_info_ptr itself. I think there would be a concern in construction ordering, because the frame_info_ptr constructor uses the frame_info_ptr::frame_list list, and that one is defined later in the file, but that would be easy to fix. There are two spots where we do frame_info_ptr (sentinel_frame)) that would be simplified a little bit. But other than that, I don't think it would provide any tangible benefit. Another random thing I noticed while reading the code, do you know why we have this in frame_find_by_id? /* Check for the sentinel frame. */ if (id == frame_id_build_sentinel (0, 0)) return frame_info_ptr (sentinel_frame); Given that sentinel frames are put in the frame stash (see create_sentinel_frame), I don't see why this special case is needed. Moreover, this would only match the sentinel frames constructed with stack and code addresses 0, which I don't think is the typical case. Hmm, it's probably because sentinel frames were not put in the frame cache before my commit here... https://gitlab.com/gnutools/binutils-gdb/-/commit/19f988359a62889b00d67fb59ef8c7d6d759fc98 There is probably something to clean up here. Simon