public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Abdul Basit Ijaz via Gdb-patches <gdb-patches@sourceware.org>
Cc: Abdul Basit Ijaz <abdul.b.ijaz@intel.com>,
	 JiniSusan.George@amd.com, tom@tromey.com,  eliz@gnu.org,
	 blarsen@redhat.com,
	 Nils-Christian Kempke <nils-christian.kempke@intel.com>
Subject: Re: [PATCH v4 2/4] gdb/symtab: add lookup for trampoline functions
Date: Wed, 02 Aug 2023 14:18:06 -0600	[thread overview]
Message-ID: <87pm45ci69.fsf@tromey.com> (raw)
In-Reply-To: <20230801224744.24433-3-abdul.b.ijaz@intel.com> (Abdul Basit Ijaz via Gdb-patches's message of "Wed, 2 Aug 2023 00:47:42 +0200")

>>>>> "Abdul" == Abdul Basit Ijaz via Gdb-patches <gdb-patches@sourceware.org> writes:

Abdul> From: Nils-Christian Kempke <nils-christian.kempke@intel.com>
Abdul> In order to query information about the DW_AT_trampoline tag for
Abdul> subroutines and inlined subroutines, two function were added to symtab.

Thanks for the patch.

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

First, I'm all in favor of storing unrelocated addresses in data
structures and then relocating them at point of use.

However, in this case, I think the stored address is already relocated.
From the previous patch:

+	  unrelocated_addr target_addr_reloc = attr->as_address ();
+	  CORE_ADDR target_addr
+	    = cu->per_objfile->relocate (target_addr_reloc);
+	  target_addr = gdbarch_adjust_dwarf2_addr (objfile->arch (),
+						    target_addr);
+	  TYPE_TRAMPOLINE_TARGET (ftype)->set_target_physaddr (target_addr);

... this brings up another issue, though -- if a relocated address is
stored, then it must be relocated by objfile_relocate.

So perhaps storing the unrelocated address here really would be better.
This can be done using 'adjust' rather than 'relocate' in the first
patch, and by using the unrelocated_addr type rather than CORE_ADDR for
storage.

Tom

  reply	other threads:[~2023-08-02 20:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01 22:47 [PATCH v4 0/4] GDB support for DW_AT_trampoline Abdul Basit Ijaz
2023-08-01 22:47 ` [PATCH v4 1/4] gdb, dwarf: add support for DW_AT_trampoline in DWARF reader Abdul Basit Ijaz
2023-08-02 20:07   ` Tom Tromey
2023-08-07 14:43     ` Ijaz, Abdul B
2023-08-10 16:20       ` Tom Tromey
2023-08-02 20:13   ` Tom Tromey
2023-08-07 13:36     ` Ijaz, Abdul B
2023-08-10 16:18       ` Tom Tromey
2023-08-14 21:53         ` Ijaz, Abdul B
2023-08-01 22:47 ` [PATCH v4 2/4] gdb/symtab: add lookup for trampoline functions Abdul Basit Ijaz
2023-08-02 20:18   ` Tom Tromey [this message]
2023-08-07  7:40     ` Ijaz, Abdul B
2023-08-01 22:47 ` [PATCH v4 3/4] gdb/infrun: handle stepping through functions with DW_AT_trampoline Abdul Basit Ijaz
2023-08-02 11:52   ` Eli Zaretskii
2023-08-02 11:54     ` Ijaz, Abdul B
2023-08-02 20:33   ` Tom Tromey
2023-08-07  8:08     ` Ijaz, Abdul B
2023-08-10 16:56       ` Tom Tromey
2023-08-16 14:18         ` Ijaz, Abdul B
2023-08-01 22:47 ` [PATCH v4 4/4] gdb: Skip trampoline frames in the stack for printing or finish command Abdul Basit Ijaz
2023-08-02 11:52   ` Eli Zaretskii
2023-08-02 11:54     ` Ijaz, Abdul B
2023-08-02 20:41   ` Tom Tromey
2023-08-07 13:28     ` Ijaz, Abdul B
2023-08-10 17:45       ` Tom Tromey
2023-08-02 20:42   ` Tom Tromey
2023-08-07  7:19     ` 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=87pm45ci69.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=JiniSusan.George@amd.com \
    --cc=abdul.b.ijaz@intel.com \
    --cc=blarsen@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).