[11/14] gdb: pass program space to entry_point_address_query

Message ID 20240711195307.1544451-12-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 bubble up one level.

Change-Id: Ic3ad0869ca1afe41854f605a6f7eb092fca29ff8
---
 gdb/frame.c     | 2 +-
 gdb/objfiles.c  | 9 ++++-----
 gdb/objfiles.h  | 6 +++++-
 gdb/solib-frv.c | 2 +-
 4 files changed, 11 insertions(+), 8 deletions(-)
  

Patch

diff --git a/gdb/frame.c b/gdb/frame.c
index 43efac07d95a..e6ab54797a8e 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2628,7 +2628,7 @@  inside_entry_func (const frame_info_ptr &this_frame)
 {
   CORE_ADDR entry_point;
 
-  if (!entry_point_address_query (&entry_point))
+  if (!entry_point_address_query (current_program_space, &entry_point))
     return false;
 
   return get_frame_func (this_frame) == entry_point;
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index f1569c35c10d..2a2fbd3ef01b 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -345,13 +345,12 @@  objfile::objfile (gdb_bfd_ref_ptr bfd_, const char *name, objfile_flags flags_)
   set_objfile_per_bfd (this);
 }
 
-/* If there is a valid and known entry point, function fills *ENTRY_P with it
-   and returns non-zero; otherwise it returns zero.  */
+/* See objfiles.h.  */
 
 int
-entry_point_address_query (CORE_ADDR *entry_p)
+entry_point_address_query (program_space *pspace, CORE_ADDR *entry_p)
 {
-  objfile *objf = current_program_space->symfile_object_file;
+  objfile *objf = pspace->symfile_object_file;
   if (objf == NULL || !objf->per_bfd->ei.entry_point_p)
     return 0;
 
@@ -368,7 +367,7 @@  entry_point_address (void)
 {
   CORE_ADDR retval;
 
-  if (!entry_point_address_query (&retval))
+  if (!entry_point_address_query (current_program_space, &retval))
     error (_("Entry point address is not known."));
 
   return retval;
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 1e04704c68fd..199dea0a9ba4 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -907,7 +907,11 @@  obj_section::set_offset (CORE_ADDR offset)
 
 /* Declarations for functions defined in objfiles.c */
 
-extern int entry_point_address_query (CORE_ADDR *entry_p);
+/* If there is a valid and known entry point in PSPACE, fill *ENTRY_P with it
+   and return non-zero.  */
+
+extern int entry_point_address_query (program_space *pspace,
+				      CORE_ADDR *entry_p);
 
 extern CORE_ADDR entry_point_address (void);
 
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 39508fab4c83..79052db86f82 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -687,7 +687,7 @@  enable_break (void)
       return 0;
     }
 
-  if (!entry_point_address_query (&entry_point))
+  if (!entry_point_address_query (current_program_space, &entry_point))
     {
       solib_debug_printf ("Symbol file has no entry point.");
       return 0;