This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/7] Force to insert software single step breakpoint
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 22 Apr 2016 17:36:09 +0100
- Subject: Re: [PATCH 3/7] Force to insert software single step breakpoint
- Authentication-results: sourceware.org; auth=none
- References: <1458749384-19793-1-git-send-email-yao dot qi at linaro dot org> <1458749384-19793-4-git-send-email-yao dot qi at linaro dot org> <570BB52F dot 7 at redhat dot com> <861t60k9dl dot fsf at gmail dot com>
Looks OK to me now. A couple nits below.
On 04/20/2016 08:49 AM, Yao Qi wrote:
>
> 2016-04-20 Yao Qi <yao.qi@linaro.org>
>
> * breakpoint.c (should_be_inserted): Return 0 if the location's
> owner is not single step breakpoint or single step brekapoint's
type "brekapoint".
> owner isn't the thread we are stepping over.
> * gdbarch.sh (software_single_step): Update comments.
> * gdbarch.h: Regenerated.
> * infrun.c (struct step_over_info) <thread>: New field.
> (set_step_over_info): New argument 'thread'. Callers updated.
> (clear_step_over_info): Set field thread to -1.
> (thread_is_being_stepped_over_p): New function.
We don't step over threads, but rather threads step over breakpoints.
I'd suggest:
thread_is_stepping_over_breakpoint_p
(Personally. I don't see the need for a _p / predicate suffix
when the function is clearly a predicate, due to use of the
"is". thread_being_stepped_over_p / thread_is_being_stepped_over).
> * infrun.h (thread_is_being_stepped_over_p): Declaration.
>
> diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
> index f99a7ab..64e97c6 100644
> --- a/gdb/breakpoint.c
> +++ b/gdb/breakpoint.c
> @@ -2219,11 +2219,22 @@ should_be_inserted (struct bp_location *bl)
> return 0;
>
> /* Don't insert a breakpoint if we're trying to step past its
> - location. */
> + location except that the breakpoint is single-step breakpoint
> + and the single-step breakpoint's owner is the thread we're
> + stepping over. */
"breakpoint's owner" is kind of possible confusing
with "bp location owner", which is itself a breakpoint.
I'd find it clearer to copy&edit it to say:
/* Don't insert a breakpoint if we're trying to step past its
location, except if the breakpoint is a single-step breakpoint,
and the breakpoint's thread is the thread that is stepping past
a breakpoint. */
> /* See infrun.h. */
> @@ -1365,6 +1371,15 @@ stepping_past_instruction_at (struct address_space *aspace,
> /* See infrun.h. */
>
> int
> +thread_is_being_stepped_over_p (int thread)
> +{
> + return (step_over_info.aspace != NULL
> + && thread == step_over_info.thread);
Wouldn't:
return (step_over_info.thread != -1
&& thread == step_over_info.thread);
be a bit more to the point? Using the aspace field makes me wonder whether
we're caring for a case where step_over_info.thread is set to some
thread, but aspace is NULL.
Thanks,
Pedro Alves