Allocate the address map on the psymtab obstack
authorTom Tromey <tom@tromey.com>
Thu, 10 May 2018 22:23:53 +0000 (16:23 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 10 Jan 2019 14:08:13 +0000 (07:08 -0700)
After this patch, the psymtab address map will now be allocated on the
psymtab obstack rather than the objfile obstack.  This also changes
the psymtab storage object to make the obstack private; this will be
used later.

gdb/ChangeLog
2019-01-10  Tom Tromey  <tom@tromey.com>

* psymtab.h (psymtab_storage::obstack): New method.
<m_obstack>: Rename from obstack; now private.
* psymtab.c (psymtab_storage): Update.
* dwarf2read.c (create_addrmap_from_index)
(create_addrmap_from_aranges, dwarf2_build_psymtabs_hard):
Update.

gdb/ChangeLog
gdb/dwarf2read.c
gdb/psymtab.c
gdb/psymtab.h

index 211867de1757d7fbfc9cbcca0d98e8d870916570..81f07f774d96acea8af2499e50c0f0c022756213 100644 (file)
@@ -1,3 +1,12 @@
+2019-01-10  Tom Tromey  <tom@tromey.com>
+
+       * psymtab.h (psymtab_storage::obstack): New method.
+       <m_obstack>: Rename from obstack; now private.
+       * psymtab.c (psymtab_storage): Update.
+       * dwarf2read.c (create_addrmap_from_index)
+       (create_addrmap_from_aranges, dwarf2_build_psymtabs_hard):
+       Update.
+
 2019-01-10  Tom Tromey  <tom@tromey.com>
 
        * symfile.c (reread_symbols): Call objfile->reset_psymtabs.
index a0365f56b86b9c94814c6e036dea01a716b73779..97ca3414b02aeaf5a1034a3b09484229d75ccc97 100644 (file)
@@ -3191,7 +3191,7 @@ create_addrmap_from_index (struct dwarf2_per_objfile *dwarf2_per_objfile,
     }
 
   objfile->partial_symtabs->psymtabs_addrmap
-    = addrmap_create_fixed (mutable_map, &objfile->objfile_obstack);
+    = addrmap_create_fixed (mutable_map, objfile->partial_symtabs->obstack ());
 }
 
 /* Read the address map data from DWARF-5 .debug_aranges, and use it to
@@ -3352,7 +3352,7 @@ create_addrmap_from_aranges (struct dwarf2_per_objfile *dwarf2_per_objfile,
     }
 
   objfile->partial_symtabs->psymtabs_addrmap
-    = addrmap_create_fixed (mutable_map, &objfile->objfile_obstack);
+    = addrmap_create_fixed (mutable_map, objfile->partial_symtabs->obstack ());
 }
 
 /* Find a slot in the mapped index INDEX for the object named NAME.
@@ -8491,7 +8491,7 @@ dwarf2_build_psymtabs_hard (struct dwarf2_per_objfile *dwarf2_per_objfile)
 
   objfile->partial_symtabs->psymtabs_addrmap
     = addrmap_create_fixed (objfile->partial_symtabs->psymtabs_addrmap,
-                           &objfile->objfile_obstack);
+                           objfile->partial_symtabs->obstack ());
   /* At this point we want to keep the address map.  */
   save_psymtabs_addrmap.release ();
 
index 7af82d6327cf507d8d7fed5d7bd71220a91b59d6..e18544126777dee31802578573649f69ddcd946e 100644 (file)
@@ -68,8 +68,8 @@ static struct compunit_symtab *psymtab_to_symtab (struct objfile *objfile,
 \f
 
 psymtab_storage::psymtab_storage (struct objfile *objfile)
-  : obstack (&objfile->objfile_obstack),
-    psymbol_cache (psymbol_bcache_init ())
+  : psymbol_cache (psymbol_bcache_init ()),
+    m_obstack (&objfile->objfile_obstack)
 {
 }
 
index 895f950a4665e7afa482b7258da1925765d661d7..d0e596980d12d12548f9c755175c973199705c1e 100644 (file)
@@ -55,6 +55,13 @@ public:
 
   void discard_psymtab (struct partial_symtab *pst);
 
+  /* Return the obstack that is used for storage by this object.  */
+
+  struct obstack *obstack ()
+  {
+    return m_obstack;
+  }
+
 
   /* Each objfile points to a linked list of partial symtabs derived from
      this file, one partial symtab structure for each compilation unit
@@ -73,10 +80,6 @@ public:
 
   struct partial_symtab *free_psymtabs = nullptr;
 
-  /* The obstack where allocations are made.  */
-
-  struct obstack *obstack;
-
   /* A byte cache where we can stash arbitrary "chunks" of bytes that
      will not change.  */
 
@@ -87,6 +90,12 @@ public:
 
   std::vector<partial_symbol *> global_psymbols;
   std::vector<partial_symbol *> static_psymbols;
+
+private:
+
+  /* The obstack where allocations are made.  */
+
+  struct obstack *m_obstack;
 };