From: Simon Marchi Date: Mon, 17 Feb 2025 19:59:30 +0000 (-0500) Subject: gdb/dwarf: std::unordered_{set,map} -> gdb::unordered_{set,map} throughout X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=890d1d385f457829f90dbd963aaa29a212ce9e20;p=thirdparty%2Fbinutils-gdb.git gdb/dwarf: std::unordered_{set,map} -> gdb::unordered_{set,map} throughout No behavior changes expected. Change-Id: I16ff6c67058362c65cc8edb05d1948e48be6b2e1 Approved-By: Tom Tromey --- diff --git a/gdb/dwarf2/aranges.c b/gdb/dwarf2/aranges.c index af14f82126b..b9903084416 100644 --- a/gdb/dwarf2/aranges.c +++ b/gdb/dwarf2/aranges.c @@ -39,7 +39,7 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, struct gdbarch *gdbarch = objfile->arch (); dwarf2_per_bfd *per_bfd = per_objfile->per_bfd; - std::unordered_map + gdb::unordered_map debug_info_offset_to_per_cu; for (const auto &per_cu : per_bfd->all_units) { diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index d7b5a6837ad..6c6839cde9b 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -37,13 +37,12 @@ #include "gdbsupport/task-group.h" #include "gdbsupport/thread-pool.h" #include -#include #include "cli/cli-cmds.h" /* We don't want gdb to exit while it is in the process of writing to the index cache. So, all live cooked index vectors are stored here, and then these are all waited for before exit proceeds. */ -static std::unordered_set active_vectors; +static gdb::unordered_set active_vectors; /* See cooked-index.h. */ @@ -547,7 +546,7 @@ cooked_index_worker::wait (cooked_state desired_state, bool allow_quit) } /* Only show a given exception a single time. */ - std::unordered_set seen_exceptions; + gdb::unordered_set seen_exceptions; for (auto &one_result : m_results) { re_emit_complaints (std::get<1> (one_result)); diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c index 03e973eb902..17f3932a990 100644 --- a/gdb/dwarf2/frame.c +++ b/gdb/dwarf2/frame.c @@ -44,7 +44,6 @@ #include "gdbsupport/selftest.h" #include "selftest-arch.h" #endif -#include #include @@ -104,7 +103,7 @@ struct dwarf2_cie /* The CIE table is used to find CIEs during parsing, but then discarded. It maps from the CIE's offset to the CIE. */ -typedef std::unordered_map dwarf2_cie_table; +using dwarf2_cie_table = gdb::unordered_map; /* Frame Description Entry (FDE). */ diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c index f36f388cfa4..334f9f8efeb 100644 --- a/gdb/dwarf2/index-write.c +++ b/gdb/dwarf2/index-write.c @@ -43,8 +43,6 @@ #include #include -#include -#include /* Ensure only legit values are used. */ #define DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE(cu_index, value) \ @@ -432,7 +430,7 @@ symtab_index_entry::minimize () this, we want to keep the entry from the first CU -- but this is implicit due to the sort. This choice is done because it's similar to what gdb historically did for partial symbols. */ - std::unordered_set seen; + gdb::unordered_set seen; from = std::remove_if (cu_indices.begin (), cu_indices.end (), [&] (offset_type val) { @@ -478,7 +476,7 @@ private: const char *const m_cstr; }; -/* A std::unordered_map::hasher for c_str_view that uses the right +/* A gdb::unordered_map::hasher for c_str_view that uses the right hash function for strings in a mapped index. */ class c_str_view_hasher { @@ -489,7 +487,7 @@ public: } }; -/* A std::unordered_map::hasher for std::vector<>. */ +/* A gdb::unordered_map::hasher for std::vector<>. */ template class vector_hasher { @@ -510,7 +508,7 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool) { /* Elements are sorted vectors of the indices of all the CUs that hold an object of this name. */ - std::unordered_map, offset_type, + gdb::unordered_map, offset_type, vector_hasher> symbol_hash_table; @@ -537,7 +535,7 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool) } /* Now write out the hash table. */ - std::unordered_map str_table; + gdb::unordered_map str_table; for (const auto &entry : *symtab) { offset_type str_off, vec_off; @@ -564,7 +562,7 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool) } using cu_index_map - = std::unordered_map; + = gdb::unordered_map; /* Helper struct for building the address table. */ struct addrmap_index_data @@ -924,7 +922,7 @@ private: } private: - std::unordered_map m_str_table; + gdb::unordered_map m_str_table; bfd *const m_abfd; dwarf2_per_bfd *m_per_bfd; @@ -963,7 +961,7 @@ private: const bool has_parent; }; - /* Provide std::unordered_map::hasher for index_key. */ + /* Provide gdb::unordered_map::hasher for index_key. */ class index_key_hasher { public: @@ -1103,7 +1101,7 @@ private: /* Map each used .debug_names abbreviation tag parameter to its index value. */ - std::unordered_map m_indexkey_to_idx; + gdb::unordered_map m_indexkey_to_idx; /* .debug_names abbreviation table. */ data_buf m_abbrev_table; diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index a01161e83f7..585b5de8c9d 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -43,7 +43,6 @@ #include "compile/compile.h" #include #include -#include #include "gdbsupport/underlying.h" #include "gdbsupport/byte-vector.h" #include "extract-store-integer.h" @@ -795,7 +794,7 @@ func_verify_no_selftailcall (struct gdbarch *gdbarch, CORE_ADDR verify_addr) std::vector todo; /* Track here CORE_ADDRs which were already visited. */ - std::unordered_set addr_hash; + gdb::unordered_set addr_hash; todo.push_back (verify_addr); while (!todo.empty ()) @@ -964,7 +963,7 @@ call_site_find_chain_2 (struct gdbarch *gdbarch, gdb::unique_xmalloc_ptr *resultp, std::vector &chain, - std::unordered_set &addr_hash, + gdb::unordered_set &addr_hash, struct call_site *call_site, CORE_ADDR callee_pc) { @@ -1047,7 +1046,7 @@ call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc, paddress (gdbarch, save_callee_pc)); /* Mark CALL_SITEs so we do not visit the same ones twice. */ - std::unordered_set addr_hash; + gdb::unordered_set addr_hash; /* Do not push CALL_SITE to CHAIN. Push there only the first tail call site at the target's function. All the possible tail call sites in the @@ -1841,7 +1840,7 @@ dwarf2_get_symbol_read_needs (gdb::array_view expr, std::vector ops_to_visit; /* Operations already visited. */ - std::unordered_set visited_ops; + gdb::unordered_set visited_ops; /* Insert OP in OPS_TO_VISIT if it is within the expression's range and hasn't been visited yet. */ diff --git a/gdb/dwarf2/read-debug-names.c b/gdb/dwarf2/read-debug-names.c index 5383cf2feee..924b570a5f4 100644 --- a/gdb/dwarf2/read-debug-names.c +++ b/gdb/dwarf2/read-debug-names.c @@ -112,7 +112,7 @@ struct mapped_debug_names_reader std::vector attr_vec; }; - std::unordered_map abbrev_map; + gdb::unordered_map abbrev_map; /* Even though the scanning of .debug_names and creation of the cooked index entries is done serially, we create multiple shards so that the diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 347d71ddf26..b3f56c22782 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -82,12 +82,10 @@ #include "producer.h" #include #include -#include #include "gdbsupport/selftest.h" #include "rust-lang.h" #include "gdbsupport/pathstuff.h" #include "count-one-bits.h" -#include #include "dwarf2/abbrev-table-cache.h" #include "cooked-index.h" #include "gdbsupport/thread-pool.h" @@ -2289,7 +2287,7 @@ dwarf2_base_index_functions::map_symbol_filenames /* Use caches to ensure we only call FUN once for each filename. */ filename_seen_cache filenames_cache; - std::unordered_set qfn_cache; + gdb::unordered_set qfn_cache; /* The rule is CUs specify all the files, including those used by any TU, so there's no need to scan TUs here. We can ignore file names coming @@ -5251,7 +5249,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) /* We need a way to find the correct discriminant given a variant name. For convenience we build a map here. */ struct type *enum_type = disr_field->type (); - std::unordered_map discriminant_map; + gdb::unordered_map discriminant_map; for (int i = 0; i < enum_type->num_fields (); ++i) { if (enum_type->field (i).loc_kind () == FIELD_LOC_KIND_ENUMVAL) @@ -11270,7 +11268,7 @@ dwarf2_add_type_defn (struct field_info *fip, struct die_info *die, /* A convenience typedef that's used when finding the discriminant field for a variant part. */ -typedef std::unordered_map offset_map_type; +using offset_map_type = gdb::unordered_map; /* Compute the discriminant range for a given variant. OBSTACK is where the results will be stored. VARIANT is the variant to diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 640a8e2e391..23cb506d54d 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -21,7 +21,6 @@ #define GDB_DWARF2_READ_H #include -#include #include "dwarf2/comp-unit-head.h" #include "dwarf2/file-and-dir.h" #include "dwarf2/index-cache.h" @@ -563,7 +562,7 @@ public: /* Mapping from abstract origin DIE to concrete DIEs that reference it as DW_AT_abstract_origin. */ - std::unordered_map> + gdb::unordered_map> abstract_to_concrete; /* Current directory, captured at the moment that object this was @@ -793,17 +792,17 @@ private: that the CU/TU has not been expanded yet. */ std::vector m_symtabs; - /* Map from a type unit group to the corresponding unshared - structure. */ - std::unordered_map + /* Map from a type unit group to the corresponding unshared + structure. */ + gdb::unordered_map m_type_units; /* Map from signatured types to the corresponding struct type. */ - std::unordered_map m_type_map; + gdb::unordered_map m_type_map; /* Map from the objfile-independent dwarf2_per_cu_data instances to the corresponding objfile-dependent dwarf2_cu instances. */ - std::unordered_map m_dwarf2_cus; + gdb::unordered_map m_dwarf2_cus; }; /* Converts DWARF language names to GDB language names. */