From: Pedro Alves <palves@redhat.com>
To: Don Breazeal <donb@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v7 5/7] Remote follow vfork
Date: Wed, 15 Apr 2015 15:38:00 -0000 [thread overview]
Message-ID: <552E860B.3040308@redhat.com> (raw)
In-Reply-To: <1428685786-18094-6-git-send-email-donb@codesourcery.com>
On 04/10/2015 06:09 PM, Don Breazeal wrote:
> Hi Pedro,
>
> This version of the patch incorporates changes based on your comments on
> the previous version, as outlined below.
>
> On 3/24/2015 5:28 AM, Pedro Alves wrote:
>> On 03/17/2015 08:56 PM, Don Breazeal wrote:
>>
>>> diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
>>> index dc43e38..42c3ec5 100644
>>> --- a/gdb/gdbserver/remote-utils.c
>>> +++ b/gdb/gdbserver/remote-utils.c
>>> @@ -1115,15 +1115,19 @@ prepare_resume_reply (char *buf, ptid_t ptid,
>>> {
>>> case TARGET_WAITKIND_STOPPED:
>>> case TARGET_WAITKIND_FORKED:
>>> + case TARGET_WAITKIND_VFORKED:
>>> {
>>> struct thread_info *saved_thread;
>>> const char **regp;
>>> struct regcache *regcache;
>>>
>>> - if (status->kind == TARGET_WAITKIND_FORKED && report_fork_events)
>>> + if ((status->kind == TARGET_WAITKIND_FORKED && report_fork_events)
>>> + || (status->kind == TARGET_WAITKIND_VFORKED
>>> + && report_vfork_events))
>>> {
>>> enum gdb_signal signal = GDB_SIGNAL_TRAP;
>>> - const char *event = "xfork";
>>> + const char *event = (status->kind == TARGET_WAITKIND_FORKED
>>> + ? "xfork" : "vfork");
>>>
>>> sprintf (buf, "T%02x%s:", signal, event);
>>> buf += strlen (buf);
>>> @@ -1245,6 +1249,15 @@ prepare_resume_reply (char *buf, ptid_t ptid,
>>> else
>>> sprintf (buf, "X%02x", status->value.sig);
>>> break;
>>> + case TARGET_WAITKIND_VFORK_DONE:
>>> + if (multi_process)
>>> + {
>>> + enum gdb_signal signal = GDB_SIGNAL_TRAP;
>>> + const char *event = "vforkdone";
>>> +
>>
>> Should only include vforkdone if report_vfork_events is true, I'd think.
>
> If we get one of these events (fork, vfork, vforkdone) and report_xxx_events
> is not set, then it is a bug, so I put those flags into asserts for all
> three events to ensure proper behavior.
I don't think that's a good idea. For instance, what if
a thread/lwp has already stopped for VFORK_DONE but the event is left
pending to report to the gdb. Meanwhile, gdb disconnects before the
event is sent. Now a new gdb reconnects, without support for vfork-done.
See server.c:handle_status, both non-stop and all-stop. That would
trigger that assertion.
> + if (status->kind == TARGET_WAITKIND_FORKED)
> + {
> + gdb_assert (report_fork_events);
> + sprintf (buf, "T%02xfork:", signal);
> + }
> + else
> + {
> + gdb_assert (report_vfork_events);
> + sprintf (buf, "T%02xvfork:", signal);
Eh, I had asked to _remove_ the 'x's, not add them. Could you
please drop them?
Thanks,
Pedro Alves
next prev parent reply other threads:[~2015-04-15 15:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-10 17:09 [PATCH v7 0/7] Remote fork events Don Breazeal
2015-04-10 17:10 ` [PATCH v7 4/7] Arch-specific remote follow fork Don Breazeal
2015-04-10 17:10 ` [PATCH v7 2/7] Clone remote breakpoints Don Breazeal
2015-04-10 17:10 ` [PATCH v7 1/7] Identify remote fork event support Don Breazeal
2015-04-15 15:37 ` Pedro Alves
2015-04-10 17:10 ` [PATCH v7 3/7] Extended-remote Linux follow fork Don Breazeal
2015-04-15 15:38 ` Pedro Alves
2015-04-10 17:11 ` [PATCH v7 6/7] Remote fork catch Don Breazeal
2015-04-15 15:39 ` Pedro Alves
2015-04-10 17:11 ` [PATCH v7 5/7] Remote follow vfork Don Breazeal
2015-04-15 15:38 ` Pedro Alves [this message]
2015-04-15 15:41 ` Pedro Alves
2015-04-10 17:11 ` [PATCH v7 7/7] Extended-remote follow fork documentation Don Breazeal
2015-04-10 17:56 ` Eli Zaretskii
2015-04-10 18:15 ` Breazeal, Don
2015-04-10 18:29 ` Eli Zaretskii
2015-04-10 20:43 ` Don Breazeal
2015-04-15 15:47 ` Pedro Alves
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=552E860B.3040308@redhat.com \
--to=palves@redhat.com \
--cc=donb@codesourcery.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