From: Tom Tromey <tom@tromey.com>
To: Abdul Basit Ijaz via Gdb-patches <gdb-patches@sourceware.org>
Cc: Abdul Basit Ijaz <abdul.b.ijaz@intel.com>,
JiniSusan.George@amd.com, tom@tromey.com, eliz@gnu.org,
blarsen@redhat.com
Subject: Re: [PATCH v4 4/4] gdb: Skip trampoline frames in the stack for printing or finish command.
Date: Wed, 02 Aug 2023 14:41:38 -0600 [thread overview]
Message-ID: <87h6phch31.fsf@tromey.com> (raw)
In-Reply-To: <20230801224744.24433-5-abdul.b.ijaz@intel.com> (Abdul Basit Ijaz via Gdb-patches's message of "Wed, 2 Aug 2023 00:47:44 +0200")
>>>>> "Abdul" == Abdul Basit Ijaz via Gdb-patches <gdb-patches@sourceware.org> writes:
Abdul> Before the change, GDB prints the frames indicated by the compiler with DIE
Abdul> "DW_AT_trampoline" in the backtrace and finish command, but for better user
Abdul> experience, all such frames can be hidden from the user. So, after this
Abdul> change, now such frames are not printed any more in the backtrace command
Abdul> and also the 'finish' command skips the trampoline calls.
Abdul> So far, this DIE is added to DWARF only by the IFX compiler, so
Abdul> gdb.fortran/mixed-lang-stack test used to fail for this compiler because of
Abdul> these extra trampoline frames in the backtrace. After the commit, those
Abdul> trampoline frames are filtered so test is updated accordingly to handle the
Abdul> frame level of the filtered frames.
Thanks for the patch.
I'm not totally sure how I feel about the stack trace part of this one.
On the one hand, normally I think it makes sense to elide these frames.
They aren't very interesting.
On the other hand, we have frame filters for frame elision, but then
this works in a totally different way.
If I am stopped in a frame and go "up", will I be in the trampoline
frame anyway? And will "bt" then not print the selected frame? But
"frame" will?
Abdul> + if (skip_trampoline_functions)
Abdul> + {
Abdul> + for (int i = 0; i < MAX_TRAMPOLINE_CHAIN_SIZE
Abdul> + && (frame != nullptr)
Abdul> + && in_trampoline_frame (frame); ++i)
Abdul> + frame = get_prev_frame (frame);
Formatting looks weird here.
Abdul> +++ b/gdb/stack.c
Abdul> @@ -2054,6 +2054,14 @@ backtrace_command_1 (const frame_print_options &fp_opts,
Abdul> {
Abdul> QUIT;
Abdul> + if (in_trampoline_frame (fi))
Abdul> + {
Abdul> + /* Trampoline frames are not printed so they are not counted in
Abdul> + the backtrace limit. */
Abdul> + count++;
Abdul> + continue;
I guess the frame numbers will skip as well, because the frame level is
a property of the frame, not of the loop displaying frames.
Also this approach ignores frame filters -- if one is in use, then I
think trampoline frames will show up again. You can try this by writing
a dummy frame filter that just returns all frames as-is.
Tom
next prev parent reply other threads:[~2023-08-02 20:41 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-01 22:47 [PATCH v4 0/4] GDB support for DW_AT_trampoline Abdul Basit Ijaz
2023-08-01 22:47 ` [PATCH v4 1/4] gdb, dwarf: add support for DW_AT_trampoline in DWARF reader Abdul Basit Ijaz
2023-08-02 20:07 ` Tom Tromey
2023-08-07 14:43 ` Ijaz, Abdul B
2023-08-10 16:20 ` Tom Tromey
2023-08-02 20:13 ` Tom Tromey
2023-08-07 13:36 ` Ijaz, Abdul B
2023-08-10 16:18 ` Tom Tromey
2023-08-14 21:53 ` Ijaz, Abdul B
2023-08-01 22:47 ` [PATCH v4 2/4] gdb/symtab: add lookup for trampoline functions Abdul Basit Ijaz
2023-08-02 20:18 ` Tom Tromey
2023-08-07 7:40 ` Ijaz, Abdul B
2023-08-01 22:47 ` [PATCH v4 3/4] gdb/infrun: handle stepping through functions with DW_AT_trampoline Abdul Basit Ijaz
2023-08-02 11:52 ` Eli Zaretskii
2023-08-02 11:54 ` Ijaz, Abdul B
2023-08-02 20:33 ` Tom Tromey
2023-08-07 8:08 ` Ijaz, Abdul B
2023-08-10 16:56 ` Tom Tromey
2023-08-16 14:18 ` Ijaz, Abdul B
2023-08-01 22:47 ` [PATCH v4 4/4] gdb: Skip trampoline frames in the stack for printing or finish command Abdul Basit Ijaz
2023-08-02 11:52 ` Eli Zaretskii
2023-08-02 11:54 ` Ijaz, Abdul B
2023-08-02 20:41 ` Tom Tromey [this message]
2023-08-07 13:28 ` Ijaz, Abdul B
2023-08-10 17:45 ` Tom Tromey
2023-08-02 20:42 ` Tom Tromey
2023-08-07 7:19 ` Ijaz, Abdul B
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=87h6phch31.fsf@tromey.com \
--to=tom@tromey.com \
--cc=JiniSusan.George@amd.com \
--cc=abdul.b.ijaz@intel.com \
--cc=blarsen@redhat.com \
--cc=eliz@gnu.org \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).