aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2025-02-17 14:59:30 -0500
committerSimon Marchi <simon.marchi@efficios.com>2025-02-19 11:14:41 -0500
commit890d1d385f457829f90dbd963aaa29a212ce9e20 (patch)
tree7a8d39158d122ac66c0d6f2008414ad2259b2944
parentdf50675d4ef54858947c2069529eb8cd4401b813 (diff)
downloadbinutils-890d1d385f457829f90dbd963aaa29a212ce9e20.zip
binutils-890d1d385f457829f90dbd963aaa29a212ce9e20.tar.gz
binutils-890d1d385f457829f90dbd963aaa29a212ce9e20.tar.bz2
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>
-rw-r--r--gdb/dwarf2/aranges.c2
-rw-r--r--gdb/dwarf2/cooked-index.c5
-rw-r--r--gdb/dwarf2/frame.c3
-rw-r--r--gdb/dwarf2/index-write.c20
-rw-r--r--gdb/dwarf2/loc.c9
-rw-r--r--gdb/dwarf2/read-debug-names.c2
-rw-r--r--gdb/dwarf2/read.c8
-rw-r--r--gdb/dwarf2/read.h13
8 files changed, 27 insertions, 35 deletions
diff --git a/gdb/dwarf2/aranges.c b/gdb/dwarf2/aranges.c
index af14f82..b990308 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<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)
{
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index d7b5a68..6c6839c 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 <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));
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
index 03e973e..17f3932 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 <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). */
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index f36f388..334f9f8 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -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;
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index a01161e..585b5de 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -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. */
diff --git a/gdb/dwarf2/read-debug-names.c b/gdb/dwarf2/read-debug-names.c
index 5383cf2..924b570 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> 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
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 347d71d..b3f56c2 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -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
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 640a8e2..23cb506 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -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. */