From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [pushed] Handle -1 in ptid_t::parse
Date: Thu, 2 Jul 2026 12:56:59 -0600 [thread overview]
Message-ID: <20260702185659.2658180-1-tromey@adacore.com> (raw)
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.
---
gdbsupport/ptid.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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)
base-commit: de5bd217372a41c119492ef90ebd53eaae78f248
--
2.54.0
reply other threads:[~2026-07-02 18:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260702185659.2658180-1-tromey@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox