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 v2 3/5] Hoist a call to frob_address
Date: Tue, 28 May 2024 13:23:56 -0600	[thread overview]
Message-ID: <20240528-dwarf-race-relocate-v2-3-a8d042e75925@tromey.com> (raw)
In-Reply-To: <20240528-dwarf-race-relocate-v2-0-a8d042e75925@tromey.com>

This hoists the call to frob_address in
lookup_minimal_symbol_by_pc_section, so that it now appears earlier in
the loop.  This is just a small cleanup.  Making this change also made
it clear that 'pc' is not used, so this removes the local variable as
well.
---
 gdb/minsyms.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 97b1a1c15c8..beafb6ad6dc 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -795,7 +795,9 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
 
   for (objfile *objfile : section->objfile->separate_debug_objfiles ())
     {
-      CORE_ADDR pc = pc_in;
+      unrelocated_addr unrel_pc;
+      if (!frob_address (objfile, pc_in, &unrel_pc))
+	continue;
 
       /* If this objfile has a minimal symbol table, go search it
 	 using a binary search.  */
@@ -826,9 +828,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
 
 	     Warning: this code is trickier than it would appear at first.  */
 
-	  unrelocated_addr unrel_pc;
-	  if (frob_address (objfile, pc, &unrel_pc)
-	      && unrel_pc >= msymbol[lo].unrelocated_address ())
+	  if (unrel_pc >= msymbol[lo].unrelocated_address ())
 	    {
 	      while (msymbol[hi].unrelocated_address () > unrel_pc)
 		{

-- 
2.44.0


  parent reply	other threads:[~2024-05-28 19:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28 19:23 [PATCH v2 0/5] Cleanups in lookup_minimal_symbol_by_pc_section Tom Tromey
2024-05-28 19:23 ` [PATCH v2 1/5] Compare section index " Tom Tromey
2024-05-28 19:23 ` [PATCH v2 2/5] Remove unnecessary null check " Tom Tromey
2024-05-28 19:23 ` Tom Tromey [this message]
2024-05-28 19:23 ` [PATCH v2 4/5] Use bound_minimal_symbol more " Tom Tromey
2024-05-28 19:23 ` [PATCH v2 5/5] Fix address comparison " 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=20240528-dwarf-race-relocate-v2-3-a8d042e75925@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).