]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove 'num' field from 'struct address_space'
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Wed, 25 Feb 2026 09:35:47 +0000 (10:35 +0100)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Wed, 25 Feb 2026 09:35:47 +0000 (10:35 +0100)
The getter method `num ()` in `struct address_space` is never used.
Remove it.  This leads to two more simplifications: (1) the
address_space constructor can be defaulted in the header, (2)
`highest_address_space_num` global counter is no longer needed and can
be removed.

Tested by re-building.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/progspace.c
gdb/progspace.h

index 7fcb2c3d5c9f1ee57c9c3d11cd3fc7767446cb38..cf12939328a1d3e20e8183e77d997947d7d321e4 100644 (file)
@@ -36,18 +36,6 @@ std::vector<struct program_space *> program_spaces;
 /* Pointer to the current program space.  */
 struct program_space *current_program_space;
 
-/* The last address space number assigned.  */
-static int highest_address_space_num;
-
-\f
-
-/* Create a new address space object, and add it to the list.  */
-
-address_space::address_space ()
-  : m_num (++highest_address_space_num)
-{
-}
-
 /* Maybe create a new address space object, and add it to the list, or
    return a pointer to an existing address space, in case inferiors
    share an address space on this target system.  */
@@ -67,16 +55,6 @@ maybe_new_address_space ()
   return new_address_space ();
 }
 
-/* Start counting over from scratch.  */
-
-static void
-init_address_spaces (void)
-{
-  highest_address_space_num = 0;
-}
-
-\f
-
 /* Remove a program space from the program spaces list.  */
 
 static void
@@ -484,8 +462,6 @@ update_address_spaces (void)
   int shared_aspace
     = gdbarch_has_shared_address_space (current_inferior ()->arch ());
 
-  init_address_spaces ();
-
   if (shared_aspace)
     {
       address_space_ref_ptr aspace = new_address_space ();
index 04cf9680a8a4ef5264b42b5e78a15815db762219..36469eeebb40499b5275e047e29cbe717142b6f7 100644 (file)
@@ -48,20 +48,11 @@ struct solib;
 struct address_space : public refcounted_object
 {
   /* Create a new address space object, and add it to the list.  */
-  address_space ();
+  address_space () = default;
   DISABLE_COPY_AND_ASSIGN (address_space);
 
-  /* Returns the integer address space id of this address space.  */
-  int num () const
-  {
-    return m_num;
-  }
-
   /* Per aspace data-pointers required by other GDB modules.  */
   registry<address_space> registry_fields;
-
-private:
-  int m_num;
 };
 
 using address_space_ref_ptr