aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2021-09-16 13:55:04 -0600
committerTom Tromey <tromey@adacore.com>2021-09-23 09:30:54 -0600
commit96bbe3ef9653e23a17b2315627e0cab441815f2d (patch)
treecf9ac694a99f0ae9755d3229767a905476a69c00 /gdbsupport
parent184ea2f7316c54dd5e0fa84f1fe07a222e8fb44c (diff)
downloadgdb-96bbe3ef9653e23a17b2315627e0cab441815f2d.zip
gdb-96bbe3ef9653e23a17b2315627e0cab441815f2d.tar.gz
gdb-96bbe3ef9653e23a17b2315627e0cab441815f2d.tar.bz2
Change ptid_t::tid to ULONGEST
The ptid_t 'tid' member is normally used as an address in gdb -- both bsd-uthread and ravenscar-thread use it this way. However, because the type is 'long', this can cause problems with sign extension. This patch changes the type to ULONGEST to ensure that sign extension does not occur.
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/ptid.cc3
-rw-r--r--gdbsupport/ptid.h7
2 files changed, 6 insertions, 4 deletions
diff --git a/gdbsupport/ptid.cc b/gdbsupport/ptid.cc
index 2417120..e518066 100644
--- a/gdbsupport/ptid.cc
+++ b/gdbsupport/ptid.cc
@@ -19,6 +19,7 @@
#include "common-defs.h"
#include "ptid.h"
+#include "print-utils.h"
/* See ptid.h for these. */
@@ -30,5 +31,5 @@ ptid_t const minus_one_ptid = ptid_t::make_minus_one ();
std::string
ptid_t::to_string () const
{
- return string_printf ("%d.%ld.%ld", m_pid, m_lwp, m_tid);
+ return string_printf ("%d.%ld.%s", m_pid, m_lwp, pulongest (m_tid));
}
diff --git a/gdbsupport/ptid.h b/gdbsupport/ptid.h
index a2553b2..7cdf468 100644
--- a/gdbsupport/ptid.h
+++ b/gdbsupport/ptid.h
@@ -34,6 +34,7 @@
#include <functional>
#include <string>
+#include "gdbsupport/common-types.h"
class ptid_t
{
@@ -47,7 +48,7 @@ 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)
{}
@@ -73,7 +74,7 @@ public:
/* 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
@@ -149,7 +150,7 @@ private:
long m_lwp;
/* Thread id. */
- long m_tid;
+ ULONGEST m_tid;
};
/* Functor to hash a ptid. */