ref: 89f71fa9ed166c06a23937544b453f65fb224456
parent: fff474d8639fd387aac437e0a84a06604000c3ba
author: aiju <devnull@localhost>
date: Mon Jun 12 16:31:04 EDT 2017
acid(1), proc(3): document watchpoints
--- a/sys/man/1/acid
+++ b/sys/man/1/acid
@@ -252,6 +252,16 @@
.BI bpdel( address )
Delete a breakpoint from the current process.
.TP
+.BI wptab()
+List watchpoints set in the current process.
+.TP
+\fLwpset(\fItype\fL,\fIaddr\fL,\fIlen\fL)
+Set a watchpoint for the \fIlen\fR bytes at the given address.
+\fItype\fR is \fL"r"\fR, \fL"w"\fR or \fL"rw"\fR to trap read accesses, write accesses or both, respectively.
+.TP
+.BI wpdel( address )
+Delete all watchpoints set for the given address.
+.TP
.B cont()
Continue execution of current process and wait for it to stop.
.TP
--- a/sys/man/3/proc
+++ b/sys/man/3/proc
@@ -251,6 +251,22 @@
and
.BR /sys/src/cmd/trace.c ).
.
+.PP
+The \fLwatchpt\fR file contains a list of the watchpoints set for the process.
+If supported by the hardware, watchpoints can be used to trap accesses to specific addresses.
+Each line in the file has the form "\fItype\fR \fIaddress\fR \fIlength\fR",
+where \fItype\fR consists of the characters \fLr\fR (read), \fLw\fR (write), \fLx\fR (execute) or \fL-\fR (padding character).
+The watchpoint triggers on an access to the \fIlength\fR bytes starting at \fIaddress\fR if the type of the access must match one of the characters in the \fItype\fR field.
+.PP
+Writing to the file either replaces (offset zero) or adds to (offset non-zero) the list of watchpoints.
+Each line written must be terminated by a newline.
+If and only if all lines written comply with the (usually rather idiosyncratic) hardware restrictions, the list is updated; otherwise all changes are discarded.
+Watchpoints can also be cleared by opening the file with \fLOTRUNC\fR (see
+.IR open (2)).
+.PP
+A triggered watchpoint will deliver a \fLsys: watchpoint\fR note which includes a comma-separated list of the watchpoints that were triggered, where 0 corresponds to the first line in the
+.B watchpt
+file, 1 to the second and so forth.
.SS Control messages
Textual messages written to the
.B ctl