This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Comment on '(ptid_get_lwp (ptid) == -1'
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Tue, 12 Jun 2012 18:50:12 +0800
- Subject: [PATCH] Comment on '(ptid_get_lwp (ptid) == -1'
Hello,
I don't understand what does the checking '(ptid_get_lwp (ptid) == -1'
mean, and after one-hour searching, I get to know it. I think it worth
adding a coment for this check, and this is what this patch does.
gdb/gdbserver:
2012-06-12 Yao Qi <yao@codesourcery.com>
* linux-low.c (linux_set_resume_request): Add comment for
'(ptid_get_lwp (ptid) == -1'.
* server.c (handle_v_cont): Likewise.
---
gdb/gdbserver/linux-low.c | 4 ++++
gdb/gdbserver/server.c | 3 +++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index e8667ea..93fc402 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -3337,10 +3337,14 @@ linux_set_resume_request (struct inferior_list_entry *entry, void *arg)
for (ndx = 0; ndx < r->n; ndx++)
{
ptid_t ptid = r->resume[ndx].thread;
+
if (ptid_equal (ptid, minus_one_ptid)
|| ptid_equal (ptid, entry->id)
|| (ptid_is_pid (ptid)
&& (ptid_get_pid (ptid) == pid_of (lwp)))
+ /* The "thread-id" syntax in RSP specifies a process as "'pPID.-1'.
+ When ptid_get_lwp (ptid) returns -1, it means PTID stands for a
+ process. */
|| (ptid_get_lwp (ptid) == -1
&& (ptid_get_pid (ptid) == pid_of (lwp))))
{
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 9fd550b..30451a7 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1978,6 +1978,9 @@ handle_v_cont (char *own_buf)
vCont. */
if (n == 1
&& !(ptid_equal (resume_info[0].thread, minus_one_ptid)
+ /* The "thread-id" syntax in RSP specifies a process as "'pPID.-1'.
+ When ptid_get_lwp (ptid) returns -1, it means PTID stands for a
+ process. */
|| ptid_get_lwp (resume_info[0].thread) == -1)
&& resume_info[0].kind != resume_stop)
cont_thread = resume_info[0].thread;
--
1.7.0.4