From 96bbe3ef9653e23a17b2315627e0cab441815f2d Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 16 Sep 2021 13:55:04 -0600 Subject: 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. --- gdbserver/target.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdbserver') diff --git a/gdbserver/target.cc b/gdbserver/target.cc index 6660cc0..988c6d5 100644 --- a/gdbserver/target.cc +++ b/gdbserver/target.cc @@ -286,8 +286,8 @@ target_pid_to_str (ptid_t ptid) else if (ptid == null_ptid) xsnprintf (buf, sizeof (buf), ""); else if (ptid.tid () != 0) - xsnprintf (buf, sizeof (buf), "Thread %d.0x%lx", - ptid.pid (), ptid.tid ()); + xsnprintf (buf, sizeof (buf), "Thread %d.0x%s", + ptid.pid (), phex_nz (ptid.tid (), sizeof (ULONGEST))); else if (ptid.lwp () != 0) xsnprintf (buf, sizeof (buf), "LWP %d.%ld", ptid.pid (), ptid.lwp ()); -- cgit v1.1