Re: Hardware-assisted memory-access breakpoints(watchpoints) on i386

Mikael Pettersson (mikpe@csd.uu.se)
Thu, 26 Aug 1999 01:41:46 +0200 (MET DST)


Ilya Tsindlekht wrote:

> GDB (and, consequently, its GUI frontends), doesn't support hardware-based
> memory access breakpoints (aka watchpoints) on Intel CPUs. Doing this probably
> would require some kernel support (extending ptrace?). Is there any reason why
> it isn't done? (or is it already done somewhere?)

Linux does seem to give user-space access to at least some debug-related
ia32 features:
* ptrace PTRACE_POKEUSR lets a debugger record the information
that goes into the debug registers when the process is resumed
* the debug-related exceptions (#1 and #3) are mapped to SIGTRAP
signals, and the debugger can catch those

I do see two possible problems:
* The Intel P6 family has a couple of model-specific registers which
carry additional information about some debug exceptions.
ptrace() should perhaps be extended to allow a debugger to set up
and retrieve these MSRs
* I don't know what signal info (if any) Linux passes on to the
user-space signal handler; in particular, the signal handler
would need the PC of the faulting instruction or the address
which triggered a data read/write debug exception.

/Mikael

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/