]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdbserver: use `gdb::unordered_map` users/simark/try-gdbserver-unordered-map
authorSimon Marchi <simon.marchi@polymtl.ca>
Tue, 26 Nov 2024 03:16:48 +0000 (22:16 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Tue, 26 Nov 2024 03:20:39 +0000 (22:20 -0500)
Replace the few uses of `std::unordered_map` 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 using
`gdb::unordered_map` here won't hurt.

Change-Id: Ibc4ede5245551fdd7717cb349a012d05726f4363

gdbserver/inferiors.h
gdbserver/linux-aarch64-tdesc.cc
gdbserver/server.cc

index 5372a3cd5b78a5a00343e404a4146e3fccbff584..a0635de724286cb6bc4b94fc8e2fecaaa54303e9 100644 (file)
 #ifndef GDBSERVER_INFERIORS_H
 #define GDBSERVER_INFERIORS_H
 
-#include "gdbsupport/gdb_vecs.h"
 #include "gdbsupport/owning_intrusive_list.h"
+#include "gdbsupport/unordered_map.h"
 
 #include "dll.h"
 
-#include <unordered_map>
-
 struct thread_info;
 struct regcache;
 struct target_desc;
@@ -94,7 +92,7 @@ struct process_info : public intrusive_list_node<process_info>
   { return m_thread_list; }
 
   /* Return a reference to the private thread map.  */
-  std::unordered_map<ptid_t, thread_info *> &thread_map ()
+  gdb::unordered_map<ptid_t, thread_info *> &thread_map ()
   { return m_ptid_thread_map; }
 
   /* Find the first thread for which FUNC returns true.  Return nullptr if no
@@ -118,7 +116,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<ptid_t, thread_info *> m_ptid_thread_map;
+  gdb::unordered_map<ptid_t, thread_info *> m_ptid_thread_map;
 };
 
 /* Return a pointer to the current process.  Note that the current
index 39d5bccdce18aba294440e5ed73fc73582c5db71..52642d52be2dcc674c268241ab58ec847b327aa0 100644 (file)
@@ -24,7 +24,7 @@
 #include "arch/aarch64.h"
 #include "linux-aarch32-low.h"
 #include <inttypes.h>
-#include <unordered_map>
+#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<aarch64_features, target_desc *> tdesc_aarch64_map;
+  static gdb::unordered_map<aarch64_features, target_desc *> tdesc_aarch64_map;
 
   if (features.vq > AARCH64_MAX_SVE_VQ)
     error (_("VQ is %" PRIu64 ", maximum supported value is %d"), features.vq,
index 069795650a51a355eaaec7852a4977e17ab0d5d7..6e11b2e9633c650e47e15e692104ee464196ba75 100644 (file)
@@ -35,7 +35,7 @@
 #include "dll.h"
 #include "hostio.h"
 #include <vector>
-#include <unordered_map>
+#include "gdbsupport/unordered_map.h"
 #include "gdbsupport/common-inferior.h"
 #include "gdbsupport/job-control.h"
 #include "gdbsupport/environ.h"
@@ -947,7 +947,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<thread_info *, gdb_thread_options> set_options;
+      gdb::unordered_map<thread_info *, gdb_thread_options> set_options;
 
       while (*p != '\0')
        {