gdb/dwarf: std::unordered_{set,map} -> gdb::unordered_{set,map} throughout

No behavior changes expected.

Change-Id: I16ff6c67058362c65cc8edb05d1948e48be6b2e1
Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Simon Marchi
2025-02-17 14:59:30 -05:00
committed by Simon Marchi
parent df50675d4e
commit 890d1d385f
8 changed files with 27 additions and 35 deletions

View File

@@ -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<sect_offset, dwarf2_per_cu_data *>
gdb::unordered_map<sect_offset, dwarf2_per_cu_data *>
debug_info_offset_to_per_cu;
for (const auto &per_cu : per_bfd->all_units)
{

View File

@@ -37,13 +37,12 @@
#include "gdbsupport/task-group.h"
#include "gdbsupport/thread-pool.h"
#include <chrono>
#include <unordered_set>
#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<cooked_index *> active_vectors;
static gdb::unordered_set<cooked_index *> 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<gdb_exception> seen_exceptions;
gdb::unordered_set<gdb_exception> seen_exceptions;
for (auto &one_result : m_results)
{
re_emit_complaints (std::get<1> (one_result));

View File

@@ -44,7 +44,6 @@
#include "gdbsupport/selftest.h"
#include "selftest-arch.h"
#endif
#include <unordered_map>
#include <algorithm>
@@ -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<ULONGEST, dwarf2_cie *> dwarf2_cie_table;
using dwarf2_cie_table = gdb::unordered_map<ULONGEST, dwarf2_cie *>;
/* Frame Description Entry (FDE). */

View File

@@ -43,8 +43,6 @@
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
/* 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<offset_type> seen;
gdb::unordered_set<offset_type> 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<typename T>
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<std::vector<offset_type>, offset_type,
gdb::unordered_map<std::vector<offset_type>, offset_type,
vector_hasher<offset_type>>
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<c_str_view, offset_type, c_str_view_hasher> str_table;
gdb::unordered_map<c_str_view, offset_type, c_str_view_hasher> 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<const dwarf2_per_cu_data *, unsigned int>;
= gdb::unordered_map<const dwarf2_per_cu_data *, unsigned int>;
/* Helper struct for building the address table. */
struct addrmap_index_data
@@ -924,7 +922,7 @@ private:
}
private:
std::unordered_map<c_str_view, size_t, c_str_view_hasher> m_str_table;
gdb::unordered_map<c_str_view, size_t, c_str_view_hasher> 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<index_key, int, index_key_hasher> m_indexkey_to_idx;
gdb::unordered_map<index_key, int, index_key_hasher> m_indexkey_to_idx;
/* .debug_names abbreviation table. */
data_buf m_abbrev_table;

View File

@@ -43,7 +43,6 @@
#include "compile/compile.h"
#include <algorithm>
#include <vector>
#include <unordered_set>
#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<CORE_ADDR> todo;
/* Track here CORE_ADDRs which were already visited. */
std::unordered_set<CORE_ADDR> addr_hash;
gdb::unordered_set<CORE_ADDR> 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<struct call_site_chain> *resultp,
std::vector<struct call_site *> &chain,
std::unordered_set<CORE_ADDR> &addr_hash,
gdb::unordered_set<CORE_ADDR> &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<CORE_ADDR> addr_hash;
gdb::unordered_set<CORE_ADDR> 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<const gdb_byte> expr,
std::vector<const gdb_byte *> ops_to_visit;
/* Operations already visited. */
std::unordered_set<const gdb_byte *> visited_ops;
gdb::unordered_set<const gdb_byte *> visited_ops;
/* Insert OP in OPS_TO_VISIT if it is within the expression's range and
hasn't been visited yet. */

View File

@@ -112,7 +112,7 @@ struct mapped_debug_names_reader
std::vector<attr> attr_vec;
};
std::unordered_map<ULONGEST, index_val> abbrev_map;
gdb::unordered_map<ULONGEST, index_val> 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

View File

@@ -82,12 +82,10 @@
#include "producer.h"
#include <fcntl.h>
#include <algorithm>
#include <unordered_map>
#include "gdbsupport/selftest.h"
#include "rust-lang.h"
#include "gdbsupport/pathstuff.h"
#include "count-one-bits.h"
#include <unordered_set>
#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<quick_file_names *> qfn_cache;
gdb::unordered_set<quick_file_names *> 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<std::string_view, ULONGEST> discriminant_map;
gdb::unordered_map<std::string_view, ULONGEST> 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<sect_offset, int> offset_map_type;
using offset_map_type = gdb::unordered_map<sect_offset, int>;
/* Compute the discriminant range for a given variant. OBSTACK is
where the results will be stored. VARIANT is the variant to

View File

@@ -21,7 +21,6 @@
#define GDB_DWARF2_READ_H
#include <queue>
#include <unordered_map>
#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<sect_offset, std::vector<sect_offset>>
gdb::unordered_map<sect_offset, std::vector<sect_offset>>
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<compunit_symtab *> m_symtabs;
/* Map from a type unit group to the corresponding unshared
structure. */
std::unordered_map<type_unit_group *, type_unit_group_unshareable_up>
/* Map from a type unit group to the corresponding unshared
structure. */
gdb::unordered_map<type_unit_group *, type_unit_group_unshareable_up>
m_type_units;
/* Map from signatured types to the corresponding struct type. */
std::unordered_map<signatured_type *, struct type *> m_type_map;
gdb::unordered_map<signatured_type *, struct type *> m_type_map;
/* Map from the objfile-independent dwarf2_per_cu_data instances to the
corresponding objfile-dependent dwarf2_cu instances. */
std::unordered_map<dwarf2_per_cu_data *, dwarf2_cu_up> m_dwarf2_cus;
gdb::unordered_map<dwarf2_per_cu_data *, dwarf2_cu_up> m_dwarf2_cus;
};
/* Converts DWARF language names to GDB language names. */