From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id o7YOFJHG5GrwAhgAWB0awg (envelope-from ) for ; Fri, 30 Oct 2026 12:32:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1793377937; bh=ZDUpyAHXS3N4apcxswLVMTw4ArFaidQB/nZ7L9TJ9vw=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Ia5mwZCibG9BsXfrfcHMofbBUfXbEgQ8/TjFe/qjZKXXzh+A3mPoafRVs9OgPMK9o 5hgoyfvk+URETVTsX+nFh5Ohvp/DjXcsh4fNwu0BkEvdaS4s5phKbHBdggG7GZXPpU zR/TIVDaH5VDaVscZOtdmlFN0RHy/0u2kTxSXJYo= Received: by simark.ca (Postfix, from userid 112) id 30C7B378002; Fri, 30 Oct 2026 12:32:17 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.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,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED 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=oHElXfMQ; dkim-atps=neutral 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 99F61378002 for ; Fri, 30 Oct 2026 12:32:16 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2025A4BAE7C3 for ; Fri, 30 Oct 2026 16:32:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2025A4BAE7C3 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=oHElXfMQ Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id A9D644BA2E1C for ; Fri, 30 Oct 2026 16:31:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A9D644BA2E1C 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 A9D644BA2E1C 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=1793377911; cv=none; b=TTB+9CWGSVmuJ/85VIcjMhayjnVxsCEUqBcLKY52ur8LZmPXD7KntbrYhOGzEGcIcGEVfQLrKrhyDQkotQ34aRQaTzYGxmfNkWHpBoX5dFzxP7T15PL/NOLAgdWRDv6ITQMsIjmln2RyT+h6Sd0ekwWWpN1xzcrVLvsSaniX7sM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793377911; c=relaxed/simple; bh=ZDUpyAHXS3N4apcxswLVMTw4ArFaidQB/nZ7L9TJ9vw=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Lkct0kioRQY5733w0REvaBitw5La9V0sYnaFrqemEiDqDVdVzMS5nL7DXnrTPe6JhwfL8nsldfLVVu1JoQhi1m7zt9NEpOdE3bcNAW/stqtS9ZJoWT3QVTYio/9U/Lwev0E7nhPeyavi8gWXOQQClmKnwzKuAQ+jAivEHJ1FBlo= 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=oHElXfMQ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9D644BA2E1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1793377910; bh=ZDUpyAHXS3N4apcxswLVMTw4ArFaidQB/nZ7L9TJ9vw=; h=Date:Subject:To:References:From:In-Reply-To:From; b=oHElXfMQHLn+EXD+LPQHvItW7BiNkpQOzeNbwgDbYmPTTc/OcjoBzrUxI7jT4+Ux8 UhbNg1a+eDykWFWszh9OTnmvuSuMdRM2Dsx+9jIwz9KFYgNCYsshZu5W9oqvVtyoQl NAJOXAgXnGNZ1XynuUIgUAgH3XNKt86IfvMjXJWE= Received: by simark.ca (Postfix) id CA5E5378002; Fri, 30 Oct 2026 12:31:50 -0400 (EDT) Message-ID: <80a54378-355f-4513-a3f6-98b442a837a5@simark.ca> Date: Fri, 30 Oct 2026 12:31:50 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCHv10 4/5] gdb: allow 'until' to work in outermost frame To: Andrew Burgess , gdb-patches@sourceware.org References: <0ab2a0e5b8b9364e5a134d672a42466f8657ed70.1793268860.git.aburgess@redhat.com> Content-Language: fr From: Simon Marchi In-Reply-To: <0ab2a0e5b8b9364e5a134d672a42466f8657ed70.1793268860.git.aburgess@redhat.com> 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 10/29/26 6:20 AM, Andrew Burgess wrote: > diff --git a/gdb/frame.c b/gdb/frame.c > index af3837eb82e..3aa8946cc0d 100644 > --- a/gdb/frame.c > +++ b/gdb/frame.c > @@ -734,6 +734,45 @@ get_stack_frame_id (const frame_info_ptr &next_frame) > return get_frame_id (skip_artificial_frames (next_frame)); > } > > +/* Return true if THIS_FRAME is either of the two possible entry frames; > + the entry frame for the whole inferior, or the entry frame of just the > + executable. */ > + > +static bool > +inside_entry_func (const frame_info_ptr &this_frame) > +{ > + CORE_ADDR frame_func_addr; > + if (!get_frame_func_if_available (this_frame, &frame_func_addr)) > + return false; > + > + const entry_point_info &ep_info > + = current_program_space->get_entry_point_info (); > + > + /* Check both entry frames. */ > + return (ep_info.exec_entry_address () == frame_func_addr > + || ep_info.inferior_entry_address () == frame_func_addr); > +} > + > +/* Check if THIS_FRAME is an entry frame. If it is, return NULL. > + Otherwise, call get_prev_frame_always and return its result. */ > + > +static frame_info_ptr > +get_prev_frame_with_entry_frame_check (const frame_info_ptr &this_frame) > +{ > + FRAME_SCOPED_DEBUG_START_END ("fi=%d", this_frame->level); > + > + if (this_frame->level >= 0 > + && get_frame_type (this_frame) == NORMAL_FRAME > + && !user_set_backtrace_options.backtrace_past_entry > + && inside_entry_func (this_frame)) It's pre-existing code, but I noticed that the `level >= 0` check might be unnecessary, because the only frame with level < 0 has type SENTINEL_FRAME. > @@ -744,7 +783,8 @@ get_stack_frame_id (const frame_info_ptr &next_frame) > static frame_info_ptr > frame_unwind_caller_frame (const frame_info_ptr &initial_next_frame) > { > - frame_info_ptr this_frame = get_prev_frame_always (initial_next_frame); > + frame_info_ptr this_frame > + = get_prev_frame_with_entry_frame_check (initial_next_frame); > if (this_frame == nullptr) > return nullptr; > > @@ -754,11 +794,8 @@ frame_unwind_caller_frame (const frame_info_ptr &initial_next_frame) > struct frame_id > frame_unwind_caller_id (const frame_info_ptr &initial_next_frame) > { > - /* Use get_prev_frame_always, and not get_prev_frame. The latter > - will truncate the frame chain, leading to this function > - unintentionally returning a null_frame_id (e.g., when a caller > - requests the frame ID of "main()"s caller. */ This comment at infrun.c:8957 referred to the comment you remove: This is a separate function rather than reusing insert_hp_step_resume_breakpoint_at_frame in order to avoid get_prev_frame, which may stop prematurely (see the implementation of frame_unwind_caller_id for an example). I think that comment in infrun.c is a bit outdated to and could be updated or removed (could be done in a subsequent patch). Otherwise, the patch LGTM. Approved-By: Simon Marchi Simon