public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH][gdb/symtab] Relocate call_site_htab
Date: Fri, 1 Oct 2021 10:25:02 +0200	[thread overview]
Message-ID: <2d6504fb-4a2d-4a01-b637-7c90cea92a6e@suse.de> (raw)
In-Reply-To: <80671fa7-d3cf-d518-a53b-f3ed8e453576@polymtl.ca>

n 10/1/21 3:15 AM, Simon Marchi wrote:
>> Ack, thanks.  I've put this through testing and ran into only two
>> regressions (so, this used to pass for me with unix/-fPIE/-pie):
>> ...
>> FAIL: gdb.trace/entry-values.exp: bt (1) (pattern 1)
>> FAIL: gdb.trace/entry-values.exp: bt (2) (pattern 1)
>> ...
>> while still fixing all the unix/-fno-PIE/-no-pie vs unix/-fPIE/-pie
>> regressions.
>>
>> Fixed by:
>> ...
>> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
>> index bb5767aae67..fa775722afb 100644
>> --- a/gdb/dwarf2/read.c
>> +++ b/gdb/dwarf2/read.c
>> @@ -13517,7 +13517,8 @@ read_call_site_scope
>>                        sect_offset_str (die->sect_off), objfile_name
>> (objfile));
>>           else
>>             {
>> -             lowpc = gdbarch_adjust_dwarf2_addr (gdbarch, lowpc +
>> baseaddr);
>> +             lowpc = (gdbarch_adjust_dwarf2_addr (gdbarch, lowpc +
>> baseaddr)
>> +                      - baseaddr);
>>               SET_FIELD_PHYSADDR (call_site->target, lowpc);
>>             }
>>         }
> 
> That makes sense.  This means that with my patch, the value stored in
> the target was relocated, by interpreted as unrelocated?

Yes.

> Does that mean
> that with your patch, that value ended up relocated twice?  Once here,
> and once in objfile_relocate1?

No, though it took me some debugging to realize why :)

There are two scenarios:
- read_call_site_scope is triggered with baseaddr == 0, so the
  addresses are unrelocated.
  Then call_site_relocate is triggered with non-zero baseaddr, and
  the addresses become relocated.
- read_call_site_scope is triggered with non-zero baseaddr, so the
  addresses are relocated.
  Then call_site_relocate is not triggered, so the addresses remain
  correct, and are not relocated twice.

Thanks,
- Tom

  reply	other threads:[~2021-10-01  8:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30  9:56 Tom de Vries
2021-09-30 14:26 ` Simon Marchi
2021-09-30 18:14   ` Tom Tromey
2021-09-30 23:47   ` Tom de Vries
2021-10-01  1:15     ` Simon Marchi
2021-10-01  8:25       ` Tom de Vries [this message]
2021-10-01 12:37         ` Tom de Vries

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=2d6504fb-4a2d-4a01-b637-7c90cea92a6e@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=tom@tromey.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).