]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: add program_space parameter to lookup_minimal_symbol_text
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 17 Jul 2024 03:52:05 +0000 (23:52 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 12 Aug 2024 14:38:29 +0000 (10:38 -0400)
Make the current program space reference bubble up one level.  Use a
program space from the context whenever that makes sense.

Change-Id: Id3b0bf4490178d71a9aecdbf404b9287c22b30f5
Reviewed-by: Keith Seitz <keiths@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
gdb/breakpoint.c
gdb/jit.c
gdb/minsyms.c
gdb/minsyms.h
gdb/symtab.c

index dd015b8ce975dcb9fc7eb6862bb4cd5f7368b4ea..9d9ce6e1e664f89a172d716d2fa397ca928819af 100644 (file)
@@ -3571,7 +3571,8 @@ create_overlay_event_breakpoint (void)
       if (bp_objfile_data->overlay_msym.minsym == NULL)
        {
          bound_minimal_symbol m
-           = lookup_minimal_symbol_text (func_name, objfile);
+           = lookup_minimal_symbol_text (current_program_space, func_name,
+                                         objfile);
          if (m.minsym == NULL)
            {
              /* Avoid future lookups in this objfile.  */
@@ -3675,7 +3676,8 @@ create_longjmp_master_breakpoint_names (objfile *objfile)
       if (bp_objfile_data->longjmp_msym[i].minsym == NULL)
        {
          bound_minimal_symbol m
-           = lookup_minimal_symbol_text (func_name, objfile);
+           = lookup_minimal_symbol_text (objfile->pspace (), func_name,
+                                         objfile);
          if (m.minsym == NULL)
            {
              /* Prevent future lookups in this objfile.  */
@@ -3845,7 +3847,7 @@ create_exception_master_breakpoint_hook (objfile *objfile)
   if (bp_objfile_data->exception_msym.minsym == NULL)
     {
       bound_minimal_symbol debug_hook
-       = lookup_minimal_symbol_text (func_name, objfile);
+       = lookup_minimal_symbol_text (objfile->pspace (), func_name, objfile);
       if (debug_hook.minsym == NULL)
        {
          bp_objfile_data->exception_msym.minsym = &msym_not_found;
index 2744d03f8f8dd88da814deb3c5f2251852f0b882..d4513325190647f25b50f6fc3258bf120701800c 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -880,7 +880,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace)
       /* Lookup the registration symbol.  If it is missing, then we
         assume we are not attached to a JIT.  */
       bound_minimal_symbol reg_symbol
-       = lookup_minimal_symbol_text (jit_break_name, the_objfile);
+       = lookup_minimal_symbol_text (pspace, jit_break_name, the_objfile);
       if (reg_symbol.minsym == NULL
          || reg_symbol.value_address () == 0)
        {
index 40d63404fced3d9333e44eac0b79a5d482baf475..b5c4b95f1ba8178a7951c5476536f393cc577f98 100644 (file)
@@ -607,7 +607,8 @@ lookup_minimal_symbol_linkage (program_space *pspace, const char *name,
 /* See minsyms.h.  */
 
 bound_minimal_symbol
-lookup_minimal_symbol_text (const char *name, struct objfile *objf)
+lookup_minimal_symbol_text (program_space *pspace, const char *name,
+                           objfile *objf)
 {
   struct minimal_symbol *msymbol;
   bound_minimal_symbol found_symbol;
@@ -643,7 +644,7 @@ lookup_minimal_symbol_text (const char *name, struct objfile *objf)
 
   if (objf == nullptr)
     {
-      for (objfile *objfile : current_program_space->objfiles ())
+      for (objfile *objfile : pspace->objfiles ())
        {
          if (found_symbol.minsym != NULL)
            break;
index f84d3e8184800c67dcee185bf7ddab802ebf9119..9659f30dff8bb0a10c0ebe2c221626a4d8af2c6e 100644 (file)
@@ -211,7 +211,7 @@ bound_minimal_symbol lookup_minimal_symbol (program_space *pspace,
                                            objfile *obj = nullptr,
                                            const char *sfile = nullptr);
 
-/* Look through all the current minimal symbol tables and find the
+/* Look through all the minimal symbol tables in PSPACE and find the
    first minimal symbol that matches NAME and has text type.  If OBJF
    is non-NULL, limit the search to that objfile.  Returns a bound
    minimal symbol that matches, or an "empty" bound minimal symbol
@@ -219,8 +219,9 @@ bound_minimal_symbol lookup_minimal_symbol (program_space *pspace,
 
    This function only searches the mangled (linkage) names.  */
 
-bound_minimal_symbol lookup_minimal_symbol_text (const char *,
-                                                struct objfile *);
+bound_minimal_symbol lookup_minimal_symbol_text (program_space *pspace,
+                                                const char *name,
+                                                objfile *objf);
 
 /* Look through the minimal symbols in OBJF (and its separate debug
    objfiles) for a global (not file-local) minsym whose linkage name
index 9da148b3394dead7358790e367d021dcd72ea078..9b3562eeb303bb91b8fc4ee1dc74832b301c03a9 100644 (file)
@@ -3174,7 +3174,9 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
     if (msymbol.minsym->type () == mst_solib_trampoline)
       {
        bound_minimal_symbol mfunsym
-         = lookup_minimal_symbol_text (msymbol.minsym->linkage_name (), NULL);
+         = lookup_minimal_symbol_text (section->objfile->pspace (),
+                                       msymbol.minsym->linkage_name (),
+                                       nullptr);
 
        if (mfunsym.minsym == NULL)
          /* I eliminated this warning since it is coming out