From: Simon Marchi Date: Tue, 26 Nov 2024 05:32:21 +0000 (-0500) Subject: gdbserver: use `gdb::unordered_map` X-Git-Tag: binutils-2_45~1584 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=75b2ed218361747e6e729c3c051ee895c14f7ee2;p=thirdparty%2Fbinutils-gdb.git gdbserver: use `gdb::unordered_map` Replace the few uses of `std::unordered_map` in gdbserver with `gdb::unordered_map`. The only one of these that is likely to ever see a lot of elements is probably `process_info::m_ptid_thread_map`. It was added precisely to improve performance when there are a lot of threads, so I guess using `gdb::unordered_map` here won't hurt. I changed the others too, since it's easy. Change-Id: Ibc4ede5245551fdd7717cb349a012d05726f4363 Reviewed-By: Stephan Rohr --- diff --git a/gdbserver/inferiors.h b/gdbserver/inferiors.h index c3fea8d8974..3f7d80fceb1 100644 --- a/gdbserver/inferiors.h +++ b/gdbserver/inferiors.h @@ -20,11 +20,10 @@ #define GDBSERVER_INFERIORS_H #include "gdbsupport/owning_intrusive_list.h" +#include "gdbsupport/unordered_map.h" #include "dll.h" -#include - struct thread_info; struct regcache; struct target_desc; @@ -121,7 +120,7 @@ private: /* A map of ptid_t to thread_info*, for average O(1) ptid_t lookup. Exited threads do not appear in the map. */ - std::unordered_map m_ptid_thread_map; + gdb::unordered_map m_ptid_thread_map; }; /* Return a pointer to the current process. Note that the current diff --git a/gdbserver/linux-aarch64-tdesc.cc b/gdbserver/linux-aarch64-tdesc.cc index 39d5bccdce1..52642d52be2 100644 --- a/gdbserver/linux-aarch64-tdesc.cc +++ b/gdbserver/linux-aarch64-tdesc.cc @@ -24,7 +24,7 @@ #include "arch/aarch64.h" #include "linux-aarch32-low.h" #include -#include +#include "gdbsupport/unordered_map.h" /* Create the aarch64 target description. */ @@ -35,7 +35,7 @@ aarch64_linux_read_description (const aarch64_features &features) this function as the in-process-agent calls this function from a constructor function, when globals might not yet have been initialised. */ - static std::unordered_map tdesc_aarch64_map; + static gdb::unordered_map tdesc_aarch64_map; if (features.vq > AARCH64_MAX_SVE_VQ) error (_("VQ is %" PRIu64 ", maximum supported value is %d"), features.vq, diff --git a/gdbserver/server.cc b/gdbserver/server.cc index fb1a3f8b415..8623d94b45d 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -35,7 +35,7 @@ #include "dll.h" #include "hostio.h" #include -#include +#include "gdbsupport/unordered_map.h" #include "gdbsupport/common-inferior.h" #include "gdbsupport/job-control.h" #include "gdbsupport/environ.h" @@ -952,7 +952,7 @@ handle_general_set (char *own_buf) It's nicer if we only print the final options for each TID, and if we only print about it if the options changed compared to the options that were previously set on the thread. */ - std::unordered_map set_options; + gdb::unordered_map set_options; while (*p != '\0') {