[PATCH 0/3] GDB support for DW_AT_trampoline
Nils-Christian Kempke
nils-christian.kempke@intel.com
Thu Jul 7 12:14:48 GMT 2022
Hi,
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. A new setting has been introduced to turn of this
modified stepping behavior.
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.
One open that was not yet addressed by this series is the handling of
frames generated for the trampoline functions. We were not sure whether
or not they should be generated at all (so whether or not they should
also be hidden from the user) but we wanted to get feedback on this
series first before continuing with our implementation.
This series was tested on 64bit Ubunut 20 and 18 and the boards unix,
unix/-m32, native-gdbserver, and native-extended-gdbserver.
Any feedback is highly appreciated!
Cheers,
Nils
Nils-Christian Kempke (3):
gdb: add support for DW_AT_trampoline in DWARF reader
gdb/symtab: add lookup for trampoline functions
gdb/infrun: handle stepping through functions with DW_AT_trampoline
gdb/NEWS | 14 +
gdb/doc/gdb.texinfo | 36 +++
gdb/dwarf2/read.c | 43 +++
gdb/gdbtypes.c | 31 +++
gdb/gdbtypes.h | 79 ++++++
gdb/infrun.c | 82 +++++-
gdb/symtab.c | 53 ++++
gdb/symtab.h | 14 +
.../gdb.dwarf2/dw2-function-trampolines.c | 80 ++++++
.../gdb.dwarf2/dw2-function-trampolines.exp | 245 ++++++++++++++++++
10 files changed, 673 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
--
2.25.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
More information about the Gdb-patches
mailing list