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 Tue, Dec 13, 2016 at 02:04:36 +0100, Kamil Rytarowski wrote:
> The design is as follows:
>
> 1. Accessors through:
> - PT_WRITE_WATCHPOINT - write new watchpoint's state (set, unset, ...),
> - PT_READ_WATCHPOINT - read watchpoints's state,
> - PT_COUNT_WATCHPOINT - receive the number of available watchpoints.
Gdb supports hardware assisted watchpoints. That implies that other
OSes have existing designs for them. Have you studied those existing
designs? Why do you think they are not suitable to be copied?
> 4. Do not set watchpoints globally per process, limit them to
> threads (LWP). [...] Adding process-wide management in the
> ptrace(2) interface calls adds extra complexity that should be
> pushed away to user-land code in debuggers.
I have no idea what amd64 debug registers do, but this smells like you
are exposing in the MI interface some of those details. I don't think
this can be done in hardware on sh3, e.g.
Also, you quite often have no idea which thread stomps on your data,
so I'd imagine most of the time you do want a global watchpoint.
Note, that if you want to restrict your watchpoint to one thread, you
can probably (I don't know and I haven't checked) do this with gdb
"command" that "continue"s if it's on the wrong thread.
> 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.
I don't think I see how "extra pointless complexity" follows.
Also, you might want both, single-stepping and waiting for a
watchpoint. Will debugger have switch dynamically to software
watchpoints when single-stepping? Can it even do that already?
In general I'd appreciate if handwavy "this is pointless/extra
complexity" arguments were spelled out. They might be obvious to you,
but most people reading this don't have relevant information swapped
in, or don't know enough details.
-uwe
Home |
Main Index |
Thread Index |
Old Index