@@ -1,3 +1,8 @@
+2019-11-09 Evgeniy Didin <didin@synopsys.com>
+
+ * remote.c (remote_target::write_ptid): Make tid,pid
+ variables type "long" to prevent overflow.
+
2019-11-08 Tom Tromey <tromey@adacore.com>
* top.c (read_command_file): Update.
@@ -2909,22 +2909,22 @@ static int remote_newthread_step (threadref *ref, void *context);
char *
remote_target::write_ptid (char *buf, const char *endbuf, ptid_t ptid)
{
- int pid, tid;
+ long pid, tid;
struct remote_state *rs = get_remote_state ();
if (remote_multi_process_p (rs))
{
pid = ptid.pid ();
if (pid < 0)
- buf += xsnprintf (buf, endbuf - buf, "p-%x.", -pid);
+ buf += xsnprintf (buf, endbuf - buf, "p-%lx.", -pid);
else
- buf += xsnprintf (buf, endbuf - buf, "p%x.", pid);
+ buf += xsnprintf (buf, endbuf - buf, "p%lx.", pid);
}
tid = ptid.lwp ();
if (tid < 0)
- buf += xsnprintf (buf, endbuf - buf, "-%x", -tid);
+ buf += xsnprintf (buf, endbuf - buf, "-%lx", -tid);
else
- buf += xsnprintf (buf, endbuf - buf, "%x", tid);
+ buf += xsnprintf (buf, endbuf - buf, "%lx", tid);
return buf;
}