From: Doug Evans <dje@google.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 11/18] Implement all-stop on top of a target running non-stop mode
Date: Thu, 28 May 2015 18:56:00 -0000 [thread overview]
Message-ID: <CADPb22T9WF=nSXorFUzBzQARgDLOiWq6nSmaW8K6Yhxj-7Y7=Q@mail.gmail.com> (raw)
In-Reply-To: <55609CB8.3050104@redhat.com>
On Sat, May 23, 2015 at 8:28 AM, Pedro Alves <palves@redhat.com> wrote:
> On 05/22/2015 07:35 PM, Doug Evans wrote:
>
>> I found another instance in keep_going_stepped_thread:
>>
>> if (target_is_non_stop_p ())
>> resume_ptid = inferior_ptid;
>> else
>> resume_ptid = user_visible_resume_ptid
>> (tp->control.stepping_command);
>>
>> Can you add a comment here too?
>> Thanks.
>> [An alternative would be to add a utility function that
>> contained this code and then put the comment there,
>> but I'll leave it to you to decide if you want
>> such a function.]
>
> That's a good idea. How about this? I'll fold it in
> if it looks good.
>
> ---
> gdb/infrun.c | 53 ++++++++++++++++++++++++++---------------------------
> 1 file changed, 26 insertions(+), 27 deletions(-)
>
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index d9fc4e5..fe48c91 100644
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -2173,6 +2173,25 @@ user_visible_resume_ptid (int step)
> return resume_ptid;
> }
>
> +/* Return a ptid representing the set of threads that we will resume,
> + in the perspective of the target, assuming run control handling
> + does not require leaving some threads stopped (e.g., stepping past
> + breakpoint). USER_STEP indicates whether we're about to start the
> + target for a stepping command. */
> +
> +static ptid_t
> +internal_resume_ptid (int user_step)
> +{
> + /* In non-stop, we always control threads individually. Note that
> + the target may always work in non-stop mode even with "set
> + non-stop off", in which case user_visible_resume_ptid could
> + return a wildcard ptid. */
> + if (target_is_non_stop_p ())
> + return inferior_ptid;
> + else
> + return user_visible_resume_ptid (user_step);
> +}
> +
> /* Wrapper for target_resume, that handles infrun-specific
> bookkeeping. */
>
> @@ -2384,15 +2403,7 @@ resume (enum gdb_signal sig)
> insert_single_step_breakpoint (gdbarch, aspace, pc);
> insert_breakpoints ();
>
> - /* In non-stop, we always control threads individually.
> - Note that the target may always work in non-stop mode
> - even with "set non-stop off", in which case
> - user_visible_resume_ptid could return a wildcard
> - ptid. */
> - if (target_is_non_stop_p ())
> - resume_ptid = inferior_ptid;
> - else
> - resume_ptid = user_visible_resume_ptid (user_step);
> + resume_ptid = internal_resume_ptid (user_step);
> do_target_resume (resume_ptid, 0, GDB_SIGNAL_0);
> discard_cleanups (old_cleanups);
> tp->resumed = 1;
> @@ -2501,20 +2512,9 @@ resume (enum gdb_signal sig)
> use singlestep breakpoint. */
> gdb_assert (!(thread_has_single_step_breakpoints_set (tp) && step));
>
> - /* Decide the set of threads to ask the target to resume. Start
> - by assuming everything will be resumed, than narrow the set
> - by applying increasingly restricting conditions. */
> - resume_ptid = user_visible_resume_ptid (user_step);
> -
> - /* Maybe resume a single thread after all. */
> - if (target_is_non_stop_p ())
> - {
> - /* If non-stop mode, threads are always controlled
> - individually. */
> - resume_ptid = inferior_ptid;
> - }
> - else if ((step || thread_has_single_step_breakpoints_set (tp))
> - && tp->control.trap_expected)
> + /* Decide the set of threads to ask the target to resume. */
> + if ((step || thread_has_single_step_breakpoints_set (tp))
> + && tp->control.trap_expected)
> {
> /* We're allowing a thread to run past a breakpoint it has
> hit, by single-stepping the thread with the breakpoint
> @@ -2523,6 +2523,8 @@ resume (enum gdb_signal sig)
> breakpoint if allowed to run. */
> resume_ptid = inferior_ptid;
> }
> + else
> + resume_ptid = internal_resume_ptid (user_step);
>
> if (execution_direction != EXEC_REVERSE
> && step && breakpoint_inserted_here_p (aspace, pc))
> @@ -6833,10 +6835,7 @@ keep_going_stepped_thread (struct thread_info *tp)
> stop_pc);
>
> tp->resumed = 1;
> - if (target_is_non_stop_p ())
> - resume_ptid = inferior_ptid;
> - else
> - resume_ptid = user_visible_resume_ptid (tp->control.stepping_command);
> + resume_ptid = internal_resume_ptid (tp->control.stepping_command);
> do_target_resume (resume_ptid, 0, GDB_SIGNAL_0);
> }
> else
"works for me"
Thanks.
next prev parent reply other threads:[~2015-05-28 18:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 18:35 Doug Evans
2015-05-23 15:29 ` Pedro Alves
2015-05-28 18:56 ` Doug Evans [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-05-21 23:19 [PATCH v4 00/18] All-stop on top of non-stop Pedro Alves
2015-05-21 23:19 ` [PATCH 11/18] Implement all-stop on top of a target running non-stop mode Pedro Alves
2015-09-11 20:53 ` Jan Kratochvil
2015-09-14 14:24 ` 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='CADPb22T9WF=nSXorFUzBzQARgDLOiWq6nSmaW8K6Yhxj-7Y7=Q@mail.gmail.com' \
--to=dje@google.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