[10/14] gdb: pass program space to objfiles_changed

Message ID 20240711195307.1544451-11-simon.marchi@polymtl.ca
State New
Headers
Series Some random program space cleanups |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed

Commit Message

Simon Marchi July 11, 2024, 7:52 p.m. UTC
  Make the current program space reference bubble up one level.

Change-Id: I9b33c9e0d22c171eb1bb59ce480621b02c7b7bf7
---
 gdb/objfiles.c | 8 +++-----
 gdb/objfiles.h | 5 ++++-
 gdb/symfile.c  | 2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)
  

Patch

diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 600d205d0645..f1569c35c10d 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -1163,16 +1163,14 @@  pc_in_section (CORE_ADDR pc, const char *name)
 	  && s->the_bfd_section->name != nullptr
 	  && strcmp (s->the_bfd_section->name, name) == 0);
 }
-
 
-/* Set section_map_dirty so section map will be rebuilt next time it
-   is used.  Called by reread_symbols.  */
+/* See objfiles.h.  */
 
 void
-objfiles_changed (void)
+objfiles_changed (program_space *pspace)
 {
   /* Rebuild section map next time we need it.  */
-  get_objfile_pspace_data (current_program_space)->section_map_dirty = 1;
+  get_objfile_pspace_data (pspace)->section_map_dirty = 1;
 }
 
 /* See comments in objfiles.h.  */
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 2fb786592b64..1e04704c68fd 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -938,7 +938,10 @@  extern bool have_full_symbols (program_space *pspace);
 extern void objfile_set_sym_fns (struct objfile *objfile,
 				 const struct sym_fns *sf);
 
-extern void objfiles_changed (void);
+/* Set section_map_dirty for PSPACE so the section map will be rebuilt next time
+   it is used.  */
+
+extern void objfiles_changed (program_space *pspace);
 
 /* Return true if ADDR maps into one of the sections of OBJFILE and false
    otherwise.  */
diff --git a/gdb/symfile.c b/gdb/symfile.c
index b9a576f24c9c..50fb9983f3d5 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2613,7 +2613,7 @@  reread_symbols (int from_tty)
 	     making the dangling pointers point to correct data
 	     again.  */
 
-	  objfiles_changed ();
+	  objfiles_changed (current_program_space);
 
 	  /* Recompute section offsets and section indices.  */
 	  objfile->sf->sym_offsets (objfile, {});