From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id HooCJa8kNGpKzg0AWB0awg (envelope-from ) for ; Thu, 18 Jun 2026 13:02:39 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jPOcPeQQ; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8666E1E098; Thu, 18 Jun 2026 13:02:39 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 B40F21E070 for ; Thu, 18 Jun 2026 13:02:38 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6BD1C4BA23C2 for ; Thu, 18 Jun 2026 17:02:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BD1C4BA23C2 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jPOcPeQQ Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id DF2204BA2E11 for ; Thu, 18 Jun 2026 17:02:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF2204BA2E11 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DF2204BA2E11 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781802132; cv=none; b=jB/jmK0lT6D2LkmVWfVSieVODy0+OD6QIwLovd2aD6L//897mvdb186DBzRmacqlFOBTpHs9KWbPxn9xBgKEFeYzG/YAQzcGVuPlRstpsAZ5KdjQ6euMUkc9sa5DAIDWq75jYFUyslfewphbipFFXu5uAZuTtrUSdgZsi1NIl3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781802132; c=relaxed/simple; bh=E5fx9Tof2rjMko+uhn15PD4JgqmSCN07GxaA0Gu8r7k=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=okeHj/X+50rrQFYMq2ttTibdKubciGc9kpabzY+p98WtNSnyw7c3FJt2aPlEHie1g6ZBGJt/WGN4cCUELFY9nE3I3OqByKq1ZPdsKDAg0FRSvc5U7yF2wqWNLlY+A2wA7N1PSpFemdbcY3TRxiK/CpvrzbRk9REcWyMLuQYylGY= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jPOcPeQQ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF2204BA2E11 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781802131; 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; bh=jyhj45oXhQh8Mq/1gZQmrlEZjk02cUDNpu3FVwIZ03g=; b=jPOcPeQQKouGmzn4PdGIGgEDg3gryqIYPY3oFPjEvST4HO0oW9RxCmhsvKreQqHUDU/4z0 QYQfOl/OY9loNd65AT0pOdhQmjHdBe9j+4k3do5xiK2fOySXdw6VmRtWr6LfFSwEf420la TcopErjRFnSah58ZlWYu9qsOGBYHTgI= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-492-s4aiEfVKOYS647HjQ5JedA-1; Thu, 18 Jun 2026 13:00:59 -0400 X-MC-Unique: s4aiEfVKOYS647HjQ5JedA-1 X-Mimecast-MFC-AGG-ID: s4aiEfVKOYS647HjQ5JedA_1781802059 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-46250b59ed5so970703f8f.2 for ; Thu, 18 Jun 2026 10:00:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781802058; x=1782406858; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jyhj45oXhQh8Mq/1gZQmrlEZjk02cUDNpu3FVwIZ03g=; b=Fq9z3Ndkqrd6aUOQymEZeiYfdPLpABKIAraVdTR6MrFXOiFnpiU2Kb6cJtS/QtXSE+ hLMsOBf1ug12nP14y+ZA3wUzHsPRiY8r693iXVN39uYxvkGeCGZHTnDEM6GJ3KLhp+ZQ GXBK/T4Mw/mSjSiBL9yT7FiLLuVtdBwupS6aBUF/i0yfBcrGcZvAg5ROpu6SHdMaLJIF BOxwREmFUN3KgOHXGdGHvO65TpW6U/IVN4svCy9T0MxxwTh0gL0WLlvQ2lqyldZhj4Xc aMwn7QU0aAMO4KqXWOovgoti16RUxPltvaPYVWy9UNkhXAl382eYl7j65nPbFJJopRyv K7mQ== X-Gm-Message-State: AOJu0YzVhsXU3MTOCp1Z6FdxsB59JyaBCCtglXm8SOsuzZJgqthmc4uy Ukkrpd9cr/TAWX43TGForW2SSRafdWyxepA5ntzK+SCbLz1Nd/GhhDN+/eEguYq4jwA+ds/o/y0 l30g+yqZEEfxa/1B+tvIxLC1fMkRQt4l8ludT9CYVja9OFtvMD7wRkf/ISJAucHlbJA7TXdn9Ph EvOgylVBom9ks/fl+gdDJSBNzx3Fzr4Dlr1F/Brp2QezQ25xI= X-Gm-Gg: AfdE7cmXoxhWiq2jUXsycmJxmKJ2NAkE2MQG6v5rcXyJCGjQoK4YIUuz9iuO+/uPfZt rW6FnUNukj9cUIPRCqlo9rnini5E/Bcd0bO/4rS6KaCi+OfEepmVMSLbYJe0LWiZMrRNHbGmoD5 PeDg0oxQHH44/Rl1I0uyYlW3zDyMM9CvZvpnMaRX4KzaYMXkqBsrFnnU1875z+JMXujotn9ybt3 SAOzZPyORZWApwrj+zjfyJdnCDEgJWmkUoKEEbCzTv6U9MRxWI9u/6UYAGesz+ETs6Py59US2Iq ZHFSGZCiiGKwbHVVLYeutckw3YaynDXk/x4VJZ42ODkuoJNdMaEmf+Gdw2s+GlIT+4A7wU5aMKf ne1Q1Qi7+rX4UZtl+WagbVL57Osp3vw== X-Received: by 2002:a05:6000:2f88:b0:461:a19d:3546 with SMTP id ffacd0b85a97d-46507c8e469mr343303f8f.18.1781802058533; Thu, 18 Jun 2026 10:00:58 -0700 (PDT) X-Received: by 2002:a05:6000:2f88:b0:461:a19d:3546 with SMTP id ffacd0b85a97d-46507c8e469mr343218f8f.18.1781802057916; Thu, 18 Jun 2026 10:00:57 -0700 (PDT) Received: from localhost (19.81.93.209.dyn.plus.net. [209.93.81.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-465090c0f4esm266381f8f.14.2026.06.18.10.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 10:00:57 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb: return raw frame_info pointer from create_sentinel_frame Date: Thu, 18 Jun 2026 18:00:55 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: WO_UTrNhMTgUGiVQcxLBrFTpltjrvEuWRDO0_7wG_LQ_1781802059 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 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. --- gdb/frame.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gdb/frame.c b/gdb/frame.c index f64f5554f8c..e581e396c13 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1661,9 +1661,13 @@ put_frame_register_bytes (const frame_info_ptr &next_frame, int regnum, /* Create a sentinel frame. See frame_id_build_sentinel for the description of STACK_ADDR and - CODE_ADDR. */ + CODE_ADDR. -static frame_info_ptr + This returns a raw frame_info pointer rather than a frame_info_ptr as + every caller only needs the frame_info and would discard any + frame_info_ptr. */ + +static frame_info * create_sentinel_frame (program_space *pspace, address_space *aspace, regcache *regcache, CORE_ADDR stack_addr, CORE_ADDR code_addr) @@ -1691,7 +1695,7 @@ create_sentinel_frame (program_space *pspace, address_space *aspace, frame_debug_printf (" -> %s", frame->to_string ().c_str ()); - return frame_info_ptr (frame); + return frame; } /* Cache for frame addresses already read by gdb. Valid only while @@ -1736,7 +1740,7 @@ get_current_frame (void) create_sentinel_frame (current_program_space, current_inferior ()->aspace.get (), get_thread_regcache (inferior_thread ()), - 0, 0).get (); + 0, 0); /* Set the current frame before computing the frame id, to avoid recursion inside compute_frame_id, in case the frame's @@ -2091,7 +2095,7 @@ create_new_frame (frame_id id) fi->next = create_sentinel_frame (current_program_space, current_inferior ()->aspace.get (), get_thread_regcache (inferior_thread ()), - id.stack_addr, id.code_addr).get (); + id.stack_addr, id.code_addr); /* Set/update this frame's cached PC value, found in the next frame. Do this before looking for this frame's unwinder. A sniffer is base-commit: 60466ce68ac1a2d93c7f39b2638e24f48125fbf9 -- 2.25.4