public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Nils-Christian Kempke via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 2/3] gdb/symtab: add lookup for trampoline functions
Date: Fri, 15 Jul 2022 14:13:25 -0600	[thread overview]
Message-ID: <87h73im8wq.fsf@tromey.com> (raw)
In-Reply-To: <20220707121538.1317473-3-nils-christian.kempke@intel.com> (Nils-Christian Kempke via Gdb-patches's message of "Thu, 7 Jul 2022 14:15:37 +0200")

>>>>> Nils-Christian Kempke via Gdb-patches <gdb-patches@sourceware.org> writes:

> In order to queriy information about the DW_AT_trampoline tag for
> subroutines and inlined subroutines two function were added to symtab.

> First, a routine for querying whether the given pc belongs to a block
> that is associated with a function (maybe inlined) marked
> DW_AT_trampoline.

> Second, a routine for querying a trampoline function's target.
> Subroutines and inlined subroutines marked with DW_AT_trampoline usually
> contain information about the target subroutine they are 'wrapping'/
> passing control to.

Thank you for the patch.

> gdb/ChangeLog:
> 2022-05-30  Nils-Christian Kempke  <nils-christian.kempke@intel.com>

> 	* symtab.h (in_trampoline_function): New function
> 	(find_function_trampoline_target): New function.
> 	* symtab.c (in_trampoline_function): New function implementation.
> 	(find_function_trampoline_target): New implementation of
> 	trampoline target lookup.

These aren't needed any more.

> +      if (trampoline->target_kind () == TRAMPOLINE_TARGET_PHYSNAME)
> +	{
> +	  /* Handle both the mangled and demangled PHYSNAME.  */
> +	  const char *physname = trampoline->target_physname ();
> +
> +	  if (find_minimal_symbol_address (physname, &target_address, nullptr)
> +	      != 0)
> +	    target_address = 0;

Will there always be a minimal symbol?  It seems like maybe this isn't a
requirement.

> +	  /* If the function symbol containing this trampoline target has
> +	     been relocated we assume the target_address also needs relocation.
> +	     If it has not been relocated the offset should be zero.  */
> +	  target_address = trampoline->target_physaddr ()
> +	    + sym->objfile ()->section_offsets[sym->section_index ()];

It seems to me that this adds an additional section offset, even though
one was already added when reading.

However as mentioned there, it's better to do this work here and undo
the offset in the reader.

Also this isn't formatted properly, you need parens around the right
hand side of the assignment.

Tom

  reply	other threads:[~2022-07-15 20:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07 12:15 [PATCH 1/3] gdb: add support for DW_AT_trampoline in DWARF reader Nils-Christian Kempke
2022-07-07 12:15 ` [PATCH 2/3] gdb/symtab: add lookup for trampoline functions Nils-Christian Kempke
2022-07-15 20:13   ` Tom Tromey [this message]
2022-07-07 12:15 ` [PATCH 3/3] gdb/infrun: handle stepping through functions with DW_AT_trampoline Nils-Christian Kempke
2022-07-15 20:20   ` Tom Tromey
2022-07-13  7:39 ` [PATCH 1/3] gdb: add support for DW_AT_trampoline in DWARF reader George, Jini Susan
2022-07-13 11:59   ` Kempke, Nils-Christian
2022-07-17 12:57     ` George, Jini Susan
2022-07-18 16:11       ` Tom Tromey
2022-07-15 20:05 ` Tom Tromey

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=87h73im8wq.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).