From: Markus Metzger <markus.t.metzger@intel.com>
To: gdb-patches@sourceware.org
Cc: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Subject: [PATCH 1/2] gdbserver, read_ptid: handle '0' and '-1' thread ids
Date: Tue, 5 Aug 2025 07:19:13 +0000 [thread overview]
Message-ID: <20250805071914.3832823-1-markus.t.metzger@intel.com> (raw)
The special thread id '-1' means 'all threads'.
The special thread id '0' means 'any thread'.
Read_ptid () currently returns
<current pid>.-1.0
and
<current pid>.0.0
respectively.
Change that to minus_one_ptid for '-1' and to null_ptid for '0'.
CC: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
---
gdbserver/remote-utils.cc | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc
index 15f073dd6be..9562cc2e1fb 100644
--- a/gdbserver/remote-utils.cc
+++ b/gdbserver/remote-utils.cc
@@ -566,6 +566,26 @@ read_ptid (const char *buf, const char **obuf)
const char *p = buf;
const char *pp;
+ /* Handle special thread ids. */
+ if (*p == '0')
+ {
+ if (obuf)
+ *obuf = p + 1;
+
+ return null_ptid;
+ }
+
+ if (*p == '-')
+ {
+ if (p[1] != '1')
+ return null_ptid;
+
+ if (obuf)
+ *obuf = p + 2;
+
+ return minus_one_ptid;
+ }
+
if (*p == 'p')
{
ULONGEST pid;
--
2.34.1
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next reply other threads:[~2025-08-05 7:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-05 7:19 Markus Metzger [this message]
2025-08-05 7:19 ` [PATCH 2/2] gdb, remote: fix set_thread () in start_remote () Markus Metzger
2025-08-14 4:29 ` Thiago Jung Bauermann
2025-08-14 22:28 ` Simon Marchi
2025-08-15 0:29 ` Thiago Jung Bauermann
2025-08-15 5:33 ` Simon Marchi
2025-08-18 1:43 ` Thiago Jung Bauermann
2025-09-22 13:29 ` Metzger, Markus T
2025-08-14 3:36 ` [PATCH 1/2] gdbserver, read_ptid: handle '0' and '-1' thread ids Thiago Jung Bauermann
2025-08-14 20:40 ` Simon Marchi
2025-09-22 13:29 ` Metzger, Markus T
2025-09-23 18:26 ` Tom Tromey
2025-09-24 8:04 ` Metzger, Markus T
2025-09-26 6:43 ` Metzger, Markus T
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=20250805071914.3832823-1-markus.t.metzger@intel.com \
--to=markus.t.metzger@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=thiago.bauermann@linaro.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