From: Joel Brobecker <brobecker@adacore.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFA/gdbserver: GDB internal-error debugging threaded program with breakpoint and forks
Date: Tue, 05 Jul 2016 16:49:00 -0000 [thread overview]
Message-ID: <20160705164939.GK3295@adacore.com> (raw)
In-Reply-To: <1ad9f5a8-d00e-9a26-b0c9-3f4066af5142@redhat.com>
> > a. Make gdbserver "hide" the threads that are children of forks
> > until we've reported the corresponding fork event to GDB.
> >
>
> Agreed, I think we need to do this. It's somewhat what
> linux-nat.c does, except linux-nat.c hides the fork child
> until target_follow_fork time.
[...]
> That said, I would still consider my current
> > patch, as reporting the forks early allow us to either detach
> > from them earlier.
>
> My usual thought process is this: imagine we had (a) already. Would we
> have a particularly strong reason to complicate the code and do (b) on
> its own? Seems like not. We could apply the same rationale for preferring
> to report any other thread stopped at a breakpoint before the fork
> events (so that we could move them past their breakpoints earlier). Or
> always prefer the stepping thread, as that's the thread the user is most
> interested in (*). Etc.
>
> (*) - IIRC, the reason we prefer a stepped thread first is for
> correctness, not because that's what the user is focused in. It used
> to be that if a step event got pending, and we reported some other
> event first, later when the pending step event is finally reported as
> a plain SIGTRAP, if the thread that had a pending step was now
> continued instead of stepped, infrun wouldn't understanding what this
> SIGTRAP was about, since the thread was no longer supposed to be
> single-stepping, and would thus report the SIGTRAP to the user as a
> spurious signal. With "maint set target-non-stop on", which is still
> not the default with target remote,
> infrun.c:clear_proceed_status_thread handles this scenario on the gdb
> side and discards the single-step, but with plain all-stop, the
> spurious SIGTRAP probably would still happen.
I would have thought that we'd want GDB and GDBserver to be in sync
as quickly as possible, so as to release the new inferiors, but I guess
that doesn't really make any difference in practice. The issue with
reporting SIGTRAP from an old single-step is even more convincing that
my patch is actually wrong. Sigh...
--
Joel
next prev parent reply other threads:[~2016-07-05 16:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 17:16 RFH: failed assert debugging threaded+fork program over gdbserver Joel Brobecker
2016-05-12 17:42 ` Don Breazeal
2016-06-23 22:59 ` Joel Brobecker
2016-06-24 18:12 ` RFA/gdbserver: GDB internal-error debugging threaded program with breakpoint and forks (was: "Re: RFH: failed assert debugging threaded+fork program over gdbserver") Joel Brobecker
2016-06-24 21:57 ` RFA/gdbserver: GDB internal-error debugging threaded program with breakpoint and forks Pedro Alves
2016-06-24 22:36 ` Joel Brobecker
2016-06-24 22:37 ` Pedro Alves
2016-06-27 22:32 ` Joel Brobecker
2016-06-28 19:40 ` Pedro Alves
2016-07-05 16:49 ` Joel Brobecker [this message]
2016-06-24 21:52 ` RFH: failed assert debugging threaded+fork program over gdbserver Breazeal, Don
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=20160705164939.GK3295@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/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