* [PATCH+7.10.1] PR remote/18965: vforkdone stop reply should indicate parent PID
@ 2015-09-15 16:20 Pedro Alves
2015-09-15 16:28 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2015-09-15 16:20 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: GDB Patches, Breazeal, Don
Hi Eli,
Are the doc bits OK?
I'd like to push this to the 7.10 branch too, so I filed a PR.
From 5e5467a6d2efe08f91e5e79edecc5d15ab8e2eb6 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Tue, 15 Sep 2015 17:05:41 +0100
Subject: [PATCH] PR remote/18965: vforkdone stop reply should indicate parent
PID
The vforkdone stop reply misses indicating the thread ID of the vfork
parent which the event relates to:
@cindex vfork events, remote reply
@item vfork
The packet indicates that @code{vfork} was called, and @var{r}
is the thread ID of the new child process. Refer to
@ref{thread-id syntax} for the format of the @var{thread-id}
field. This packet is only applicable to targets that support
vfork events.
@cindex vforkdone events, remote reply
@item vforkdone
The packet indicates that a child process created by a vfork
has either called @code{exec} or terminated, so that the
address spaces of the parent and child process are no longer
shared. The @var{r} part is ignored. This packet is only
applicable to targets that support vforkdone events.
Unfortunately, this is not just a documentation issue. GDBserver
is really not specifying the thread ID. I noticed because
in non-stop mode, gdb complains:
[Thread 6089.6089] #1 stopped.
#0 0x0000003615a011f0 in ?? ()
0x0000003615a011f0 in ?? ()
(gdb) set debug remote 1
(gdb) c
Continuing.
Sending packet: $QPassSignals:e;10;14;17;1a;1b;1c;21;24;25;2c;4c;#5f...Packet received: OK
Sending packet: $vCont;c:p17c9.17c9#88...Packet received: OK
Notification received: Stop:T05vfork:p17ce.17ce;06:40d7ffffff7f0000;07:30d7ffffff7f0000;10:e4c9eb1536000000;thread:p17c9.17c9;core:2;
Sending packet: $vStopped#55...Packet received: OK
Sending packet: $D;17ce#af...Packet received: OK
Sending packet: $vCont;c:p17c9.17c9#88...Packet received: OK
Notification received: Stop:T05vforkdone:;
No process or thread specified in stop reply: T05vforkdone:;
(gdb)
This is not non-stop-mode-specific, however. Consider e.g., that in
all-stop, you may be debugging more than one process at the same time.
You continue, and both processes vfork. So when you next get a
T05vforkdone, there's no way to tell which of the parent processes is
done with the vfork.
Tests will be added later.
Tested on x86_64 Fedora 20.
gdb/ChangeLog:
2015-09-15 Pedro Alves <palves@redhat.com>
PR remote/18965
* remote-utils.c (prepare_resume_reply): Merge
TARGET_WAITKIND_VFORK_DONE switch case with the
TARGET_WAITKIND_FORKED case.
gdb/doc/ChangeLog:
2015-09-15 Pedro Alves <palves@redhat.com>
PR remote/18965
* gdb.texinfo (Stop Reply Packets): Explain that vforkdone's 'r'
part indicates the thread ID of the parent process.
---
gdb/ChangeLog | 7 +++++++
gdb/doc/ChangeLog | 6 ++++++
gdb/doc/gdb.texinfo | 11 ++++++-----
gdb/gdbserver/remote-utils.c | 17 +++++++----------
4 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9932d60..d19c71a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-15 Pedro Alves <palves@redhat.com>
+
+ PR remote/18965
+ * remote-utils.c (prepare_resume_reply): Merge
+ TARGET_WAITKIND_VFORK_DONE switch case with the
+ TARGET_WAITKIND_FORKED case.
+
2015-09-15 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-nat.c (aarch64_linux_can_do_single_step): New
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index b5de969..2cc6039 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-15 Pedro Alves <palves@redhat.com>
+
+ PR remote/18965
+ * gdb.texinfo (Stop Reply Packets): Explain that vforkdone's 'r'
+ part indicates the thread ID of the parent process.
+
2015-09-15 Yao Qi <yao.qi@linaro.org>
* gdb.texinfo (General Query Packets): Add vContSupported to
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 4ecdb8f..e80e695 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -35498,11 +35498,12 @@ indicating support.
@cindex vforkdone events, remote reply
@item vforkdone
-The packet indicates that a child process created by a vfork
-has either called @code{exec} or terminated, so that the
-address spaces of the parent and child process are no longer
-shared. The @var{r} part is ignored. This packet is only
-applicable to targets that support vforkdone events.
+The packet indicates that a child process created by a vfork has
+either called @code{exec} or terminated, so that the address spaces of
+the parent and child process are no longer shared. The @var{r} part
+is the thread ID of the parent process. Refer to @ref{thread-id
+syntax} for the format of the @var{thread-id} field. This packet is
+only applicable to targets that support vforkdone events.
This packet should not be sent by default; older @value{GDBN} versions
did not support it. @value{GDBN} requests it, by supplying an
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index ac86dd5..78fbfac 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -1117,6 +1117,7 @@ prepare_resume_reply (char *buf, ptid_t ptid,
case TARGET_WAITKIND_STOPPED:
case TARGET_WAITKIND_FORKED:
case TARGET_WAITKIND_VFORKED:
+ case TARGET_WAITKIND_VFORK_DONE:
case TARGET_WAITKIND_EXECD:
{
struct thread_info *saved_thread;
@@ -1135,6 +1136,12 @@ prepare_resume_reply (char *buf, ptid_t ptid,
buf = write_ptid (buf, status->value.related_pid);
strcat (buf, ";");
}
+ else if (status->kind == TARGET_WAITKIND_VFORK_DONE && report_vfork_events)
+ {
+ enum gdb_signal signal = GDB_SIGNAL_TRAP;
+
+ sprintf (buf, "T%02xvforkdone:;", signal);
+ }
else if (status->kind == TARGET_WAITKIND_EXECD && multi_process)
{
enum gdb_signal signal = GDB_SIGNAL_TRAP;
@@ -1269,16 +1276,6 @@ prepare_resume_reply (char *buf, ptid_t ptid,
else
sprintf (buf, "X%02x", status->value.sig);
break;
- case TARGET_WAITKIND_VFORK_DONE:
- if (report_vfork_events)
- {
- enum gdb_signal signal = GDB_SIGNAL_TRAP;
-
- sprintf (buf, "T%02xvforkdone:;", signal);
- }
- else
- sprintf (buf, "T%02x", GDB_SIGNAL_0);
- break;
default:
error ("unhandled waitkind");
break;
--
1.9.3
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH+7.10.1] PR remote/18965: vforkdone stop reply should indicate parent PID
2015-09-15 16:20 [PATCH+7.10.1] PR remote/18965: vforkdone stop reply should indicate parent PID Pedro Alves
@ 2015-09-15 16:28 ` Eli Zaretskii
2015-09-15 18:35 ` Pedro Alves
0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2015-09-15 16:28 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, donb
> Date: Tue, 15 Sep 2015 17:20:16 +0100
> From: Pedro Alves <palves@redhat.com>
> CC: GDB Patches <gdb-patches@sourceware.org>,
> "Breazeal, Don" <donb@codesourcery.com>
>
> Hi Eli,
>
> Are the doc bits OK?
Yes, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH+7.10.1] PR remote/18965: vforkdone stop reply should indicate parent PID
2015-09-15 16:28 ` Eli Zaretskii
@ 2015-09-15 18:35 ` Pedro Alves
0 siblings, 0 replies; 3+ messages in thread
From: Pedro Alves @ 2015-09-15 18:35 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches, donb
On 09/15/2015 05:28 PM, Eli Zaretskii wrote:
>> Date: Tue, 15 Sep 2015 17:20:16 +0100
>> From: Pedro Alves <palves@redhat.com>
>> CC: GDB Patches <gdb-patches@sourceware.org>,
>> "Breazeal, Don" <donb@codesourcery.com>
>>
>> Hi Eli,
>>
>> Are the doc bits OK?
>
> Yes, thanks.
Thanks Eli. However, I realized the docs change was plain wrong.
I've reverted it now, with the patch below. Sorry about that.
Thanks,
Pedro Alves
From e68fa6f07666ec4726cfef59f641a81244cc2e00 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Tue, 15 Sep 2015 19:29:37 +0100
Subject: [PATCH] gdb/doc: revert previous vforkdone change
The previous manual change was wrong. The vfork parent thread ID
should be reported with the usual "thread" magic register:
Sending packet: $vCont;c:p7260.7260#1e...Packet received: OK
- Notification received: Stop:T05vforkdone:;
+ Notification received: Stop:T05vforkdone:;thread:p7260.7260
^^^^^^^^^^^^^^^^^
This is already how the parent is reported in the vfork/fork events,
and is actually what the fix made gdbserver do. Following the
documentation change, the event would have been reported like this
instead:
Notification received: Stop:T05vforkdone:p7260.7260
gdb/doc/ChangeLog:
2015-09-15 Pedro Alves <palves@redhat.com>
PR remote/18965
* gdb.texinfo (Stop Reply Packets): Revert previous change to
the vforkdone description.
---
gdb/doc/ChangeLog | 6 ++++++
gdb/doc/gdb.texinfo | 11 +++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 2cc6039..1e16e92 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,6 +1,12 @@
2015-09-15 Pedro Alves <palves@redhat.com>
PR remote/18965
+ * gdb.texinfo (Stop Reply Packets): Revert previous change to
+ the vforkdone description.
+
+2015-09-15 Pedro Alves <palves@redhat.com>
+
+ PR remote/18965
* gdb.texinfo (Stop Reply Packets): Explain that vforkdone's 'r'
part indicates the thread ID of the parent process.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e80e695..4ecdb8f 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -35498,12 +35498,11 @@ indicating support.
@cindex vforkdone events, remote reply
@item vforkdone
-The packet indicates that a child process created by a vfork has
-either called @code{exec} or terminated, so that the address spaces of
-the parent and child process are no longer shared. The @var{r} part
-is the thread ID of the parent process. Refer to @ref{thread-id
-syntax} for the format of the @var{thread-id} field. This packet is
-only applicable to targets that support vforkdone events.
+The packet indicates that a child process created by a vfork
+has either called @code{exec} or terminated, so that the
+address spaces of the parent and child process are no longer
+shared. The @var{r} part is ignored. This packet is only
+applicable to targets that support vforkdone events.
This packet should not be sent by default; older @value{GDBN} versions
did not support it. @value{GDBN} requests it, by supplying an
--
1.9.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-15 18:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-15 16:20 [PATCH+7.10.1] PR remote/18965: vforkdone stop reply should indicate parent PID Pedro Alves
2015-09-15 16:28 ` Eli Zaretskii
2015-09-15 18:35 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox