public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
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
Subject: Re: [PATCH v3 4/4] gdb: Skip trampoline frames in the stack for printing or finish command.
Date: Tue, 11 Jul 2023 14:23:00 +0300	[thread overview]
Message-ID: <835y6q8zfv.fsf@gnu.org> (raw)
In-Reply-To: <20230710225643.32280-5-abdul.b.ijaz@intel.com> (message from Abdul Basit Ijaz on Tue, 11 Jul 2023 00:56:43 +0200)

> From: Abdul Basit Ijaz <abdul.b.ijaz@intel.com>
> Cc: abdul.b.ijaz@intel.com,
> 	JiniSusan.George@amd.com,
> 	tom@tromey.com,
> 	eliz@gnu.org
> Date: Tue, 11 Jul 2023 00:56:43 +0200
> 
> Before the change, GDB prints the frames indicated by the compiler with DIE
> "DW_AT_trampoline" in the backtrace and finish command, but for better user
> experience, all such frames can be hidden from the user.  So, after this
> change, now such frames are not printed any more in the backtrace command
> and also the 'finish' command skips the trampoline calls.
> 
> So far, this DIE is added to DWARF only by the IFX compiler, so
> gdb.fortran/mixed-lang-stack test used to fail for this compiler because of
> these extra trampoline frames in the backtrace.  After the commit, those
> trampoline frames are filtered so test is updated accordingly to handle the
> frame level of the filtered frames.
> 
> Backtrace output in this test before the change:
> 
> bt -frame-arguments all
> '''
> '''
> (gdb) FAIL: gdb.fortran/mixed-lang-stack.exp: lang=auto: bt -frame-arguments all
> 
> Now, after the change:
> bt -frame-arguments all
> '''
> '''
> (gdb) PASS: gdb.fortran/mixed-lang-stack.exp: lang=auto: bt -frame-arguments all
> 
> Below is the example where IFX emits DW_at_trampoline for functions first
> and second trampoline calls as following:
> 
> F90 reproducer info:
> function second (x, y) result(z)
>   integer, intent(in) :: x, y
>   integer :: z
>   z = x * y ! breakpt-backtrace
> end function second
> 
> function first (num1, num2) result(total)
>   integer, intent(in) :: num1, num2
>   integer  :: total
>   total = second (num1 + 4, num2 * 3) ! first-breakpt
>   total = total + 30
> end function first
> 
> Related Dwarf:
> 
> 0x0000013f:   DW_TAG_subprogram
>                 DW_AT_low_pc    (0x0000000000404350)
>                 DW_AT_high_pc   (0x000000000040435f)
>                 DW_AT_frame_base        (DW_OP_reg6 RBP)
>                 DW_AT_linkage_name      ("second_.t74p.t75p")
>                 DW_AT_name      ("second_.t74p.t75p")
>                 DW_AT_trampoline        ("second_")
> 
> 0x0000015a:   DW_TAG_subprogram
>                 DW_AT_low_pc    (0x00000000004044a0)
>                 DW_AT_high_pc   (0x00000000004044af)
>                 DW_AT_frame_base        (DW_OP_reg6 RBP)
>                 DW_AT_linkage_name      ("first_.t104p.t105p")
>                 DW_AT_name      ("first_.t104p.t105p")
>                 DW_AT_trampoline        ("first_")
> 
> Before this change at line with comment 'breakpt-backtrace':
> (gdb) backtrace 3
> (gdb) finish
> Run till exit from #0  second (x=20, y=9) at test.f90:4
> second_.t74p.t75p () at test.f90:10
> 10        total = second (num1 + 4, num2 * 3) ! first-breakpt
> Value returned is $1 = 180
> 
> After the change:
> (gdb) backtrace 3
> (gdb) finish
> Run till exit from #0  second (x=20, y=9) at test.f90:4
> 0x0000000000404333 in first (num1=16, num2=3) at test.f90:10
> 10        total = second (num1 + 4, num2 * 3) ! first-breakpt
> Value returned is $1 = 180
> 
> New test func-trampoline is also added to test this in both backtrace and
> finish commands for Intel(R) Fortran Compiler.
> 
> 2023-07-10 Abdul Basit Ijaz <abdul.b.ijaz@intel.com>
> ---
>  gdb/doc/gdb.texinfo                           | 35 ++++++----
>  gdb/infcmd.c                                  | 13 ++++
>  gdb/infrun.c                                  |  8 +--
>  gdb/infrun.h                                  |  6 ++
>  gdb/stack.c                                   |  8 +++
>  gdb/symtab.c                                  | 12 ++++
>  gdb/symtab.h                                  |  5 ++
>  gdb/testsuite/gdb.fortran/func-trampoline.exp | 69 +++++++++++++++++++
>  gdb/testsuite/gdb.fortran/func-trampoline.f90 | 39 +++++++++++
>  .../gdb.fortran/mixed-lang-stack.exp          | 10 ++-
>  10 files changed, 186 insertions(+), 19 deletions(-)
>  create mode 100644 gdb/testsuite/gdb.fortran/func-trampoline.exp
>  create mode 100644 gdb/testsuite/gdb.fortran/func-trampoline.f90

OK for the documentation parts, thanks.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>

      reply	other threads:[~2023-07-11 11:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 22:56 [PATCH v3 0/4] GDB support for DW_AT_trampoline Abdul Basit Ijaz
2023-07-10 22:56 ` [PATCH v3 1/4] gdb, dwarf: add support for DW_AT_trampoline in DWARF reader Abdul Basit Ijaz
2023-07-27  9:09   ` Bruno Larsen
2023-07-29 11:36     ` Ijaz, Abdul B
2023-07-31  7:16       ` Bruno Larsen
2023-07-10 22:56 ` [PATCH v3 2/4] gdb/symtab: add lookup for trampoline functions Abdul Basit Ijaz
2023-07-10 22:56 ` [PATCH v3 3/4] gdb/infrun: handle stepping through functions with DW_AT_trampoline Abdul Basit Ijaz
2023-07-11 11:21   ` Eli Zaretskii
2023-07-27 11:46   ` Bruno Larsen
2023-07-29 11:03     ` Ijaz, Abdul B
2023-07-10 22:56 ` [PATCH v3 4/4] gdb: Skip trampoline frames in the stack for printing or finish command Abdul Basit Ijaz
2023-07-11 11:23   ` Eli Zaretskii [this message]

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=835y6q8zfv.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=JiniSusan.George@amd.com \
    --cc=abdul.b.ijaz@intel.com \
    --cc=gdb-patches@sourceware.org \
    --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).