diff options
author | Tom Tromey <tom@tromey.com> | 2020-02-08 13:40:54 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-02-08 13:43:24 -0700 |
commit | 48b490f28a2152134a51215a06cb22c9b09a7a80 (patch) | |
tree | 9d8d12b2655654430db3c33e131d2fa06e27bb35 /gdb | |
parent | bc68fb1930b72d3772fadbe76d9006c799bb33e9 (diff) | |
download | gdb-48b490f28a2152134a51215a06cb22c9b09a7a80.zip gdb-48b490f28a2152134a51215a06cb22c9b09a7a80.tar.gz gdb-48b490f28a2152134a51215a06cb22c9b09a7a80.tar.bz2 |
Change dwp_file to use htab_up
This changes dwp_file to use htab_up for the loaded_cus and loaded_tus
members. This lets us avoid allocating the contents of these hash
tables on the objfile obstack.
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.
(allocate_dwp_loaded_cutus_table): Return htab_up. Don't allocate
on obstack.
Change-Id: Id61209bf5c6c6faa0c067195af31fbcf26813a3a
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 21 |
2 files changed, 17 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c3ec439..82e9931 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 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. + (allocate_dwp_loaded_cutus_table): Return htab_up. Don't allocate + on obstack. + +2020-02-08 Tom Tromey <tom@tromey.com> + * dwarf2/read.c (allocate_dwo_file_hash_table): Don't allocate on obstack. diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index a767e3b..4c445ea 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -868,8 +868,8 @@ struct dwp_file const struct dwp_hash_table *tus = nullptr; /* Tables of loaded CUs/TUs. Each entry is a struct dwo_unit *. */ - htab_t loaded_cus {}; - htab_t loaded_tus {}; + htab_up loaded_cus; + htab_up loaded_tus; /* Table to map ELF section numbers to their sections. This is only needed for the DWP V1 file format. */ @@ -12350,8 +12350,8 @@ lookup_dwo_unit_in_dwp (struct dwarf2_per_objfile *dwarf2_per_objfile, memset (&find_dwo_cu, 0, sizeof (find_dwo_cu)); find_dwo_cu.signature = signature; slot = htab_find_slot (is_debug_types - ? dwp_file->loaded_tus - : dwp_file->loaded_cus, + ? dwp_file->loaded_tus.get () + : dwp_file->loaded_cus.get (), &find_dwo_cu, INSERT); if (*slot != NULL) @@ -12722,16 +12722,13 @@ eq_dwp_loaded_cutus (const void *a, const void *b) /* Allocate a hash table for dwp_file loaded CUs/TUs. */ -static htab_t +static htab_up allocate_dwp_loaded_cutus_table (struct objfile *objfile) { - return htab_create_alloc_ex (3, - hash_dwp_loaded_cutus, - eq_dwp_loaded_cutus, - NULL, - &objfile->objfile_obstack, - hashtab_obstack_allocate, - dummy_obstack_deallocate); + return htab_up (htab_create_alloc (3, + hash_dwp_loaded_cutus, + eq_dwp_loaded_cutus, + NULL, xcalloc, xfree)); } /* Try to open DWP file FILE_NAME. |