| Message ID | 20241124220353.3465-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 5BE633858019 for <patchwork@sourceware.org>; Sun, 24 Nov 2024 22:05:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5BE633858019 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=gr7k8fRq X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by sourceware.org (Postfix) with ESMTPS id 8F7BE3858D34 for <gdb-patches@sourceware.org>; Sun, 24 Nov 2024 22:04:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8F7BE3858D34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8F7BE3858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732485855; cv=none; b=i5mQwvwMYca4mPA0Cf3lSf6oCPdTbY3rfHxzpIMVJGAjoyAzRzD/WzK2RPGAo+R688TuC2RQ4r8vQt7gGEU32/MYvEt3zGD0niuDLKgAvYhKs/x9hPO5+700zId39C4LmiP1IshJIAUlph7a4+w8TZ3bBxChnRUxZP0k3hAqmWk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732485855; c=relaxed/simple; bh=Gr+VZ4SsI6ao6+7LDOl60ZhAbZywPCwUP1Y9vNi4XaY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=kSviETVt2vAR8XUI+4HNqmW0L1lW7rcIsxmg9oscYPF+YJ5+Foqz2zbmYirnXrAypgLL3c15giIgPHdTB3jb9aaKB/gsOuJaE9AHYx3wbYjJvD5zkb2hJ831p3LJb0AFaodTsUZugXgKXDfL3LpIYxemIJBA3meIAslzpQ7qVhc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F7BE3858D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732485855; x=1764021855; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Gr+VZ4SsI6ao6+7LDOl60ZhAbZywPCwUP1Y9vNi4XaY=; b=gr7k8fRqKvgjcZc/5dPNpmlAgtRIL2EImdeU/QuxYel4osGZ+j/8E/Tc qzITCgPeKaQn/ovhycxbxVTLoNyazdI4ZzdrpvZdzbfxGTqen1zU9/o6J tW4P/ATJm3IxVpzqAL4SXQ9chSESAZeHhfcZYVy3l0VYtU9GLQaS6VCAA aT6fiwO85Ff8fEvSDDGJC+bxjy5iyHFZXekkxbfMvfYA+ehu3zFSUIxVo CdDIieiW+LXXllTwIawuzudkTbowzkrlbOjJ3khbwUIuoEpLyP/bvtvBj SArBhx7UFW3zeiXH0qTJ3wijNXaVYW+1Yxyg1vUSakjmE6S8s+TNx8Flt A==; X-CSE-ConnectionGUID: aAyZeHvbQH6sC054Qoy92w== X-CSE-MsgGUID: DXDWHCbGRp2MXDcRhdrmMQ== X-IronPort-AV: E=McAfee;i="6700,10204,11266"; a="43187980" X-IronPort-AV: E=Sophos;i="6.12,181,1728975600"; d="scan'208";a="43187980" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2024 14:04:14 -0800 X-CSE-ConnectionGUID: VHQ5A+zgTfiDF+4baDcaIw== X-CSE-MsgGUID: C6eol4gyTOiGnEZUzqLlpg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,181,1728975600"; d="scan'208";a="95502062" Received: from abijaz-mobl2.ger.corp.intel.com (HELO localhost) ([10.245.166.144]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2024 14:04:12 -0800 From: Abdul Basit Ijaz <abdul.b.ijaz@intel.com> To: gdb-patches@sourceware.org Cc: abdul.b.ijaz@intel.com, JiniSusan.George@amd.com, tom@tromey.com, eliz@gnu.org Subject: [PATCH v9 00/10] GDB support for DW_AT_trampoline Date: Sun, 24 Nov 2024 23:03:43 +0100 Message-Id: <20241124220353.3465-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.7 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 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.30 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> Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
GDB support for DW_AT_trampoline
|
|
Message
Abdul Basit Ijaz
Nov. 24, 2024, 10:03 p.m. UTC
Hi All,
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.
No changes in the approved documentation since V8 patch:
https://sourceware.org/pipermail/gdb-patches/2024-May/209395.html
https://sourceware.org/pipermail/gdb-patches/2024-May/209396.html
Changes since V8:
* Update in 2nd patch only to handle a case if JIT compiler may have
generated a duplicated symbol.
No regression seen on testing x64/(-m32)/x32 configurations.
Thanks & Best Regards
Abdul Basit Ijaz
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 | 52 +++-
gdb/dwarf2/read.c | 39 ++-
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 | 89 +++++++
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