]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove compunit_symtab::m_block_line_section
authorTom Tromey <tromey@adacore.com>
Thu, 19 Jan 2023 13:14:49 +0000 (06:14 -0700)
committerTom Tromey <tromey@adacore.com>
Wed, 8 Feb 2023 15:20:12 +0000 (08:20 -0700)
The previous patch hard-coded SECT_OFF_TEXT into the buildsym code.
After this, it's clear that there is only one caller of
compunit_symtab::set_block_line_section, and it always passes
SECT_OFF_TEXT.  So, remove compunit_symtab::m_block_line_section and
use SECT_OFF_TEXT instead.

gdb/buildsym.c
gdb/dwarf2/loc.c
gdb/gdbtypes.c
gdb/objfiles.c
gdb/symtab.c
gdb/symtab.h

index 41df0f061c1d7df1328ca53e5c39bc2c0c6890cb..d82c7672f7c4d903d0b3112bc555bb6c6f215ad2 100644 (file)
@@ -974,8 +974,6 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
     set_block_compunit_symtab (b, cu);
   }
 
-  cu->set_block_line_section (SECT_OFF_TEXT (m_objfile));
-
   cu->set_macro_table (release_macros ());
 
   /* Default any symbols without a specified symtab to the primary symtab.  */
index fe91d609f194ffe4ce5805e12b7c7e2f901349ce..236ad8204623931f6bb9a67e5728df6f59abae4a 100644 (file)
@@ -718,9 +718,7 @@ call_site_target::iterate_over_addresses
     case call_site_target::PHYSADDR:
       {
        dwarf2_per_objfile *per_objfile = call_site->per_objfile;
-       compunit_symtab *cust = per_objfile->get_symtab (call_site->per_cu);
-       int sect_idx = cust->block_line_section ();
-       CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx];
+       CORE_ADDR delta = per_objfile->objfile->text_section_offset ();
 
        callback (m_loc.physaddr + delta);
       }
@@ -729,9 +727,7 @@ call_site_target::iterate_over_addresses
     case call_site_target::ADDRESSES:
       {
        dwarf2_per_objfile *per_objfile = call_site->per_objfile;
-       compunit_symtab *cust = per_objfile->get_symtab (call_site->per_cu);
-       int sect_idx = cust->block_line_section ();
-       CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx];
+       CORE_ADDR delta = per_objfile->objfile->text_section_offset ();
 
        for (unsigned i = 0; i < m_loc.addresses.length; ++i)
          callback (m_loc.addresses.values[i] + delta);
index 6a4c5976f180d13993ed69e201ed67ee4558519a..45751c9c895f4ddd33b540984d8d483c6301a978 100644 (file)
@@ -6436,9 +6436,7 @@ objfile_type (struct objfile *objfile)
 CORE_ADDR
 call_site::pc () const
 {
-  compunit_symtab *cust = this->per_objfile->get_symtab (this->per_cu);
-  CORE_ADDR delta
-       = this->per_objfile->objfile->section_offsets[cust->block_line_section ()];
+  CORE_ADDR delta = this->per_objfile->objfile->text_section_offset ();
   return m_unrelocated_pc + delta;
 }
 
index e4fe3562c12cecb2d58e5312d14d6c55b129a64c..bf5057e723d6f77ccf2a28904386e255c0bd4a3f 100644 (file)
@@ -629,7 +629,7 @@ objfile_relocate1 (struct objfile *objfile,
            if (l)
              {
                for (int i = 0; i < l->nitems; ++i)
-                 l->item[i].pc += delta[cust->block_line_section ()];
+                 l->item[i].pc += delta[SECT_OFF_TEXT (objfile)];
              }
          }
       }
@@ -637,7 +637,7 @@ objfile_relocate1 (struct objfile *objfile,
     for (compunit_symtab *cust : objfile->compunits ())
       {
        struct blockvector *bv = cust->blockvector ();
-       int block_line_section = cust->block_line_section ();
+       int block_line_section = SECT_OFF_TEXT (objfile);
 
        if (bv->map () != nullptr)
          bv->map ()->relocate (delta[block_line_section]);
index a120c1d5e153b18575fd980cc11e9079c496df8a..bf3a3e3caaa2c4def5912e6faadec07062cfb634 100644 (file)
@@ -342,8 +342,7 @@ compunit_symtab::find_call_site (CORE_ADDR pc) const
   if (m_call_site_htab == nullptr)
     return nullptr;
 
-  CORE_ADDR delta
-    = this->objfile ()->section_offsets[this->block_line_section ()];
+  CORE_ADDR delta = this->objfile ()->text_section_offset ();
   CORE_ADDR unrelocated_pc = pc - delta;
 
   struct call_site call_site_local (unrelocated_pc, nullptr, nullptr);
index 484644f61299dfdf81b32c444ca10f23f981477f..50ce7525793b922e8cc8963c482021c556d1f162 100644 (file)
@@ -1786,16 +1786,6 @@ struct compunit_symtab
     m_blockvector = blockvector;
   }
 
-  int block_line_section () const
-  {
-    return m_block_line_section;
-  }
-
-  void set_block_line_section (int block_line_section)
-  {
-    m_block_line_section = block_line_section;
-  }
-
   bool locations_valid () const
   {
     return m_locations_valid;
@@ -1884,10 +1874,6 @@ struct compunit_symtab
      all symtabs in a given compilation unit.  */
   struct blockvector *m_blockvector;
 
-  /* Section in objfile->section_offsets for the blockvector and
-     the linetable.  Probably always SECT_OFF_TEXT.  */
-  int m_block_line_section;
-
   /* Symtab has been compiled with both optimizations and debug info so that
      GDB may stop skipping prologues as variables locations are valid already
      at function entry points.  */