From: Eli Zaretskii <eliz@gnu.org>
To: Abdul Basit Ijaz <abdul.b.ijaz@intel.com>
Cc: gdb-patches@sourceware.org, JiniSusan.George@amd.com,
tom@tromey.com, nils-christian.kempke@intel.com
Subject: Re: [PATCH v2 3/4] gdb/infrun: handle stepping through functions with DW_AT_trampoline
Date: Mon, 05 Jun 2023 15:01:55 +0300 [thread overview]
Message-ID: <83pm6a3yoc.fsf@gnu.org> (raw)
In-Reply-To: <20230605110410.3078-4-abdul.b.ijaz@intel.com> (message from Abdul Basit Ijaz via Gdb-patches on Mon, 5 Jun 2023 13:04:09 +0200)
> Cc: abdul.b.ijaz@intel.com, JiniSusan.George@amd.com, tom@tromey.com,
> Nils-Christian Kempke <nils-christian.kempke@intel.com>
> Date: Mon, 5 Jun 2023 13:04:09 +0200
> From: Abdul Basit Ijaz via Gdb-patches <gdb-patches@sourceware.org>
>
> gdb/NEWS | 14 +
> gdb/doc/gdb.texinfo | 36 +++
> gdb/infrun.c | 81 +++++-
> gdb/infrun.h | 4 +
> .../gdb.dwarf2/dw2-function-trampolines.c | 80 ++++++
> .../gdb.dwarf2/dw2-function-trampolines.exp | 245 ++++++++++++++++++
> 6 files changed, 456 insertions(+), 4 deletions(-)
> create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-function-trampolines.c
> create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-function-trampolines.exp
Thanks.
> diff --git a/gdb/NEWS b/gdb/NEWS
> index c0aac212e30..d349791de62 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -342,6 +342,20 @@ GDB now supports floating-point on LoongArch GNU/Linux.
>
> * New commands
>
> +set skip-trampoline-functions on|off
> +show skip-trampoline-functions
> + This controls whether GDB's stepping behavior will recognize function calls
> + that have been marked as trampolines in the debug info. It improves
> + stepping behavior in that it steps through trampoline code and hides it from
> + the user. GDB can now step through trampolines that are correctly marked as
> + such in the compiler's debug info. If the target of a trampoline is unknown,
> + GDB will continue until the trampoline section is left again and only then
> + hand control back to the user. GDB does this even if the trampoline has no
> + associated line info. If this is turned off, GDB will step into trampolines
> + if there is line table information for them or step over the trampoline calls
> + if there is no line table information. Currently, only DWARF trampolines
> + are supported.
This part is OK, but I'd suggest to say what is the default (I'm
guessing ON).
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -6366,6 +6366,42 @@ debug information. This is the default.
> Show whether @value{GDBN} will stop in or step over functions without
> source line debug information.
>
> +@kindex set skip-trampoline-functions
> +@item set skip-trampoline-functions
> +@cindex trampoline functions
> +@cindex stepping through trampoline functions
> +@itemx set skip-trampoline-functions on
Please move all the index entries before all the @item/@itemx. This
is so index-search in an Info reader will place the reader before the
text, not in its middle.
> +When calling a function in any language, some compilers might generate
> +so-called trampoline functions, which wrap the actual function call (the
"trampoline functions" should be in @dfn, since you are introducing
new terminology.
> +target of the trampoline). The compiler might mark such a trampoline in its
> +debug information. Often, such trampolines do not have any source line
> +information associated with them which will lead the @code{step} command to
> +behave like a @code{next} and skip the function call completely.
> +
> +The @code{set skip-trampoline-functions on} command will cause the @code{step}
> +command to treat these trampolines differently. When issuing a @code{step} at
> +the call site of a trampoline function if @code{skip-trampoline-functions} is
> +set @value{GDBN} will attempt to determine the target of the trampoline and
> +then step through the trampoline stopping at the target. If the target could
> +not be found or was not given in the debug info, @value{GDBN} will simply
> +continue execution until it leaves the trampoline code again, even if the
> +trampoline has no line info associated with it. When returning from a target
> +function call and stepping back into the trampoline, @value{GDBN} will again
> +step through the trampoline towards the call site.
> +Additionally, even if stopped in a trampoline function with source line
> +information, issuing a @code{step} will prompt @value{GDBN} to resume execution
> +until leaving the trampoline region again. The @code{stepi} command is not
> +affected by the setting which is enabled by default. Currently, only
> +DWARF trampolines marked via DW_AT_trampoline are supported by this.
Again, this should say what is the default of this setting.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
next prev parent reply other threads:[~2023-06-05 12:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 11:04 [PATCH v2 0/4] GDB support for DW_AT_trampoline Abdul Basit Ijaz
2023-06-05 11:04 ` [PATCH v2 1/4] gdb, dwarf: add support for DW_AT_trampoline in DWARF reader Abdul Basit Ijaz
2023-06-05 11:04 ` [PATCH v2 2/4] gdb/symtab: add lookup for trampoline functions Abdul Basit Ijaz
2023-06-05 11:04 ` [PATCH v2 3/4] gdb/infrun: handle stepping through functions with DW_AT_trampoline Abdul Basit Ijaz
2023-06-05 12:01 ` Eli Zaretskii [this message]
2023-06-05 12:07 ` Eli Zaretskii
2023-07-10 21:29 ` Ijaz, Abdul B
2023-06-05 11:04 ` [PATCH v2 4/4] gdb: Skip trampoline frames in the stack for printing or finish command Abdul Basit Ijaz
2023-06-05 12:03 ` Eli Zaretskii
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=83pm6a3yoc.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=JiniSusan.George@amd.com \
--cc=abdul.b.ijaz@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=nils-christian.kempke@intel.com \
--cc=tom@tromey.com \
/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).