From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GluHBontcGo/awMAWB0awg (envelope-from ) for ; Mon, 03 Aug 2026 15:35:37 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=PB1pinGk; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 01AA91E099; Mon, 03 Aug 2026 15:35:36 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 4EF011E099 for ; Mon, 03 Aug 2026 15:35:35 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BC6B34BB24C0 for ; Mon, 3 Aug 2026 19:35:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC6B34BB24C0 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=PB1pinGk Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by sourceware.org (Postfix) with ESMTPS id 682314BA23E6 for ; Mon, 3 Aug 2026 19:35:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 682314BA23E6 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 682314BA23E6 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1785785706; cv=none; b=SEtJLU6JOBAHybtc7I1yyHY7YBm4gsV9bBcNOAXMW4+5e5+nkWACwWDTa+dm2nDboKgbxrp4aa9s4KOcxodspI948rWvdVzueIxGuCuoIcUyk5vo+CiIu2ytb1Mm3bsVp/xYjPr2BIyJIo4OkHQo9uO1SdZEE8/DOrNxOCrnOfw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1785785706; c=relaxed/simple; bh=Q+JSnBLVl3lYaE4CTbBrzn9wV2nHLQi0EmiKQhjASYc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=nXmEvi5sAPlW742u9MxYKR9UijcXqlEkmgAd+MGH/22tmT7q+BCIYuD5MmOnwtkzBLsqvDsQCQrq8AjyS9R2XMFnRCG96+awD3gwUKXatKQpu/IGshm0GPR2X5utMT7+vyOH/CW04JCT9ycwWUp0fiAftjaiU0fEdTtXC8rB/Fw= ARC-Authentication-Results: i=1; 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=PB1pinGk DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 682314BA23E6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1785785706; x=1817321706; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Q+JSnBLVl3lYaE4CTbBrzn9wV2nHLQi0EmiKQhjASYc=; b=PB1pinGk82ZTllEsl2z4IozAQmoQmYfo1ldCScv+lAXyT2uQb33qPlOo 8XODq1OuGQj8oqBWtVU7SAANh5Kz6OF45cTbhRYZD6QNgcc3hLFwUHR18 RUPYfiGztWexH87727TcwyT0G1BjY9+XDPLtDi6g8D6tIvaT0H7dUKHbT 1UFVp38rOCQzuSRJuUiTBvig2405DYPLIYgfWMPgq61E1h4UZd4A8fvsU 2L4M4Hs0daphsuK/DhzZStMZ8uFo/i+a+9sGzAtDtr2HbnrSzqwaMzllg XDUI0F2M95Pq/dCp5zLOMkeLmDUeFhmJJzD8WtSlu1WkNSdENulZJ7scM Q==; X-CSE-ConnectionGUID: 9uRVXKeIRiSSoCLvbcqjuQ== X-CSE-MsgGUID: 2Org3731Q/C2P9kkE6AdDQ== X-IronPort-AV: E=McAfee;i="6800,10657,11864"; a="109124313" X-IronPort-AV: E=Sophos;i="6.25,203,1779174000"; d="scan'208";a="109124313" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2026 12:35:05 -0700 X-CSE-ConnectionGUID: B9JeHZd7Q+SMC1gI8GZGxw== X-CSE-MsgGUID: 1LwOdVH7R1CVLKQVYZwDaQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,203,1779174000"; d="scan'208";a="284687995" Received: from fdaddami-mobl1.amr.corp.intel.com (HELO localhost) ([10.245.115.173]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2026 12:35:03 -0700 From: Abdul Basit Ijaz To: gdb-patches@sourceware.org Cc: abdul.b.ijaz@intel.com, JiniSusan.George@amd.com, tom@tromey.com, eliz@gnu.org Subject: [PATCH v11 00/10] GDB support for DW_AT_trampoline Date: Mon, 3 Aug 2026 21:34:39 +0200 Message-Id: <20260803193449.33375-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-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org 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 reviewed 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 V10: * Rebase and update copyright year to 2026 for newly added files in this patch. * Fix issue related to O2 and update test to cover both O0 & O2. No regression seen on testing x64/(-m32)/x32 configurations. Thanks & Best Regards Abdul Basit Ijaz Abdul Basit Ijaz (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 | 103 +++++++- gdb/infrun.h | 16 ++ gdb/mi/mi-cmd-stack.c | 14 + gdb/python/py-frame.c | 11 + gdb/stack.c | 26 ++ gdb/symtab.c | 139 ++++++++++ gdb/symtab.h | 29 +++ .../gdb.dwarf2/dw2-function-trampolines.c | 80 ++++++ .../gdb.dwarf2/dw2-function-trampolines.exp | 244 ++++++++++++++++++ gdb/testsuite/gdb.fortran/func-trampoline.exp | 116 +++++++++ gdb/testsuite/gdb.fortran/func-trampoline.f90 | 40 +++ .../gdb.fortran/mixed-lang-stack.exp | 8 +- gdb/testsuite/gdb.mi/mi-func-trampoline.exp | 76 ++++++ .../gdb.python/py-framefilter-trampoline.exp | 77 ++++++ .../gdb.python/py-framefilter-trampoline.py | 31 +++ .../gdb.reverse/finish-reverse-trampoline.exp | 56 ++++ 22 files changed, 1315 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 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: Dornacher Strasse 1, 85622 Feldkirchen, Germany Tel: +49 (89) 99143-0 www.intel.de Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman Chairperson of the Supervisory Board: Sonja Pierer Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.