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: Tue, 19 Apr 2016 16:16:56 +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> <8660vdk5sk dot fsf at gmail dot com>
On 04/19/2016 03:54 PM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
>
>> Another scenario occurred to me:
>>
>> - Thread A is software single-stepping.
>> - Thread B hits single-step breakpoint of thread A.
>> - We pause all threads and set thread B stepping past the
>> single-step breakpoint of thread A.
>>
>> But if the single-step breakpoint is for another thread, then
>> we won't actually manage to have thread B step past it, resulting
>> in spurious re-hits and no-guaranteed forward progress. See
>> e.g., non-stop-fair-events.exp:
>>
>> # On software single-step targets that don't support displaced
>> # stepping, threads keep hitting each others' single-step
>> # breakpoints, and then GDB needs to pause all threads to step
>> # past those. The end result is that progress in the main
>> # thread will be slower and it may take a bit longer for the
>> # signal to be queued; bump the timeout.
>>
>> Sounds like we may need to look at the single-step breakpoint's thread
>> id, and only insert it if it is for the thread that is going to be
>> doing the step-over? We may need to record that in step_over_info and
>> pass more info to stepping_past_instruction_at.
>
> I think this is about any thread specific breakpoint, instead of
> only single-step breakpoint (single-step breakpoint is thread specific
> too). If we are doing step-over for thread A, do we need to insert any
> breakpoints specific to other threads? (my answer is No).
Right, we don't need to insert them, because other threads
will remain stopped while thread A is doing the step-over.
However, given that gdb does not remove/re-insert all breakpoints on
internal stops nowadays, removing thread-specific breakpoints of others
threads will be less efficient than leaving them be, I think. I mean,
you'll get more z0/Z0 traffic than if you leave them inserted.
Thanks,
Pedro Alves