[11/19] Use gdb unordered set in linux-procfs.c

Message ID 20250317-replace-std-stuff-v1-11-7ba4ee88e218@tromey.com
State New
Headers
Series Convert std::unordered_{set,map} to gdb implementations |

Commit Message

Tom Tromey March 18, 2025, 2:15 a.m. UTC
  This changes linux-procfs.c to use gdb:unordered_set.
---
 gdb/nat/linux-procfs.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
  

Patch

diff --git a/gdb/nat/linux-procfs.c b/gdb/nat/linux-procfs.c
index 5efc86cca1f4f135c475159ed78fe72ca6a7c927..d7627138e45b1353cd681d4ca81dcc7a6c6a2e9c 100644
--- a/gdb/nat/linux-procfs.c
+++ b/gdb/nat/linux-procfs.c
@@ -18,9 +18,9 @@ 
 
 #include "linux-procfs.h"
 #include "gdbsupport/filestuff.h"
+#include "gdbsupport/unordered_set.h"
 #include <dirent.h>
 #include <sys/stat.h>
-#include <unordered_set>
 #include <utility>
 
 /* Return the TGID of LWPID from /proc/pid/status.  Returns -1 if not
@@ -358,20 +358,9 @@  linux_proc_attach_tgid_threads (pid_t pid,
       return;
     }
 
-  /* Callable object to hash elements in visited_lpws.  */
-  struct pair_hash
-  {
-    std::size_t operator() (const std::pair<unsigned long, ULONGEST> &v) const
-    {
-      return (std::hash<unsigned long>() (v.first)
-	      ^ std::hash<ULONGEST>() (v.second));
-    }
-  };
-
   /* Keeps track of the LWPs we have already visited in /proc,
      identified by their PID and starttime to detect PID reuse.  */
-  std::unordered_set<std::pair<unsigned long, ULONGEST>,
-		     pair_hash> visited_lwps;
+  gdb::unordered_set<std::pair<unsigned long, ULONGEST>> visited_lwps;
 
   /* Scan the task list for existing threads.  While we go through the
      threads, new threads may be spawned.  Cycle through the list of