public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/5] Remove call to dwarf2_per_objfile::adjust from ranges readers
Date: Mon, 29 Apr 2024 14:16:57 +0100	[thread overview]
Message-ID: <87a5lcpauu.fsf@redhat.com> (raw)
In-Reply-To: <87cyq8pbnp.fsf@redhat.com>

Andrew Burgess <aburgess@redhat.com> writes:

> Hi Tom,
>
> So, I don't know the details of the DWARF reader too well, so my attempt
> to review this patch might be just wasting your time.  But I didn't
> really understand what was going on here, so...
>
> Tom Tromey <tom@tromey.com> writes:
>
>> dwarf2_per_objfile::adjust applies gdbarch_adjust_dwarf2_addr to an
>> address, leaving the result unrelocated.  However, this adjustment is
>> only needed for text-section symbols -- it isn't needed for any sort
>
> I didn't know if the use of the word 'symbols' here was significant.
> gdbarch_adjust_dwarf2_addr operates on addresses, and I guess symbol
> could be a synonym for address in some contexts.  But the addresses here
> do seem to be .text addresses, so clearly there's some important
> distinction that I'm not understanding.
>
>> of address mapping.  Therefore, these calls can be removed from
>
> gdbarch_adjust_dwarf2_addr seems to be relevant for .text addresses,
> which is what you're handling here, but you are creating a map, but it's
> not clear _why_ those addresses wouldn't need to be updated.

A follow on question.  Looking through gdb/dwarf/ there seem to be
several other places where the addrmap_mutable::set_empty is called, and
in at least some of those places the addresses are still being
adjusted.  E.g.:

  dwarf2_ranges_read
  cooked_indexer::check_bounds
  cooked_indexer::scan_attributes

Why do these not need changing?

Thanks,
Andrew



>
> Sorry to ask what are probably obvious questions...
>
> Thanks,
> Andrew
>
>> read_addrmap_from_aranges and create_addrmap_from_gdb_index.
>> ---
>>  gdb/dwarf2/aranges.c        | 2 --
>>  gdb/dwarf2/read-gdb-index.c | 2 --
>>  2 files changed, 4 deletions(-)
>>
>> diff --git a/gdb/dwarf2/aranges.c b/gdb/dwarf2/aranges.c
>> index d577db62726..0d1dc11e27a 100644
>> --- a/gdb/dwarf2/aranges.c
>> +++ b/gdb/dwarf2/aranges.c
>> @@ -190,8 +190,6 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
>>  	      continue;
>>  	    }
>>  	  ULONGEST end = start + length;
>> -	  start = (ULONGEST) per_objfile->adjust ((unrelocated_addr) start);
>> -	  end = (ULONGEST) per_objfile->adjust ((unrelocated_addr) end);
>>  	  mutable_map->set_empty (start, end - 1, per_cu);
>>  	}
>>  
>> diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c
>> index 8c0895b9639..cc6361674e8 100644
>> --- a/gdb/dwarf2/read-gdb-index.c
>> +++ b/gdb/dwarf2/read-gdb-index.c
>> @@ -566,8 +566,6 @@ create_addrmap_from_gdb_index (dwarf2_per_objfile *per_objfile,
>>  	  continue;
>>  	}
>>  
>> -      lo = (ULONGEST) per_objfile->adjust ((unrelocated_addr) lo);
>> -      hi = (ULONGEST) per_objfile->adjust ((unrelocated_addr) hi);
>>        mutable_map.set_empty (lo, hi - 1, per_bfd->get_cu (cu_index));
>>      }
>>  
>>
>> -- 
>> 2.43.0


  reply	other threads:[~2024-04-29 13:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16 17:05 [PATCH 0/5] Fix race in DWARF reader, 2nd approach Tom Tromey
2024-04-16 17:05 ` [PATCH 1/5] Remove call to dwarf2_per_objfile::adjust from ranges readers Tom Tromey
2024-04-29 12:59   ` Andrew Burgess
2024-04-29 13:16     ` Andrew Burgess [this message]
2024-04-29 14:36       ` Andrew Burgess
2024-04-29 20:04     ` Tom Tromey
2024-05-01 14:56       ` Andrew Burgess
2024-05-04 15:30         ` Tom Tromey
2024-04-16 17:05 ` [PATCH 2/5] Remove more calls to dwarf2_per_objfile::adjust Tom Tromey
2024-04-16 17:05 ` [PATCH 3/5] Remove call to dwarf2_per_objfile::adjust from read_call_site_scope Tom Tromey
2024-04-16 17:05 ` [PATCH 4/5] Remove call to dwarf2_per_objfile::adjust from read_attribute_value Tom Tromey
2024-04-16 17:05 ` [PATCH 5/5] Remove dwarf2_per_objfile::adjust 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=87a5lcpauu.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --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).