tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ptrace(2) interface for hardware watchpoints (breakpoints)




On 13 December 2016 at 12:16, Kamil Rytarowski <n54%gmx.com@localhost> wrote:
>> 5. Do not allow to mix PT_STEP and hardware watchpoint, in case of
>> single-stepping the code, disable (it means: don't set) hardware
>> watchpoints for threads. Some platforms might implement single-step with
>> hardware watchpoints and managing both at the same time is generating
>> extra pointless complexity.


Is this wise?  I suspect it might be better to just expose all the hairy details and let the client decide if the restriction should apply.
(to turn this round, if the details are not exposed, then clients will wonder why their platform is being crippled).
 
> I don't think I see how "extra pointless complexity" follows.
>

1. At least in MD x86 specific code, watchpoint traps triggered with
stepped code are reported differently to those reported with plain steps
and also differently to plain hardware watchpoint traps. They are 3rd
type of a trap.

2. Single stepping can be implemented with hardware assisted watchpoints
(technically breakpoints) on the kernel side in MD. And if so, trying to
apply watchpoints and singlestep will conflict and this will need
additional handling on the kernel side.

To oppose extra complexity I propose to make stepping and watchpoints
separable, one or the other, but not both.




Home | Main Index | Thread Index | Old Index