diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-02-19 16:04:52 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-02-19 16:04:53 -0500 |
commit | 298e9637305ee85f630638ba723494fb208eabad (patch) | |
tree | bab777ff33efad69fe544a1b389dcfc614cae496 | |
parent | 084104828cba3e80b19a4bad9538d32991312d7a (diff) | |
download | gdb-298e9637305ee85f630638ba723494fb208eabad.zip gdb-298e9637305ee85f630638ba723494fb208eabad.tar.gz gdb-298e9637305ee85f630638ba723494fb208eabad.tar.bz2 |
gdb: dwarf2/read.c: remove unused objfile parameters/variables
This is a simple cleanup. These functions used to use the objfile's
obstack for allocation in the hash tables, but they don't anymore.
Remove the unnecessary objfile parameters, which in turn allows removing
some local variables.
gdb/ChangeLog:
* dwarf2/read.c (allocate_signatured_type_table,
allocate_dwo_unit_table, allocate_type_unit_groups_table,
allocate_dwo_file_hash_table, allocate_dwp_loaded_cutus_table):
Remove objfile parameter, update all callers.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 53 |
2 files changed, 26 insertions, 34 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6d30272..b4a586c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2020-02-19 Simon Marchi <simon.marchi@efficios.com> + + * dwarf2/read.c (allocate_signatured_type_table, + allocate_dwo_unit_table, allocate_type_unit_groups_table, + allocate_dwo_file_hash_table, allocate_dwp_loaded_cutus_table): + Remove objfile parameter, update all callers. + 2020-02-19 Doug Evans <dje@google.com> PR rust/25535 diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index ee220ab..4d767a5 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1650,9 +1650,9 @@ struct file_and_directory static file_and_directory find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu); -static htab_up allocate_signatured_type_table (struct objfile *objfile); +static htab_up allocate_signatured_type_table (); -static htab_up allocate_dwo_unit_table (struct objfile *objfile); +static htab_up allocate_dwo_unit_table (); static struct dwo_unit *lookup_dwo_unit_in_dwp (struct dwarf2_per_objfile *dwarf2_per_objfile, @@ -2499,7 +2499,7 @@ create_signatured_type_table_from_index gdb_assert (dwarf2_per_objfile->all_type_units.empty ()); dwarf2_per_objfile->all_type_units.reserve (elements / 3); - htab_up sig_types_hash = allocate_signatured_type_table (objfile); + htab_up sig_types_hash = allocate_signatured_type_table (); for (offset_type i = 0; i < elements; i += 3) { @@ -2555,7 +2555,7 @@ create_signatured_type_table_from_debug_names gdb_assert (dwarf2_per_objfile->all_type_units.empty ()); dwarf2_per_objfile->all_type_units.reserve (map.tu_count); - htab_up sig_types_hash = allocate_signatured_type_table (objfile); + htab_up sig_types_hash = allocate_signatured_type_table (); for (uint32_t i = 0; i < map.tu_count; ++i) { @@ -5973,7 +5973,7 @@ eq_signatured_type (const void *item_lhs, const void *item_rhs) /* Allocate a hash table for signatured types. */ static htab_up -allocate_signatured_type_table (struct objfile *objfile) +allocate_signatured_type_table () { return htab_up (htab_create_alloc (41, hash_signatured_type, @@ -6068,9 +6068,9 @@ create_debug_type_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile, if (types_htab == NULL) { if (dwo_file) - types_htab = allocate_dwo_unit_table (objfile); + types_htab = allocate_dwo_unit_table (); else - types_htab = allocate_signatured_type_table (objfile); + types_htab = allocate_signatured_type_table (); } if (dwo_file) @@ -6281,7 +6281,6 @@ lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig) { struct dwarf2_per_objfile *dwarf2_per_objfile = cu->per_cu->dwarf2_per_objfile; - struct objfile *objfile = dwarf2_per_objfile->objfile; struct dwo_file *dwo_file; struct dwo_unit find_dwo_entry, *dwo_entry; struct signatured_type find_sig_entry, *sig_entry; @@ -6292,10 +6291,7 @@ lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig) /* If TU skeletons have been removed then we may not have read in any TUs yet. */ if (dwarf2_per_objfile->signatured_types == NULL) - { - dwarf2_per_objfile->signatured_types - = allocate_signatured_type_table (objfile); - } + dwarf2_per_objfile->signatured_types = allocate_signatured_type_table (); /* We only ever need to read in one copy of a signatured type. Use the global signatured_types array to do our own comdat-folding @@ -6352,7 +6348,6 @@ lookup_dwp_signatured_type (struct dwarf2_cu *cu, ULONGEST sig) { struct dwarf2_per_objfile *dwarf2_per_objfile = cu->per_cu->dwarf2_per_objfile; - struct objfile *objfile = dwarf2_per_objfile->objfile; struct dwp_file *dwp_file = get_dwp_file (dwarf2_per_objfile); struct dwo_unit *dwo_entry; struct signatured_type find_sig_entry, *sig_entry; @@ -6364,10 +6359,7 @@ lookup_dwp_signatured_type (struct dwarf2_cu *cu, ULONGEST sig) /* If TU skeletons have been removed then we may not have read in any TUs yet. */ if (dwarf2_per_objfile->signatured_types == NULL) - { - dwarf2_per_objfile->signatured_types - = allocate_signatured_type_table (objfile); - } + dwarf2_per_objfile->signatured_types = allocate_signatured_type_table (); find_sig_entry.signature = sig; slot = htab_find_slot (dwarf2_per_objfile->signatured_types.get (), @@ -7087,7 +7079,7 @@ eq_type_unit_group (const void *item_lhs, const void *item_rhs) /* Allocate a hash table for type unit groups. */ static htab_up -allocate_type_unit_groups_table (struct objfile *objfile) +allocate_type_unit_groups_table () { return htab_up (htab_create_alloc (3, hash_type_unit_group, @@ -7161,10 +7153,7 @@ get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list) struct type_unit_group type_unit_group_for_lookup; if (dwarf2_per_objfile->type_unit_groups == NULL) - { - dwarf2_per_objfile->type_unit_groups = - allocate_type_unit_groups_table (dwarf2_per_objfile->objfile); - } + dwarf2_per_objfile->type_unit_groups = allocate_type_unit_groups_table (); /* Do we need to create a new group, or can we use an existing one? */ @@ -7638,10 +7627,7 @@ process_skeletonless_type_unit (void **slot, void *info) /* If this TU doesn't exist in the global table, add it and read it in. */ if (dwarf2_per_objfile->signatured_types == NULL) - { - dwarf2_per_objfile->signatured_types - = allocate_signatured_type_table (dwarf2_per_objfile->objfile); - } + dwarf2_per_objfile->signatured_types = allocate_signatured_type_table (); find_entry.signature = dwo_unit->signature; slot = htab_find_slot (dwarf2_per_objfile->signatured_types.get (), @@ -10986,7 +10972,7 @@ eq_dwo_file (const void *item_lhs, const void *item_rhs) /* Allocate a hash table for DWO files. */ static htab_up -allocate_dwo_file_hash_table (struct objfile *objfile) +allocate_dwo_file_hash_table () { auto delete_dwo_file = [] (void *item) { @@ -11013,8 +10999,7 @@ lookup_dwo_file_slot (struct dwarf2_per_objfile *dwarf2_per_objfile, void **slot; if (dwarf2_per_objfile->dwo_files == NULL) - dwarf2_per_objfile->dwo_files - = allocate_dwo_file_hash_table (dwarf2_per_objfile->objfile); + dwarf2_per_objfile->dwo_files = allocate_dwo_file_hash_table (); find_entry.dwo_name = dwo_name; find_entry.comp_dir = comp_dir; @@ -11050,7 +11035,7 @@ eq_dwo_unit (const void *item_lhs, const void *item_rhs) There is one of these tables for each of CUs,TUs for each DWO file. */ static htab_up -allocate_dwo_unit_table (struct objfile *objfile) +allocate_dwo_unit_table () { /* Start out with a pretty small number. Generally DWO files contain only one CU and maybe some TUs. */ @@ -11144,7 +11129,7 @@ create_cus_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile, continue; if (cus_htab == NULL) - cus_htab = allocate_dwo_unit_table (objfile); + cus_htab = allocate_dwo_unit_table (); dwo_unit = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct dwo_unit); *dwo_unit = read_unit; @@ -12301,7 +12286,7 @@ eq_dwp_loaded_cutus (const void *a, const void *b) /* Allocate a hash table for dwp_file loaded CUs/TUs. */ static htab_up -allocate_dwp_loaded_cutus_table (struct objfile *objfile) +allocate_dwp_loaded_cutus_table () { return htab_up (htab_create_alloc (3, hash_dwp_loaded_cutus, @@ -12434,8 +12419,8 @@ open_and_init_dwp_file (struct dwarf2_per_objfile *dwarf2_per_objfile) dwarf2_locate_v2_dwp_sections, dwp_file.get ()); - dwp_file->loaded_cus = allocate_dwp_loaded_cutus_table (objfile); - dwp_file->loaded_tus = allocate_dwp_loaded_cutus_table (objfile); + dwp_file->loaded_cus = allocate_dwp_loaded_cutus_table (); + dwp_file->loaded_tus = allocate_dwp_loaded_cutus_table (); if (dwarf_read_debug) { |