public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 7/7] Fix address comparison in lookup_minimal_symbol_by_pc_section
Date: Sat, 17 Feb 2024 18:10:08 -0700	[thread overview]
Message-ID: <20240217-dwarf-race-relocate-v1-7-d3d2d908c1e8@tromey.com> (raw)
In-Reply-To: <20240217-dwarf-race-relocate-v1-0-d3d2d908c1e8@tromey.com>

I noticed that lookup_minimal_symbol_by_pc_section is comparing
unrelocated addresses across objfiles when trying to find the best
symbol.  However, this seems incorrect to me, as the unrelocated
addresses aren't of interest here.  This patch changes this code to
compare the true addresses instead.

This does make me wonder whether this code is necessary at all.
---
 gdb/minsyms.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 64f085a0314..06a87865c13 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1035,8 +1035,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
 	 table.  See if it is the best one overall.  */
       if (minsym != nullptr
 	  && (best.minsym == nullptr
-	      || (best.minsym->unrelocated_address ()
-		  < minsym->unrelocated_address ())))
+	      || best.value_address () < minsym->value_address (objfile)))
 	best = { minsym, objfile };
     }
 

-- 
2.43.0


  parent reply	other threads:[~2024-02-18  1:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-18  1:10 [PATCH 0/7] Fix race in DWARF reader Tom Tromey
2024-02-18  1:10 ` [PATCH 1/7] Compare section index in lookup_minimal_symbol_by_pc_section Tom Tromey
2024-02-18  1:10 ` [PATCH 2/7] Remove unnecessary null check " Tom Tromey
2024-02-18  1:10 ` [PATCH 3/7] Hoist a call to frob_address Tom Tromey
2024-02-18  1:10 ` [PATCH 4/7] Add unrelocated overload of lookup_minimal_symbol_by_pc_section Tom Tromey
2024-02-18  1:10 ` [PATCH 5/7] Fix race in background DWARF indexer Tom Tromey
2024-02-18  1:10 ` [PATCH 6/7] Use bound_minimal_symbol more in lookup_minimal_symbol_by_pc_section Tom Tromey
2024-02-18  1:10 ` Tom Tromey [this message]
2024-04-03 15:16 ` [PATCH 0/7] Fix race in DWARF reader Tom Tromey
2024-04-09 18:16   ` John Baldwin
2024-04-09 22:11     ` Luis Machado
2024-04-10  0:02       ` Maciej W. Rozycki
2024-04-16 17: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=20240217-dwarf-race-relocate-v1-7-d3d2d908c1e8@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).