Mark Kettenis <[email protected]> writes:

>> From: [email protected] (=?utf-8?Q?J=C3=A9r=C3=A9mie_Courr=C3=A8ges-Anglas?=)
>> Date: Sun, 05 May 2013 20:37:25 +0200
>> 
>> Hi,
>> 
>> the lack of hardware-assisted breakpoints support makes the use of
>> `watch' painful in gdb.
>> 
>> Has work already been done on this front?  If not, are there particular
>> reasons that would make it unsuitable / unlikely to be integrated into
>> base?
>
> No work has been done.
>
>> I'm currently trying to see what's needed to implement i386 support.
>> It *seems* that OpenBSD doesn't know about the debug registers on this
>> architecture.
>
> Right.  And adding support to the kernel is a non-trivial task.

Everything kernel-related is non-trivial to me. :)
I've tried to mimic the way FreeBSD handles this, but I'm still missing
a few bits so far.

> The hardware debug registers on i386/amd64 only allow for a very
> limited number breakpoints/watchpoints and has the drawback that it is
> hardware-specific.

Sure, but that's enough for most of my debugging needs, so I figured
I could try to go that way, but...

> A better approach would be to take a page-fault
> based approach where setting a watchpoint will map the page containing
> the varible that's being watched read-only and trap if the page is
> being modified.

This sounds nicer indeed than dealing with architecture-specific issues
and limited functionality, but I only have a vague understanding of the
mechanism.  Is there an existing implementation out there?

Regards,
-- 
Jérémie Courrèges-Anglas
PGP Key fingerprint: 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494

Reply via email to