]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Move entry point functions to program_space
authorTom Tromey <tom@tromey.com>
Thu, 12 Feb 2026 23:54:52 +0000 (16:54 -0700)
committerTom Tromey <tom@tromey.com>
Sat, 14 Feb 2026 17:27:50 +0000 (10:27 -0700)
This changes a couple of entry-point-related functions to be methods
on program_space, and moves them to progspace.c.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/arc-tdep.c
gdb/arch-utils.c
gdb/frame.c
gdb/infcall.c
gdb/objfiles.c
gdb/objfiles.h
gdb/progspace.c
gdb/progspace.h
gdb/solib-frv.c

index 48f83dd57c63d263ae0d4bee75554622a85e978d..99f002341eed81b1bb1747e31e93786ed9e7700f 100644 (file)
@@ -861,7 +861,7 @@ arc_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr,
                     struct regcache *regcache)
 {
   *real_pc = funaddr;
-  *bp_addr = entry_point_address (current_program_space);
+  *bp_addr = current_program_space->entry_point_address ();
   return sp;
 }
 
index c3ed8f07dc1195d6b431dd3d85c867e712d854ad..9d3dbfa2d81cb7c8a9d3b7052f66c9f8e9c6efd1 100644 (file)
@@ -57,7 +57,7 @@ displaced_step_at_entry_point (struct gdbarch *gdbarch)
   CORE_ADDR addr;
   int bp_len;
 
-  addr = entry_point_address (current_program_space);
+  addr = current_program_space->entry_point_address ();
 
   /* Inferior calls also use the entry point as a breakpoint location.
      We don't want displaced stepping to interfere with those
index 8cb1d0a5c428afdd5a25869980372da3f5d1a943..bfc85296942f8f447dc0e62d4394e7d9a9852486 100644 (file)
@@ -2677,7 +2677,7 @@ inside_entry_func (const frame_info_ptr &this_frame)
 {
   CORE_ADDR entry_point;
 
-  if (!entry_point_address_query (current_program_space, &entry_point))
+  if (!current_program_space->entry_point_address_query (&entry_point))
     return false;
 
   return get_frame_func (this_frame) == entry_point;
index dcbae679d07e88329c53646ad9043bbc2aa15d47..51636ff5403115f84e4809228947e00f54180ab4 100644 (file)
@@ -1279,7 +1279,7 @@ call_function_by_hand_dummy (struct value *function,
        CORE_ADDR dummy_addr;
 
        real_pc = funaddr;
-       dummy_addr = entry_point_address (current_program_space);
+       dummy_addr = current_program_space->entry_point_address ();
 
        /* A call dummy always consists of just a single breakpoint, so
           its address is the same as the address of the dummy.
index 14c07371f15eb5cc50932577be916c249a806455..4f5258e971d74f42bd9afa0c5ca437cbb76834bc 100644 (file)
@@ -284,34 +284,6 @@ objfile::objfile (gdb_bfd_ref_ptr bfd_, program_space *pspace,
   set_objfile_per_bfd (this);
 }
 
-/* See objfiles.h.  */
-
-int
-entry_point_address_query (program_space *pspace, CORE_ADDR *entry_p)
-{
-  objfile *objf = pspace->symfile_object_file;
-  if (objf == NULL || !objf->per_bfd->ei.entry_point_p)
-    return 0;
-
-  int idx = objf->per_bfd->ei.the_bfd_section_index;
-  *entry_p = objf->per_bfd->ei.entry_point + objf->section_offsets[idx];
-
-  return 1;
-}
-
-/* See objfiles.h.  */
-
-CORE_ADDR
-entry_point_address (program_space *pspace)
-{
-  CORE_ADDR retval;
-
-  if (!entry_point_address_query (pspace, &retval))
-    error (_("Entry point address is not known."));
-
-  return retval;
-}
-
 separate_debug_iterator &
 separate_debug_iterator::operator++ ()
 {
index 59ad70dfffa666207af7f79f1431a659a325b4f4..371fd22369332421fbb2a437f9d765f2dff66cd9 100644 (file)
@@ -904,16 +904,6 @@ obj_section::set_offset (CORE_ADDR offset)
 
 /* Declarations for functions defined in objfiles.c */
 
-/* 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);
-
-/* Get the entry point address in PSPACE.  Call error if it is not known.  */
-
-extern CORE_ADDR entry_point_address (program_space *pspace);
-
 extern void build_objfile_section_table (struct objfile *);
 
 extern void free_objfile_separate_debug (struct objfile *);
index f16c222ec808c8405df7392c861d0aed0ef0d1cf..bfd7ca5bcb94c83c0fb4b8598a5334e8ae0b1d8b 100644 (file)
@@ -285,6 +285,34 @@ program_space::empty ()
   return find_inferior_for_program_space (this) == nullptr;
 }
 
+/* See progspace.h.  */
+
+int
+program_space::entry_point_address_query (CORE_ADDR *entry_p) const
+{
+  objfile *objf = symfile_object_file;
+  if (objf == NULL || !objf->per_bfd->ei.entry_point_p)
+    return 0;
+
+  int idx = objf->per_bfd->ei.the_bfd_section_index;
+  *entry_p = objf->per_bfd->ei.entry_point + objf->section_offsets[idx];
+
+  return 1;
+}
+
+/* See progspace.h.  */
+
+CORE_ADDR
+program_space::entry_point_address () const
+{
+  CORE_ADDR retval;
+
+  if (!entry_point_address_query (&retval))
+    error (_("Entry point address is not known."));
+
+  return retval;
+}
+
 /* Prints the list of program spaces and their details on UIOUT.  If
    REQUESTED is not -1, it's the ID of the pspace that should be
    printed.  Otherwise, all spaces are printed.  */
index d013920b0f6fc7f4f54698dcadcf411de4a0cae7..68d5ad35413a3f6a4758430930c7aa77c5d5d8ec 100644 (file)
@@ -332,6 +332,14 @@ struct program_space
     return m_target_sections;
   }
 
+  /* If there is a valid and known entry point in this program space,
+     fill *ENTRY_P with it and return non-zero.  */
+  int entry_point_address_query (CORE_ADDR *entry_p) const;
+
+  /* Get the entry point address in this program space.  Call error if
+     it is not known.  */
+  CORE_ADDR entry_point_address () const;
+
   /* Unique ID number.  */
   int num = 0;
 
index 5cf853c4115cb496d4b89b08216fe729d54e0665..4460362a57fa6c05c8dd246342747b61a3d9ddff 100644 (file)
@@ -697,7 +697,7 @@ enable_break (void)
       return 0;
     }
 
-  if (!entry_point_address_query (current_program_space, &entry_point))
+  if (!current_program_space->entry_point_address_query (&entry_point))
     {
       solib_debug_printf ("Symbol file has no entry point.");
       return 0;