Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v6 00/10] GDB support for DW_AT_trampoline
@ 2024-03-28 12:05 Abdul Basit Ijaz
  2024-03-28 12:05 ` [PATCH v6 01/10] gdb, dwarf: add support for DW_AT_trampoline in DWARF reader Abdul Basit Ijaz
                   ` (9 more replies)
  0 siblings, 10 replies; 18+ messages in thread
From: Abdul Basit Ijaz @ 2024-03-28 12:05 UTC (permalink / raw)
  To: gdb-patches; +Cc: abdul.b.ijaz, JiniSusan.George, tom, eliz

From: "Ijaz, Abdul B" <abdul.b.ijaz@intel.com>

please find attached a series of patches that attempts to enable GDB to handle the DW_AT_trampoline attribute on functions and inlined functions.

DW_AT_trampoline can be emitted by the compiler for functions that are compiler generated trampolines (e.g. wrapping other function calls).
In doing so, the compiler can specify a target as the value of DW_AT_trampoline which the trampoline is wrapping.

This series enables GDB to recognize the DW_AT_trampoline and store the target for a given function.  Patch 3 adapts GDB's stepping behavior when dealing with trampolines and attempts to - by default - hide these trampolines from the user.  When about to step into a trampoline, instead, GDB will try and step through the trampoline and directly towards the target.  For rest of the patches as the name of the patch indicates it implements skipping of trampolines for the command mentioned in the patch name.

A new setting has also been introduced in this change to turn off this modified stepping behavior or printing of stack for trampolines.

The motivation for these patches comes from ifx which emits the attribute for some of its compiler generated functions.  As I do not know of any other compiler (especially gcc/gfortran) emitting DW_AT_trampoline, I added a gdb.dwarf2 test to this series in order to test the trampoline handling within GDB.

Changes since V5:

  * Updated the documentation part.
  * Splitted the patch 4/4 for each command.
  * Now trampolines are skipped for these commands as well as per
    the feedback on V5 patch:
    ** backtrace -n,
    ** return
    ** mi commands -stack-list-frames and -stack-list-arguments

V5 series of patches can be found here:
https://sourceware.org/pipermail/gdb-patches/2023-August/201684.html

No regression seen on testing x64/native-extended-gdbserver(-m32)/x32/
native-gdbserver test configurations for these changes.

Thanks & Best Regards
Abdul Basit


Ijaz, Abdul B (7):
  gdb: Skip trampoline frames for the backtrace command.
  gdb: Skip trampoline functions for the finish and reverse-finish
    commands.
  gdb: Skip trampoline functions for the up command.
  gdb: Skip trampoline functions for the return command.
  gdb, mi: Skip trampoline functions for the -stack-list-frames command.
  gdb, mi: Skip trampoline functions for the -stack-list-arguments
    command.
  gdb: Filter trampoline frames in backtrace when using Python
    frame-filters.

Nils-Christian Kempke (3):
  gdb, dwarf: add support for DW_AT_trampoline in DWARF reader
  gdb/symtab: add lookup for trampoline functions
  gdb: handle stepping through functions with DW_AT_trampoline

 gdb/NEWS                                      |  13 +
 gdb/doc/gdb.texinfo                           |  53 +++-
 gdb/dwarf2/read.c                             |  46 +++-
 gdb/gdbtypes.c                                |  34 ++-
 gdb/gdbtypes.h                                | 113 +++++++-
 gdb/infcmd.c                                  |  12 +
 gdb/infrun.c                                  |  95 ++++++-
 gdb/infrun.h                                  |  16 ++
 gdb/mi/mi-cmd-stack.c                         |  14 +
 gdb/python/py-frame.c                         |  11 +
 gdb/stack.c                                   |  26 ++
 gdb/symtab.c                                  |  81 ++++++
 gdb/symtab.h                                  |  19 ++
 .../gdb.dwarf2/dw2-function-trampolines.c     |  80 ++++++
 .../gdb.dwarf2/dw2-function-trampolines.exp   | 245 ++++++++++++++++++
 gdb/testsuite/gdb.fortran/func-trampoline.exp | 102 ++++++++
 gdb/testsuite/gdb.fortran/func-trampoline.f90 |  39 +++
 .../gdb.fortran/mixed-lang-stack.exp          |  10 +-
 gdb/testsuite/gdb.mi/mi-func-trampoline.exp   |  75 ++++++
 .../gdb.python/py-framefilter-trampoline.exp  |  77 ++++++
 .../gdb.python/py-framefilter-trampoline.py   |  31 +++
 .../gdb.reverse/finish-reverse-trampoline.exp |  56 ++++
 22 files changed, 1233 insertions(+), 15 deletions(-)
 create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-function-trampolines.c
 create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-function-trampolines.exp
 create mode 100644 gdb/testsuite/gdb.fortran/func-trampoline.exp
 create mode 100644 gdb/testsuite/gdb.fortran/func-trampoline.f90
 create mode 100644 gdb/testsuite/gdb.mi/mi-func-trampoline.exp
 create mode 100644 gdb/testsuite/gdb.python/py-framefilter-trampoline.exp
 create mode 100644 gdb/testsuite/gdb.python/py-framefilter-trampoline.py
 create mode 100644 gdb/testsuite/gdb.reverse/finish-reverse-trampoline.exp

-- 
2.34.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2024-03-28 14:32 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28 12:05 [PATCH v6 00/10] GDB support for DW_AT_trampoline Abdul Basit Ijaz
2024-03-28 12:05 ` [PATCH v6 01/10] gdb, dwarf: add support for DW_AT_trampoline in DWARF reader Abdul Basit Ijaz
2024-03-28 12:05 ` [PATCH v6 02/10] gdb/symtab: add lookup for trampoline functions Abdul Basit Ijaz
2024-03-28 12:05 ` [PATCH v6 03/10] gdb: handle stepping through functions with DW_AT_trampoline Abdul Basit Ijaz
2024-03-28 13:58   ` Eli Zaretskii
2024-03-28 14:31     ` Ijaz, Abdul B
2024-03-28 12:05 ` [PATCH v6 04/10] gdb: Skip trampoline frames for the backtrace command Abdul Basit Ijaz
2024-03-28 12:05 ` [PATCH v6 05/10] gdb: Skip trampoline functions for the finish and reverse-finish commands Abdul Basit Ijaz
2024-03-28 13:59   ` Eli Zaretskii
2024-03-28 12:05 ` [PATCH v6 06/10] gdb: Skip trampoline functions for the up command Abdul Basit Ijaz
2024-03-28 14:01   ` Eli Zaretskii
2024-03-28 12:05 ` [PATCH v6 07/10] gdb: Skip trampoline functions for the return command Abdul Basit Ijaz
2024-03-28 14:01   ` Eli Zaretskii
2024-03-28 12:05 ` [PATCH v6 08/10] gdb, mi: Skip trampoline functions for the -stack-list-frames command Abdul Basit Ijaz
2024-03-28 14:02   ` Eli Zaretskii
2024-03-28 12:05 ` [PATCH v6 09/10] gdb, mi: Skip trampoline functions for the -stack-list-arguments command Abdul Basit Ijaz
2024-03-28 14:03   ` Eli Zaretskii
2024-03-28 12:05 ` [PATCH v6 10/10] gdb: Filter trampoline frames in backtrace when using Python frame-filters Abdul Basit Ijaz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox