]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: add obj_section function to bound_minimal_symbol
authorAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 10 Feb 2021 15:07:04 +0000 (15:07 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 11 Feb 2021 09:50:58 +0000 (09:50 +0000)
Add a new obj_section function to bound_minimal_symbol, this just
calls obj_section on the contained minimal_symbol passing in the
contained objfile.

This allows some minor code simplification in a few places.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* breakpoint.c (resolve_sal_pc): Make use of
bound_minimal_symbol::obj_section.
* maint.c (maintenance_translate_address): Likewise.
* minsyms.c (minimal_symbol_upper_bound): Likewise.
* minsyms.h (struct bound_minimal_symbol) <obj_section>: New
member function.
* printcmd.c (info_address_command): Make use of
bound_minimal_symbol::obj_section.

gdb/ChangeLog
gdb/breakpoint.c
gdb/maint.c
gdb/minsyms.c
gdb/minsyms.h
gdb/printcmd.c

index 408d38865b0950b513cb991d175537b6e5852c73..69e14b32730661610a7581259dc18f415116c5e9 100644 (file)
@@ -1,3 +1,14 @@
+2021-02-11  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * breakpoint.c (resolve_sal_pc): Make use of
+       bound_minimal_symbol::obj_section.
+       * maint.c (maintenance_translate_address): Likewise.
+       * minsyms.c (minimal_symbol_upper_bound): Likewise.
+       * minsyms.h (struct bound_minimal_symbol) <obj_section>: New
+       member function.
+       * printcmd.c (info_address_command): Make use of
+       bound_minimal_symbol::obj_section.
+
 2021-02-11  Alan Modra  <amodra@gmail.com>
 
        * arm-symbian-tdep.c: Delete.
index 5f1914e0eb73f21dc30d0dc77178a3afc5594d99..e9aba79e40fe00831d71908d0fcefcd23e2cf377 100644 (file)
@@ -9691,7 +9691,7 @@ resolve_sal_pc (struct symtab_and_line *sal)
 
              bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (sal->pc);
              if (msym.minsym)
-               sal->section = msym.minsym->obj_section (msym.objfile);
+               sal->section = msym.obj_section ();
            }
        }
     }
index 7495cab0ec0c61d703dc48076cd8f2c25854da37..f6e42f6a7e3f4620eb64c557581fef08fee66e78 100644 (file)
@@ -509,7 +509,7 @@ maintenance_translate_address (const char *arg, int from_tty)
       const char *symbol_offset
        = pulongest (address - BMSYMBOL_VALUE_ADDRESS (sym));
 
-      sect = sym.minsym->obj_section (sym.objfile);
+      sect = sym.obj_section ();
       if (sect != NULL)
        {
          const char *section_name;
index 8b8e11a83d0476196315dfbd2fb8df4ddf26c22b..3cf849f48bf00a8a3d2dfd0cc4b1380497ce24a1 100644 (file)
@@ -1561,7 +1561,7 @@ minimal_symbol_upper_bound (struct bound_minimal_symbol minsym)
        break;
     }
 
-  obj_section = minsym.minsym->obj_section (minsym.objfile);
+  obj_section = minsym.obj_section ();
   if (iter != past_the_end
       && (MSYMBOL_VALUE_ADDRESS (minsym.objfile, iter)
          < obj_section_endaddr (obj_section)))
index 75de98c75546e6e24553656ca73740cfca9cb3f3..7f218719d466adbe6913aeda34b2f791d84050d8 100644 (file)
@@ -37,6 +37,13 @@ struct bound_minimal_symbol
      symbol is defined.  */
 
   struct objfile *objfile;
+
+  /* Return the obj_section from OBJFILE for MINSYM.  */
+
+  struct obj_section *obj_section () const
+  {
+    return minsym->obj_section (objfile);
+  }
 };
 
 /* This header declares most of the API for dealing with minimal
index 1e328a71160c059d1d594ac6565c4679a3417b3d..58e39c7365f98f531afd6c27503bb2a589c6f923 100644 (file)
@@ -1678,7 +1678,7 @@ info_address_command (const char *exp, int from_tty)
          printf_filtered ("unresolved");
        else
          {
-           section = msym.minsym->obj_section (msym.objfile);
+           section = msym.obj_section ();
 
            if (section
                && (section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)