Re: [PATCH 4/5] range stepping: gdbserver (x86 GNU/Linux)

Pedro Alves
2013-05-20T18:01:08Z

On 05/15/2013 01:13 PM, Yao Qi wrote:
> On 05/15/2013 03:10 AM, Pedro Alves wrote:
>> - Moved step range bits out of gdbthread.h/inferiors.c into linux-low.c.
>
> Pedro,
> What is your reason to do this move? because the range stepping is only implemented on Linux? I chose to add in generic code because I thought range stepping can be implemented for other targets.

Yes, kind of. At first, I saw that the v1/v2 implementation didn't
allow wildcard ptids, and I thought that it'd be best not to error
on it, as nothing in the protocol actually prohibits it. The way gdbserver
handles vCont requests currently is by letting the target match the ptid
to whatever thread/lwp. In the case of Linux, that's in
linux_set_resume_request. After putting the range in struct thread_resume,
and making linux_set_resume_request always copy it, as in:

thread->step_range_start = lwp->resume->step_range_start;
thread->step_range_end = lwp->resume->step_range_end;

I noticed that nothing outside of linux-low.c actually called
thread_clear_range_stepping, so I removed that. Then, I noticed that
thread_in_range_stepping_p was never used outside linux-low.c (and won't
unless gdbserver's backends are made to always do non-stop instead of pausing
all threads itself, along with all the step-over-breakpoint complication).
So in the end, seeing how all was always in the target, I just went with
leaving the fields Linux specific, rather than leave the fields dangling on
other targets, thinking it'd be easy enough to reconsider once other
targets implement range stepping. Meanwhile, other targets wouldn't
pay for extra fields they don't use.

--
Pedro Alves