From: Tom Tromey Date: Thu, 2 Jul 2026 18:12:49 +0000 (-0600) Subject: Handle -1 in ptid_t::parse X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d243fb0029e28738abb3f933afbf01e1d0617d74;p=thirdparty%2Fbinutils-gdb.git Handle -1 in ptid_t::parse ptid_t::parse fails to correctly handle the -1 return from hex_or_minus_one in the 'p' case. As Mark Wielaard pointed out, it does this check: if (hex != ((unsigned_lwp_type) lwp)) However on 32-bit, this means that it will mishandle (ULONGEST) -1. This patch fixes the problem by adding a check for the -1 case. I built a -m32 gdb and verified this fix; I'm checking it in. --- diff --git a/gdbsupport/ptid.cc b/gdbsupport/ptid.cc index 5de1da3ba44..933e441f9b8 100644 --- a/gdbsupport/ptid.cc +++ b/gdbsupport/ptid.cc @@ -109,7 +109,7 @@ ptid_t::parse (const char *buf, const char **obuf, bool for_remote, error (_("invalid remote ptid: %s"), buf); lwp = (ptid_t::lwp_type) hex; - if (hex != ((unsigned_lwp_type) lwp)) + if (hex != ((unsigned_lwp_type) lwp) && hex != (ULONGEST) -1) error (_("invalid remote ptid: %s"), buf); if (obuf != nullptr)