/* The ptid_t type and common functions operating on it.
- Copyright (C) 1986-2020 Free Software Foundation, Inc.
+ Copyright (C) 1986-2022 Free Software Foundation, Inc.
This file is part of GDB.
thread_stratum target that might want to sit on top.
*/
+#include <functional>
+#include <string>
+#include "gdbsupport/common-types.h"
+
class ptid_t
{
public:
A ptid with only a PID (LWP and TID equal to zero) is usually used to
represent a whole process, including all its lwps/threads. */
- explicit constexpr ptid_t (int pid, long lwp = 0, long tid = 0)
+ explicit constexpr ptid_t (int pid, long lwp = 0, ULONGEST tid = 0)
: m_pid (pid), m_lwp (lwp), m_tid (tid)
{}
/* Fetch the tid (thread id) component from a ptid. */
- constexpr long tid () const
+ constexpr ULONGEST tid () const
{ return m_tid; }
/* Return true if the ptid represents a whole process, including all its
|| *this == filter);
}
+ /* Return a string representation of the ptid.
+
+ This is only meant to be used in debug messages. */
+
+ std::string to_string () const;
+
/* Make a null ptid. */
static constexpr ptid_t make_null ()
long m_lwp;
/* Thread id. */
- long m_tid;
+ ULONGEST m_tid;
+};
+
+/* Functor to hash a ptid. */
+
+struct hash_ptid
+{
+ size_t operator() (const ptid_t &ptid) const
+ {
+ std::hash<long> long_hash;
+
+ return (long_hash (ptid.pid ())
+ + long_hash (ptid.lwp ())
+ + long_hash (ptid.tid ()));
+ }
};
/* The null or zero ptid, often used to indicate no process. */