From: Pedro Alves <pedro@palves.net>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCHv2 3/3] gdb: allow 'until' to work in outermost frame
Date: Fri, 12 Jun 2026 16:57:34 +0100 [thread overview]
Message-ID: <8430a5e6-5452-464a-8793-172a1b679c69@palves.net> (raw)
In-Reply-To: <ce6e568635faf162b31fa8b2fd5b05f1ab81128c.1781214731.git.aburgess@redhat.com>
On 2026-06-11 22:59, Andrew Burgess wrote:
> +# Use 'bt 1' to get the name of the current function. Returns the
> +# name of the current function, or the empty string if the current
> +# function name cannot be established.
Nit: I'd think "frame" would be more natural than "bt 1".
> +proc current_function_name { testname } {
> + set func_name ""
> + gdb_test_multiple "bt 1" $testname {
> + -re -wrap "#0\\s+\[^\r\n\]*\\s+in (\[^( \]+) \\(.*" {
> + set func_name $expect_out(1,string)
> + }
> + }
> +
> + return $func_name
> +}
> +
> +# Start the inferior with 'starti', then use 'until' within the
> +# outermost frame. This is the real outermost frame, not 'main'.
> +#
> +# PAST_ENTRY should be 'on' or 'off' and is used in a 'set backtrace
> +# past-entry ...' command.
> +proc run_test { use_stepi past_entry testfile } {
> + clean_restart $testfile
> +
> + if { [gdb_starti_cmd] < 0 } {
> + untested starti
> + return
> + }
> +
> + gdb_test "" "Program stopped\\..*" "starti"
On Windows when you get to the entry address there's already more than one thread, so the above will
fail. E.g.:
(gdb) starti
Starting program: C:/msys2/home/alves/gdb/build-testsuite/outputs/gdb.base/patch/patch.exe
[New Thread 12888.0x3260]
Thread 1 stopped.
0x00007ff9abd3d78e in ntdll!RtlGetReturnAddressHijackTarget ()
from C:/WINDOWS/SYSTEM32/ntdll.dll
(gdb) info thr
Id Target Id Frame
* 1 Thread 12888.0x404c 0x00007ff9abd3d78e in ntdll!RtlGetReturnAddressHijackTarget () from C:/WINDOWS/SYSTEM32/ntdll.dll
2 Thread 12888.0x3260 0x00007ff9abd83d24 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:/WINDOWS/SYSTEM32/ntdll.dll
(gdb)
> + # Find an address to use in the 'until' command.
> + set until_address ""
> + set capture_address false
> + gdb_test_multiple "disassemble" "find address for until" {
> + -re "^=> $::hex \[^\r\n\]+\r\n" {
> + set capture_address true
> + exp_continue
> + }
> +
> + -re "^\\s+($::hex) \[^\r\n\]+\r\n" {
> + if { $capture_address } {
> + set until_address $expect_out(1,string)
> + set capture_address false
> + }
> +
> + exp_continue
> + }
> +
> + -re "^$::gdb_prompt $" {
> + set found_address [expr { $until_address ne "" }]
> + if { !$found_address } {
> + unsupported "$gdb_test_name (no instruction found)"
> + return
> + }
> + pass $gdb_test_name
> + }
> +
> + -re "^\[^\r\n\]*\r\n" {
> + exp_continue
> + }
Could use -lbl ?
next prev parent reply other threads:[~2026-06-12 15:58 UTC|newest]
Thread overview: 54+ 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 [this message]
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-07-20 9:52 ` [PATCHv8 3/4] gdb: allow 'until' to work in outermost frame Andrew Burgess
2026-07-20 9:52 ` [PATCHv8 4/4] gdb: cache program space entry point information Andrew Burgess
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=8430a5e6-5452-464a-8793-172a1b679c69@palves.net \
--to=pedro@palves.net \
--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