Message ID | 20230710225643.32280-1-abdul.b.ijaz@intel.com |
---|---|
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D74DF3857719 for <patchwork@sourceware.org>; Mon, 10 Jul 2023 22:57:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D74DF3857719 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689029846; bh=uI/8F0G8fMDQDAj9Q1J49b2Q3QsDDoW94LkJa5KKtT0=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=l1eWcmE9zialgFkqC6SSl4ICrdRXfyBFRl/T/E+BM+xVGrYiBBb/cP82BSWADYt4J PqdWnNVDOMa6/gFCoOnii5sypJiYsBUOyJmgA4CjlETgBQta9lzhme9MbPgZgP+agf /ljQ+xZdPFbK2ux3VD6nvM/mnWxLOcb6JZ7lMd2I= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by sourceware.org (Postfix) with ESMTPS id 0EADF3858C5E for <gdb-patches@sourceware.org>; Mon, 10 Jul 2023 22:56:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0EADF3858C5E X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="361940133" X-IronPort-AV: E=Sophos;i="6.01,195,1684825200"; d="scan'208";a="361940133" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 15:56:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="756144145" X-IronPort-AV: E=Sophos;i="6.01,195,1684825200"; d="scan'208";a="756144145" Received: from skurzyno-mobl.ger.corp.intel.com (HELO localhost) ([10.252.44.160]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 15:56:54 -0700 To: gdb-patches@sourceware.org Cc: abdul.b.ijaz@intel.com, JiniSusan.George@amd.com, tom@tromey.com, eliz@gnu.org Subject: [PATCH v3 0/4] GDB support for DW_AT_trampoline Date: Tue, 11 Jul 2023 00:56:39 +0200 Message-Id: <20230710225643.32280-1-abdul.b.ijaz@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Abdul Basit Ijaz via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Abdul Basit Ijaz <abdul.b.ijaz@intel.com> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
GDB support for DW_AT_trampoline
|
|
Message
Abdul Basit Ijaz
July 10, 2023, 10:56 p.m. UTC
From: "Ijaz, Abdul B" <abdul.b.ijaz@intel.com>
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. Patch 4 in V2 now skip trampoline frames
in the stack for printing or finish command. A new setting has been
introduced 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 V2:
* Mention "on" as default value for skip-trampoline-functions in NEWS
and gdb.textinfo according to the latest feedback.
* Update copyright years from 2022 to 2023 in test files which are
newly added.
V2 series of patches can be found here:
https://sourceware.org/pipermail/gdb-patches/2023-June/200066.html
No regression seen on testing x64/x86/gdbserver test configurations for
these changes using Ubuntu 22.
Abdul Basit Ijaz (1):
gdb: Skip trampoline frames in the stack for printing or finish
command.
Nils-Christian Kempke (3):
gdb, dwarf: 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 | 15 ++
gdb/doc/gdb.texinfo | 47 ++++
gdb/dwarf2/read.c | 45 +++-
gdb/gdbtypes.c | 35 ++-
gdb/gdbtypes.h | 103 +++++++-
gdb/infcmd.c | 13 +
gdb/infrun.c | 81 +++++-
gdb/infrun.h | 10 +
gdb/stack.c | 8 +
gdb/symtab.c | 80 ++++++
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 | 69 +++++
gdb/testsuite/gdb.fortran/func-trampoline.f90 | 39 +++
.../gdb.fortran/mixed-lang-stack.exp | 10 +-
16 files changed, 885 insertions(+), 14 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