public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Remove extra scopes from objfile_relocate1
@ 2023-03-11 15:56 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-03-11 15:56 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=82c5090c61ed2a4a6cd37e575ae66323e0a837f7

commit 82c5090c61ed2a4a6cd37e575ae66323e0a837f7
Author: Tom Tromey <tom@tromey.com>
Date:   Tue Mar 7 16:24:11 2023 -0700

    Remove extra scopes from objfile_relocate1
    
    objfile_relocate1 introduces new scopes that aren't necessary.  I
    noticed this while working on an earlier patch in this series.  This
    patch removes these.
    
    Approved-By: Simon Marchi <simon.marchi@efficios.com>

Diff:
---
 gdb/objfiles.c | 76 +++++++++++++++++++++++++---------------------------------
 1 file changed, 33 insertions(+), 43 deletions(-)

diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 2c8f5d14444..21ec8c7ad2e 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -615,53 +615,43 @@ objfile_relocate1 (struct objfile *objfile,
     return 0;
 
   /* OK, get all the symtabs.  */
-  {
-    for (compunit_symtab *cust : objfile->compunits ())
-      {
-	struct blockvector *bv = cust->blockvector ();
-	int block_line_section = SECT_OFF_TEXT (objfile);
-
-	if (bv->map () != nullptr)
-	  bv->map ()->relocate (delta[block_line_section]);
-
-	for (block *b : bv->blocks ())
-	  {
-	    struct symbol *sym;
-	    struct mdict_iterator miter;
-
-	    b->set_start (b->start () + delta[block_line_section]);
-	    b->set_end (b->end () + delta[block_line_section]);
-
-	    for (blockrange &r : b->ranges ())
-	      {
-		r.set_start (r.start () + delta[block_line_section]);
-		r.set_end (r.end () + delta[block_line_section]);
-	      }
-
-	    /* We only want to iterate over the local symbols, not any
-	       symbols in included symtabs.  */
-	    ALL_DICT_SYMBOLS (b->multidict (), miter, sym)
-	      {
-		relocate_one_symbol (sym, objfile, delta);
-	      }
-	  }
-      }
-  }
+  for (compunit_symtab *cust : objfile->compunits ())
+    {
+      struct blockvector *bv = cust->blockvector ();
+      int block_line_section = SECT_OFF_TEXT (objfile);
 
-  /* Relocate isolated symbols.  */
-  {
-    struct symbol *iter;
+      if (bv->map () != nullptr)
+	bv->map ()->relocate (delta[block_line_section]);
 
-    for (iter = objfile->template_symbols; iter; iter = iter->hash_next)
-      relocate_one_symbol (iter, objfile, delta);
-  }
+      for (block *b : bv->blocks ())
+	{
+	  struct symbol *sym;
+	  struct mdict_iterator miter;
 
-  {
-    int i;
+	  b->set_start (b->start () + delta[block_line_section]);
+	  b->set_end (b->end () + delta[block_line_section]);
 
-    for (i = 0; i < objfile->section_offsets.size (); ++i)
-      objfile->section_offsets[i] = new_offsets[i];
-  }
+	  for (blockrange &r : b->ranges ())
+	    {
+	      r.set_start (r.start () + delta[block_line_section]);
+	      r.set_end (r.end () + delta[block_line_section]);
+	    }
+
+	  /* We only want to iterate over the local symbols, not any
+	     symbols in included symtabs.  */
+	  ALL_DICT_SYMBOLS (b->multidict (), miter, sym)
+	    {
+	      relocate_one_symbol (sym, objfile, delta);
+	    }
+	}
+    }
+
+  /* Relocate isolated symbols.  */
+  for (symbol *iter = objfile->template_symbols; iter; iter = iter->hash_next)
+    relocate_one_symbol (iter, objfile, delta);
+
+  for (int i = 0; i < objfile->section_offsets.size (); ++i)
+    objfile->section_offsets[i] = new_offsets[i];
 
   /* Rebuild section map next time we need it.  */
   get_objfile_pspace_data (objfile->pspace)->section_map_dirty = 1;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-11 15:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-11 15:56 [binutils-gdb] Remove extra scopes from objfile_relocate1 Tom Tromey

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).