public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Change dwarf2_per_objfile::die_type_hash to htab_up
@ 2020-02-08 20:56 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2020-02-08 20:56 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0335378b4cd2fc8246b2eb7cfe2b7e4cf757a377

commit 0335378b4cd2fc8246b2eb7cfe2b7e4cf757a377
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Feb 8 13:40:54 2020 -0700

    Change dwarf2_per_objfile::die_type_hash to htab_up
    
    This changes dwarf2_per_objfile::die_type_hash to be an htab_up,
    moving its contents off the objfile obstack.
    
    2020-02-08  Tom Tromey  <tom@tromey.com>
    
    	* dwarf2/read.c (set_die_type, get_die_type_at_offset): Update.
    	* dwarf2/read.h (struct dwarf2_per_objfile) <die_type_hash>: Now
    	htab_up.
    
    Change-Id: Ic651f99ebf71bf7ad2dc2880192adacf7b60964a

Diff:
---
 gdb/ChangeLog     |  6 ++++++
 gdb/dwarf2/read.c | 19 +++++++------------
 gdb/dwarf2/read.h |  2 +-
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 82e9931..014c858 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 2020-02-08  Tom Tromey  <tom@tromey.com>
 
+	* dwarf2/read.c (set_die_type, get_die_type_at_offset): Update.
+	* dwarf2/read.h (struct dwarf2_per_objfile) <die_type_hash>: Now
+	htab_up.
+
+2020-02-08  Tom Tromey  <tom@tromey.com>
+
 	* dwarf2/read.c (struct dwp_file) <loaded_cus, loaded_tus>: Now
 	htab_up.
 	(lookup_dwo_unit_in_dwp): Update.
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 4c445ea..e42f4f2 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -25184,22 +25184,17 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
     add_dyn_prop (DYN_PROP_DATA_LOCATION, prop, type);
 
   if (dwarf2_per_objfile->die_type_hash == NULL)
-    {
-      dwarf2_per_objfile->die_type_hash =
-	htab_create_alloc_ex (127,
-			      per_cu_offset_and_type_hash,
-			      per_cu_offset_and_type_eq,
-			      NULL,
-			      &objfile->objfile_obstack,
-			      hashtab_obstack_allocate,
-			      dummy_obstack_deallocate);
-    }
+    dwarf2_per_objfile->die_type_hash
+      = htab_up (htab_create_alloc (127,
+				    per_cu_offset_and_type_hash,
+				    per_cu_offset_and_type_eq,
+				    NULL, xcalloc, xfree));
 
   ofs.per_cu = cu->per_cu;
   ofs.sect_off = die->sect_off;
   ofs.type = type;
   slot = (struct dwarf2_per_cu_offset_and_type **)
-    htab_find_slot (dwarf2_per_objfile->die_type_hash, &ofs, INSERT);
+    htab_find_slot (dwarf2_per_objfile->die_type_hash.get (), &ofs, INSERT);
   if (*slot)
     complaint (_("A problem internal to GDB: DIE %s has type already set"),
 	       sect_offset_str (die->sect_off));
@@ -25225,7 +25220,7 @@ get_die_type_at_offset (sect_offset sect_off,
   ofs.per_cu = per_cu;
   ofs.sect_off = sect_off;
   slot = ((struct dwarf2_per_cu_offset_and_type *)
-	  htab_find (dwarf2_per_objfile->die_type_hash, &ofs));
+	  htab_find (dwarf2_per_objfile->die_type_hash.get (), &ofs));
   if (slot)
     return slot->type;
   else
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 0f30837..c177747 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -214,7 +214,7 @@ public:
   /* Table mapping type DIEs to their struct type *.
      This is NULL if not allocated yet.
      The mapping is done via (CU/TU + DIE offset) -> type.  */
-  htab_t die_type_hash {};
+  htab_up die_type_hash;
 
   /* The CUs we recently read.  */
   std::vector<dwarf2_per_cu_data *> just_read_cus;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-08 20:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-08 20:56 [binutils-gdb] Change dwarf2_per_objfile::die_type_hash to htab_up Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).