This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 11/18] Implement all-stop on top of a target running non-stop mode
- From: Doug Evans <dje at google dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 22 May 2015 18:35:12 +0000
- Subject: Re: [PATCH 11/18] Implement all-stop on top of a target running non-stop mode
- Authentication-results: sourceware.org; auth=none
Pedro Alves writes:
...
> gdb/ChangeLog:
> 2015-05-21 Pedro Alves <palves@redhat.com>
>
> * NEWS: Mention "maint set/show target-non-stop".
> * breakpoint.c (update_global_location_list): Check
> target_is_non_stop_p instead of non_stop.
> * infcmd.c (attach_command_post_wait, attach_command): Likewise.
> * infrun.c (show_can_use_displaced_stepping)
> (can_use_displaced_stepping_p, start_step_over_inferior):
> Likewise.
> (resume): Always resume a single thread if the target is in
> non-stop mode.
> (proceed): Check target_is_non_stop_p instead of non_stop. If in
> all-stop mode but the target is always in non-stop mode, start all
> the other threads that are implicitly resumed too.
> (for_each_just_stopped_thread, fetch_inferior_event)
> (adjust_pc_after_break, stop_all_threads): Check
> target_is_non_stop_p instead of non_stop.
> (handle_inferior_event): Likewise. Handle detach-fork in all-stop
> with the target always in non-stop mode.
> (handle_signal_stop) <random signal>: Check target_is_non_stop_p
> instead of non_stop.
> (switch_back_to_stepped_thread): Check target_is_non_stop_p
> instead of non_stop.
> (keep_going_stepped_thread): Always resume a single thread if the
> target is in non-stop mode.
> (stop_waiting): If in all-stop mode, and the target is in non-stop
> mode, stop all threads.
> (keep_going_pass): Likewise, when starting a new in-line step-over
> sequence.
> * linux-nat.c (get_pending_status, select_event_lwp)
> (linux_nat_filter_event, linux_nat_wait_1, linux_nat_wait): Check
> target_is_non_stop_p instead of non_stop.
> (linux_nat_always_non_stop_p): New function.
> (linux_nat_stop): Check target_is_non_stop_p instead of non_stop.
> (linux_nat_add_target): Install linux_nat_always_non_stop_p.
> * target-delegates.c: Regenerate.
> * target.c (target_is_non_stop_p): New function.
> (target_non_stop_enabled, target_non_stop_enabled_1): New globals.
> (maint_set_target_non_stop_command)
> (maint_show_target_non_stop_command): New functions.
> (_initilize_target): Install "maint set/show target-non-stop"
> commands.
> * target.h (struct target_ops) <to_always_non_stop_p>: New field.
> (target_non_stop_enabled): New declaration.
> (target_is_non_stop_p): New declaration.
>
> gdb/doc/ChangeLog:
> 2015-05-21 Pedro Alves <palves@redhat.com>
>
> * gdb.texinfo (Maintenance Commands): Document "maint set/show
> target-non-stop".
>
...
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index 75c5080..d9fc4e5 100644
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
...
> @@ -2383,7 +2384,15 @@ resume (enum gdb_signal sig)
> insert_single_step_breakpoint (gdbarch, aspace, pc);
> insert_breakpoints ();
>
> - resume_ptid = user_visible_resume_ptid (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 ())
> + resume_ptid = inferior_ptid;
> + else
> + resume_ptid = user_visible_resume_ptid (user_step);
> do_target_resume (resume_ptid, 0, GDB_SIGNAL_0);
> discard_cleanups (old_cleanups);
> tp->resumed = 1;
re: improved comment:
Better, thanks.
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.]