From: Pedro Alves <palves@redhat.com>
To: Gary Benson <gbenson@redhat.com>, gdb-patches@sourceware.org
Cc: Doug Evans <dje@google.com>
Subject: Re: [PATCH 3/3] Wait for target to stop before running agent commands
Date: Fri, 19 Sep 2014 16:16:00 -0000 [thread overview]
Message-ID: <541C56C2.7050604@redhat.com> (raw)
In-Reply-To: <1411034346-868-4-git-send-email-gbenson@redhat.com>
On 09/18/2014 10:59 AM, Gary Benson wrote:
> This commit fixes a bug on where agent_run_command is called on
> GNU/Linux targets that may not have stopped yet.
>
> gdb/ChangeLog:
>
> * linux-nat.c (linux_child_static_tracepoint_markers_by_strid):
> Use target_stop_and_wait in place of target_stop.
> ---
> gdb/ChangeLog | 5 +++++
> gdb/linux-nat.c | 2 +-
> 2 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
> index 5a82d23..f2895ff 100644
> --- a/gdb/linux-nat.c
> +++ b/gdb/linux-nat.c
> @@ -4458,7 +4458,7 @@ linux_child_static_tracepoint_markers_by_strid (struct target_ops *self,
> ptid_t ptid = ptid_build (pid, 0, 0);
>
> /* Pause all */
> - target_stop (ptid);
> + target_stop_and_wait (ptid);
More would be needed for fix this fully.
Unlike the comment above suggests, target_stop_and_wait only
waits for one thread to stop, not all.
See the gdbserver version (run_inferior_command) -- this is also
missing uninserting breakpoints after fully pausing the target.
If we handle this internally to linux-nat.c, then similarly
to gdbserver's version, this could use
stop_callback/stop_wait_callback to leave pending any events
that pausing might trip on. Then we'd need to be careful to
only re-resume threads that were already resumed before, and
leave those with pending events stopped. If we want to
use existing target methods, then we need to teach gdb's
struct thread_info layer about leaving events pending, like in:
https://sourceware.org/ml/gdb-patches/2011-12/msg00564.html
Alternative, we can would promote target_stop_and_wait to
a real target method that handles the leaving of events pending,
like gdbserver's pause_all/unpause_all methods.
Thanks,
Pedro Alves
prev parent reply other threads:[~2014-09-19 16:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-18 9:59 [PATCH 0/3] target_{stop,continue} things Gary Benson
2014-09-18 9:59 ` [PATCH 1/3] Rename target_{stop,continue}_ptid Gary Benson
2014-09-19 16:16 ` Pedro Alves
2014-09-18 9:59 ` [PATCH 2/3] Update target_stop's documentation Gary Benson
2014-09-19 16:38 ` Pedro Alves
2014-09-22 10:35 ` Gary Benson
2014-09-18 9:59 ` [PATCH 3/3] Wait for target to stop before running agent commands Gary Benson
2014-09-19 16:16 ` Pedro Alves [this message]
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=541C56C2.7050604@redhat.com \
--to=palves@redhat.com \
--cc=dje@google.com \
--cc=gbenson@redhat.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