Change breakpoint_re_set_default to a method
[binutils-gdb.git] / gdb / addrmap.h
index 8794f1fefbf1675dab8501f8ce93a50d0d1e528a..bdf1199481f992b7da672e1741544c80ddbeab32 100644 (file)
@@ -32,7 +32,7 @@
    Address maps come in two flavors: fixed, and mutable.  Mutable
    address maps consume more memory, but can be changed and extended.
    A fixed address map, once constructed (from a mutable address map),
-   can't be edited.  Both kinds of map are allocated in obstacks.  */
+   can't be edited.  */
 
 /* The type of a function used to iterate over the map.
    OBJ is NULL for unmapped regions.  */
@@ -40,7 +40,7 @@ typedef gdb::function_view<int (CORE_ADDR start_addr, void *obj)>
      addrmap_foreach_fn;
 
 /* The base class for addrmaps.  */
-struct addrmap : public allocate_on_obstack
+struct addrmap
 {
   virtual ~addrmap () = default;
 
@@ -87,10 +87,6 @@ struct addrmap : public allocate_on_obstack
   /* Return the object associated with ADDR in MAP.  */
   virtual void *find (CORE_ADDR addr) const = 0;
 
-  /* Create a fixed address map which is a copy of this mutable
-     address map.  Allocate entries in OBSTACK.  */
-  virtual struct addrmap *create_fixed (struct obstack *obstack) = 0;
-
   /* 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;
@@ -105,7 +101,8 @@ struct addrmap : public allocate_on_obstack
 struct addrmap_mutable;
 
 /* Fixed address maps.  */
-struct addrmap_fixed : public addrmap
+struct addrmap_fixed : public addrmap,
+                      public allocate_on_obstack
 {
 public:
 
@@ -115,7 +112,6 @@ public:
   void set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
                  void *obj) override;
   void *find (CORE_ADDR addr) const override;
-  struct addrmap *create_fixed (struct obstack *obstack) override;
   void relocate (CORE_ADDR offset) override;
   int foreach (addrmap_foreach_fn fn) override;
 
@@ -147,28 +143,18 @@ struct addrmap_mutable : public addrmap
 {
 public:
 
-  explicit addrmap_mutable (struct obstack *obs);
+  addrmap_mutable ();
+  ~addrmap_mutable ();
   DISABLE_COPY_AND_ASSIGN (addrmap_mutable);
 
   void set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
                  void *obj) override;
   void *find (CORE_ADDR addr) const override;
-  struct addrmap *create_fixed (struct obstack *obstack) override;
   void relocate (CORE_ADDR offset) override;
   int foreach (addrmap_foreach_fn fn) override;
 
 private:
 
-  /* The obstack to use for allocations for this map.  */
-  struct obstack *obstack;
-
-  /* A freelist for splay tree nodes, allocated on obstack, and
-     chained together by their 'right' pointers.  */
-  /* splay_tree_new_with_allocator uses the provided allocation
-     function to allocate the main splay_tree structure itself, so our
-     free list has to be initialized before we create the tree.  */
-  splay_tree_node free_nodes = nullptr;
-
   /* A splay tree, with a node for each transition; there is a
      transition at address T if T-1 and T map to different objects.
 
@@ -196,9 +182,6 @@ private:
   splay_tree_node splay_tree_successor (CORE_ADDR addr);
   void splay_tree_remove (CORE_ADDR addr);
   void splay_tree_insert (CORE_ADDR key, void *value);
-
-  static void *splay_obstack_alloc (int size, void *closure);
-  static void splay_obstack_free (void *obj, void *closure);
 };