From: Simon Marchi <simark@simark.ca>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCHv10 4/5] gdb: allow 'until' to work in outermost frame
Date: Fri, 30 Oct 2026 12:31:50 -0400 [thread overview]
Message-ID: <80a54378-355f-4513-a3f6-98b442a837a5@simark.ca> (raw)
In-Reply-To: <0ab2a0e5b8b9364e5a134d672a42466f8657ed70.1793268860.git.aburgess@redhat.com>
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.marchi@efficios.com>
Simon
next prev parent reply other threads:[~2026-10-30 16:32 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 18:14 [PATCH] " Andrew Burgess
2026-06-11 19:24 ` Guinevere Larsen
2026-06-11 20:40 ` Andrew Burgess
2026-06-12 12:49 ` Guinevere Larsen
2026-06-11 21:59 ` [PATCHv2 0/3] " Andrew Burgess
2026-06-11 21:59 ` [PATCHv2 1/3] gdb: rename program_space::entry_point_address* functions Andrew Burgess
2026-06-12 15:41 ` Pedro Alves
2026-06-11 21:59 ` [PATCHv2 2/3] gdb: introduce program_space::get_entry_point_info function Andrew Burgess
2026-06-12 6:07 ` Eli Zaretskii
2026-06-15 10:14 ` Andrew Burgess
2026-06-15 12:01 ` Eli Zaretskii
2026-06-12 15:41 ` Pedro Alves
2026-06-15 10:29 ` Andrew Burgess
2026-06-16 18:36 ` Pedro Alves
2026-06-23 9:46 ` Andrew Burgess
2026-06-23 10:20 ` Pedro Alves
2026-06-11 21:59 ` [PATCHv2 3/3] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-06-12 15:57 ` Pedro Alves
2026-06-16 19:47 ` [PATCHv3 0/4] " Andrew Burgess
2026-06-16 19:47 ` [PATCHv3 1/4] gdb: rename program_space::entry_point_address* functions Andrew Burgess
2026-06-16 19:47 ` [PATCHv3 2/4] gdb: introduce program_space::get_entry_point_info function Andrew Burgess
2026-06-17 11:52 ` Eli Zaretskii
2026-06-16 19:47 ` [PATCHv3 3/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-06-16 19:47 ` [PATCHv3 4/4] gdb: cache program space entry point information Andrew Burgess
2026-06-23 10:47 ` [PATCHv4 0/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-06-23 10:47 ` [PATCHv4 1/4] gdb: rename program_space::entry_point_address* functions Andrew Burgess
2026-06-23 10:47 ` [PATCHv4 2/4] gdb: introduce program_space::get_entry_point_info function Andrew Burgess
2026-06-23 10:47 ` [PATCHv4 3/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-06-23 10:47 ` [PATCHv4 4/4] gdb: cache program space entry point information Andrew Burgess
2026-06-25 15:26 ` [PATCHv5 0/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-06-25 15:26 ` [PATCHv5 1/4] gdb: rename program_space::entry_point_address* functions Andrew Burgess
2026-06-25 15:26 ` [PATCHv5 2/4] gdb: introduce program_space::get_entry_point_info function Andrew Burgess
2026-06-25 15:26 ` [PATCHv5 3/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-06-25 15:26 ` [PATCHv5 4/4] gdb: cache program space entry point information Andrew Burgess
2026-07-10 14:24 ` [PATCHv6 0/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-07-10 14:24 ` [PATCHv6 1/4] gdb: rename program_space::entry_point_address* functions Andrew Burgess
2026-07-10 14:24 ` [PATCHv6 2/4] gdb: introduce program_space::get_entry_point_info function Andrew Burgess
2026-07-10 15:39 ` Simon Marchi
2026-07-10 14:24 ` [PATCHv6 3/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-07-10 17:00 ` Simon Marchi
2026-07-10 17:01 ` Simon Marchi
2026-07-16 15:06 ` Andrew Burgess
2026-07-10 14:24 ` [PATCHv6 4/4] gdb: cache program space entry point information Andrew Burgess
2026-07-10 17:07 ` Simon Marchi
2026-07-18 13:11 ` [PATCHv7 0/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-07-18 13:11 ` [PATCHv7 1/4] gdb: rename program_space::entry_point_address* functions Andrew Burgess
2026-07-18 13:11 ` [PATCHv7 2/4] gdb: introduce program_space::get_entry_point_info function Andrew Burgess
2026-07-18 13:11 ` [PATCHv7 3/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-07-18 13:11 ` [PATCHv7 4/4] gdb: cache program space entry point information Andrew Burgess
2026-07-20 9:52 ` [PATCHv8 0/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-07-20 9:52 ` [PATCHv8 1/4] gdb: rename program_space::entry_point_address* functions Andrew Burgess
2026-07-20 9:52 ` [PATCHv8 2/4] gdb: introduce program_space::get_entry_point_info function Andrew Burgess
2026-08-12 15:44 ` Simon Marchi
2026-07-20 9:52 ` [PATCHv8 3/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-08-12 17:53 ` Simon Marchi
2026-08-20 10:32 ` Andrew Burgess
2026-07-20 9:52 ` [PATCHv8 4/4] gdb: cache program space entry point information Andrew Burgess
2026-08-24 16:22 ` [PATCHv9 0/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-08-24 16:22 ` [PATCHv9 1/4] gdb: rename program_space::entry_point_address* functions Andrew Burgess
2026-08-24 16:22 ` [PATCHv9 2/4] gdb: introduce program_space::get_entry_point_info function Andrew Burgess
2026-08-24 16:22 ` [PATCHv9 3/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-10-27 14:33 ` Simon Marchi
2026-08-24 16:22 ` [PATCHv9 4/4] gdb: cache program space entry point information Andrew Burgess
2026-10-29 10:20 ` [PATCHv10 0/5] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-10-29 10:20 ` [PATCHv10 1/5] gdb: more 'const' in the multi-so-lib progspace code Andrew Burgess
2026-10-30 15:28 ` Simon Marchi
2026-10-29 10:20 ` [PATCHv10 2/5] gdb: rename program_space::entry_point_address* functions Andrew Burgess
2026-10-30 15:34 ` Simon Marchi
2026-10-29 10:20 ` [PATCHv10 3/5] gdb: introduce program_space::get_entry_point_info function Andrew Burgess
2026-10-30 16:11 ` Simon Marchi
2026-10-29 10:20 ` [PATCHv10 4/5] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-10-30 16:31 ` Simon Marchi [this message]
2026-10-29 10:20 ` [PATCHv10 5/5] gdb: cache program space entry point information Andrew Burgess
2026-10-30 17:19 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=80a54378-355f-4513-a3f6-98b442a837a5@simark.ca \
--to=simark@simark.ca \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox