Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Abdul Basit Ijaz <abdul.b.ijaz@intel.com>
Cc: gdb-patches@sourceware.org,  JiniSusan.George@amd.com,
	 tom@tromey.com, eliz@gnu.org,
	 Nils-Christian Kempke <nils-christian.kempke@intel.com>
Subject: Re: [PATCH v11 01/10] gdb, dwarf: add support for DW_AT_trampoline in DWARF reader
Date: Wed, 21 Oct 2026 14:33:54 -0600	[thread overview]
Message-ID: <87wlrau72l.fsf@tromey.com> (raw)
In-Reply-To: <20260803193449.33375-2-abdul.b.ijaz@intel.com> (Abdul Basit Ijaz's message of "Mon, 3 Aug 2026 21:34:40 +0200")

>>>>> Abdul Basit Ijaz <abdul.b.ijaz@intel.com> writes:

> DW_AT_trampoline can be used to describe compiler generated functions
> that serve some intermediary purpose on making a call to another
> function.  A compiler can emit this tag in order to help a debugger hide
> the trampolines from a user.

> This patch adds support to GDB for reading the DW_AT_trampoline
> attribute.  It stores the attribute and its value in the type_specific
> part of a GDB type.  This patch is implemented in preparation of the
> following patches, which will add a mechanism to hide DW_AT_trampoline
> subroutines from the user.

One thing I don't understand is why this data is attached to the type,
and not to the function's symbol (or perhaps the block structure).

> +      TYPE_TRAMPOLINE_TARGET (ftype)
> +	= (trampoline_target *) TYPE_ZALLOC (ftype,
> +					     sizeof (trampoline_target));

This zero-initializes so...

> +	  if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu,
> +				    nullptr, nullptr) <= PC_BOUNDS_INVALID)
> +	    complaint (_("DW_AT_trampoline target DIE has invalid "
> +			 "low pc, for referencing DIE %s[in module %s]"),
> +			 sect_offset_str (die->sect_off),
> +			 objfile_name (objfile));
> +	  else
> +	    TYPE_TRAMPOLINE_TARGET (ftype)->set_target_addr (lowpc);

... if the complaint triggers, this will end up with a kind of
TRAMPOLINE_TARGET_ADDR and an unrelocated address of 0.

Perhaps in such a case it's better to avoid marking the function as a
trampoline.  That way, if there is a problem in the DWARF, gdb will fall
back to the function simply being ordinary.

> +      else if (attr->form_is_unsigned ())
> +	TYPE_TRAMPOLINE_TARGET (ftype)->set_target_flag (attr->as_boolean ());
> +      else
> +	TYPE_TRAMPOLINE_TARGET (ftype)->set_target_addr (attr->as_address ());

This else clause also seems perhaps weird.

I had some other nits for this patch but I figured I'd rather find out
about the type issue before writing them up.

Tom

  reply	other threads:[~2026-10-21 20:34 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 19:34 [PATCH v11 00/10] GDB support for DW_AT_trampoline Abdul Basit Ijaz
2026-08-03 19:34 ` [PATCH v11 01/10] gdb, dwarf: add support for DW_AT_trampoline in DWARF reader Abdul Basit Ijaz
2026-10-21 20:33   ` Tom Tromey [this message]
2026-10-22 11:02     ` Ijaz, Abdul B
2026-08-03 19:34 ` [PATCH v11 02/10] gdb/symtab: add lookup for trampoline functions Abdul Basit Ijaz
2026-08-03 19:34 ` [PATCH v11 03/10] gdb: handle stepping through functions with DW_AT_trampoline Abdul Basit Ijaz
2026-10-21 20:39   ` Tom Tromey
2026-10-22 11:15     ` Ijaz, Abdul B
2026-10-21 20:43   ` Tom Tromey
2026-10-22 11:37     ` Ijaz, Abdul B
2026-08-03 19:34 ` [PATCH v11 04/10] gdb: Skip trampoline frames for the backtrace command Abdul Basit Ijaz
2026-10-21 20:50   ` Tom Tromey
2026-10-22 12:11     ` Ijaz, Abdul B
2026-08-03 19:34 ` [PATCH v11 05/10] gdb: Skip trampoline functions for the finish and reverse-finish commands Abdul Basit Ijaz
2026-10-21 20:52   ` Tom Tromey
2026-10-22 12:31     ` Ijaz, Abdul B
2026-08-03 19:34 ` [PATCH v11 06/10] gdb: Skip trampoline functions for the up command Abdul Basit Ijaz
2026-10-21 20:53   ` Tom Tromey
2026-10-22 13:01     ` Tom Tromey
2026-10-22 14:02       ` Ijaz, Abdul B
2026-08-03 19:34 ` [PATCH v11 07/10] gdb: Skip trampoline functions for the return command Abdul Basit Ijaz
2026-08-03 19:34 ` [PATCH v11 08/10] gdb, mi: Skip trampoline functions for the -stack-list-frames command Abdul Basit Ijaz
2026-10-21 20:58   ` Tom Tromey
2026-10-22 14:18     ` Ijaz, Abdul B
2026-08-03 19:34 ` [PATCH v11 09/10] gdb, mi: Skip trampoline functions for the -stack-list-arguments command Abdul Basit Ijaz
2026-08-03 19:34 ` [PATCH v11 10/10] gdb: Filter trampoline frames in backtrace when using Python frame-filters Abdul Basit Ijaz
2026-10-21 21:03   ` Tom Tromey
2026-10-22 17:04     ` Ijaz, Abdul B
2026-09-09  7:40 ` [PING][PATCH v11 00/10] GDB support for DW_AT_trampoline Ijaz, Abdul B
2026-09-18  9:33   ` Ijaz, Abdul B
2026-10-01  7:49     ` Ijaz, Abdul B
2026-10-12 13:52       ` Ijaz, Abdul B

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wlrau72l.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=JiniSusan.George@amd.com \
    --cc=abdul.b.ijaz@intel.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=nils-christian.kempke@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox