Hi,
Back in July, I added support in the kernel for hardware debug
registers on the ix86 platform which allows for hardware watchpoints,
etc. I just realized that these are not documented in the ptrace and
procfs man pages. It would be real nice to get this in the doc for
4.0-RELEASE so that the gdb folks (and other debugger writers) will
have easy access to the information they need to implement the
necessary support bits in their debugger(s).
I've also added a comment in <machine/reg.h>.
Could someone please commit this doc addition?
If you think it would be helpful, I will follow up this patch in a few
days with a standalone program that demonstrates the use of these
registers for setting up a watchpoint for a process. Maybe this could
go into /usr/share/examples or something. Does anyone have any
opinions on this or think it might be useful?
Thanks,
-Brian
--
Brian Dean [EMAIL PROTECTED]
Enterprise Server Technology
"If we knew what we were doing, it wouldn't be called
research." - A.Einstien
Here's the patch:
Index: share/man/man5/procfs.5
===================================================================
RCS file: /usr00/mirror/ncvs/src/share/man/man5/procfs.5,v
retrieving revision 1.12
diff -u -r1.12 procfs.5
--- share/man/man5/procfs.5 1999/08/28 00:20:49 1.12
+++ share/man/man5/procfs.5 2000/02/11 15:51:52
@@ -74,6 +74,13 @@
in which case that signal is delivered to the process
(see
.Xr sigaction 2 ).
+.It Pa dbregs
+The debug registers as defined by
+.Dv "struct dbregs"
+in
+.Pa <machine/reg.h> .
+.Pa dbregs
+is currently only implemented on the i386 architecture.
.It Pa etype
The type of the executable referenced by the
.Pa file
Index: libc/sys/ptrace.2
===================================================================
RCS file: /usr00/mirror/ncvs/src/lib/libc/sys/ptrace.2,v
retrieving revision 1.11
diff -u -r1.11 ptrace.2
--- libc/sys/ptrace.2 1999/08/28 00:02:30 1.11
+++ libc/sys/ptrace.2 2000/02/11 15:40:28
@@ -202,6 +202,23 @@
.Aq Pa machine/reg.h )
pointed to by
.Fa addr .
+.It Dv PT_GETDBREGS
+This request reads the traced process' debug registers into
+the
+.Dq Li "struct dbreg"
+(defined in
+.Aq Pa machine/reg.h )
+pointed to by
+.Fa addr .
+.It Dv PT_SETDBREGS
+This request is the converse of
+.Dv PT_GETDBREGS ;
+it loads the traced process' debug registers from the
+.Dq Li "struct dbreg"
+(defined in
+.Aq Pa machine/reg.h )
+pointed to by
+.Fa addr .
.El
.Sh RETURN VALUES
Some requests can cause
@@ -250,8 +267,10 @@
.Dv PT_GETREGS ,
.Dv PT_SETREGS ,
.Dv PT_GETFPREGS ,
+.Dv PT_SETFPREGS ,
+.Dv PT_GETDBREGS ,
or
-.Dv PT_SETFPREGS
+.Dv PT_SETDBREGS
was attempted on a process with no valid register set. (This is
normally true only of system processes.)
.El
Index: i386/include/reg.h
===================================================================
RCS file: /usr00/mirror/ncvs/src/sys/i386/include/reg.h,v
retrieving revision 1.21
diff -u -r1.21 reg.h
--- i386/include/reg.h 1999/12/29 04:33:07 1.21
+++ i386/include/reg.h 2000/02/11 15:42:34
@@ -118,6 +118,9 @@
unsigned char fpr_pad[64];
};
+/*
+ * Register set accessible via /proc/$pid/dbregs.
+ */
struct dbreg {
unsigned int dr0; /* debug address register 0 */
unsigned int dr1; /* debug address register 1 */
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message