]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: move addrmap::relocate method to addrmap_fixed
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 31 Mar 2025 20:09:42 +0000 (16:09 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Tue, 1 Apr 2025 14:02:17 +0000 (10:02 -0400)
The relocate method of addrmap is unnecessarily virtual.  Only
addrmap_fixed provides a meaningful implementation.  Move the method to
addrmap_fixed only and make it non-virtual.

Change-Id: If61d5e70abc12c17d1e600adf0dd0707e77a6ba2
Approved-By: Tom Tromey <tom@tromey.com>
gdb/addrmap.c
gdb/addrmap.h

index e6799cc7b3d3661b9069ec42740efd1ec9f1fd90..1fc95f30161638d39f9efd8cd275b317737fd616 100644 (file)
@@ -317,16 +317,6 @@ addrmap_fixed::addrmap_fixed (struct obstack *obstack,
   gdb_assert (num_transitions == transition_count);
 }
 
-
-void
-addrmap_mutable::relocate (CORE_ADDR offset)
-{
-  /* Not needed yet.  */
-  internal_error (_("addrmap_relocate is not implemented yet "
-                   "for mutable addrmaps"));
-}
-
-
 /* This is a splay_tree_foreach_fn.  */
 
 static int
@@ -450,7 +440,7 @@ test_addrmap ()
   CHECK_ADDRMAP_FIND (map, array, 13, 19, nullptr);
 
   /* Create corresponding fixed addrmap.  */
-  struct addrmap *map2
+  addrmap_fixed *map2
     = new (&temp_obstack) addrmap_fixed (&temp_obstack, map.get ());
   SELF_CHECK (map2 != nullptr);
   CHECK_ADDRMAP_FIND (map2, array, 0, 9, nullptr);
index 06fc175c2018c56cc82feea5d15b5de7a1e8b169..a2feb688848583724060534686397d2630e1b8dc 100644 (file)
@@ -52,10 +52,6 @@ struct addrmap
   void *find (CORE_ADDR addr)
   { return this->do_find (addr); }
 
-  /* Relocate all the addresses in MAP by OFFSET.  (This can be applied
-     to either mutable or immutable maps.)  */
-  virtual void relocate (CORE_ADDR offset) = 0;
-
   /* Call FN for every address in MAP, following an in-order traversal.
      If FN ever returns a non-zero value, the iteration ceases
      immediately, and the value is returned.  Otherwise, this function
@@ -94,7 +90,8 @@ public:
   addrmap_fixed (addrmap_fixed &&other) = default;
   addrmap_fixed &operator= (addrmap_fixed &&) = default;
 
-  void relocate (CORE_ADDR offset) override;
+  /* Relocate all the addresses in this map by OFFSET.  */
+  void relocate (CORE_ADDR offset);
 
 private:
   void *do_find (CORE_ADDR addr) const override;
@@ -191,7 +188,6 @@ public:
      representation.  */
   void set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
                  void *obj);
-  void relocate (CORE_ADDR offset) override;
 
   /* Clear this addrmap.  */
   void clear ();