1*4bc66c0fSBrooks Davis.\" Copyright (c) 2000 Brian S. Dean 2*4bc66c0fSBrooks Davis.\" All rights reserved. 3*4bc66c0fSBrooks Davis.\" 4*4bc66c0fSBrooks Davis.\" This man-page is based on a similar man-page by Jonathan Lemon 5*4bc66c0fSBrooks Davis.\" which is copyrighted under the following conditions: 6*4bc66c0fSBrooks Davis.\" 7*4bc66c0fSBrooks Davis.\" Redistribution and use in source and binary forms, with or without 8*4bc66c0fSBrooks Davis.\" modification, are permitted provided that the following conditions 9*4bc66c0fSBrooks Davis.\" are met: 10*4bc66c0fSBrooks Davis.\" 1. Redistributions of source code must retain the above copyright 11*4bc66c0fSBrooks Davis.\" notice, this list of conditions and the following disclaimer. 12*4bc66c0fSBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright 13*4bc66c0fSBrooks Davis.\" notice, this list of conditions and the following disclaimer in the 14*4bc66c0fSBrooks Davis.\" documentation and/or other materials provided with the distribution. 15*4bc66c0fSBrooks Davis.\" 16*4bc66c0fSBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17*4bc66c0fSBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18*4bc66c0fSBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19*4bc66c0fSBrooks Davis.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20*4bc66c0fSBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21*4bc66c0fSBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22*4bc66c0fSBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23*4bc66c0fSBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24*4bc66c0fSBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25*4bc66c0fSBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26*4bc66c0fSBrooks Davis.\" SUCH DAMAGE. 27*4bc66c0fSBrooks Davis.\" 28*4bc66c0fSBrooks Davis.Dd August 24, 2000 29*4bc66c0fSBrooks Davis.Dt I386_SET_WATCH 3 30*4bc66c0fSBrooks Davis.Os 31*4bc66c0fSBrooks Davis.Sh NAME 32*4bc66c0fSBrooks Davis.Nm i386_clr_watch , 33*4bc66c0fSBrooks Davis.Nm i386_set_watch 34*4bc66c0fSBrooks Davis.Nd manage i386 debug register values 35*4bc66c0fSBrooks Davis.Sh LIBRARY 36*4bc66c0fSBrooks Davis.Lb libc 37*4bc66c0fSBrooks Davis.Sh SYNOPSIS 38*4bc66c0fSBrooks Davis.In machine/reg.h 39*4bc66c0fSBrooks Davis.In machine/sysarch.h 40*4bc66c0fSBrooks Davis.Ft int 41*4bc66c0fSBrooks Davis.Fn i386_clr_watch "int watchnum" "struct dbreg *d" 42*4bc66c0fSBrooks Davis.Ft int 43*4bc66c0fSBrooks Davis.Fn i386_set_watch "int watchnum" "unsigned int watchaddr" "int size" "int access" "struct dbreg *d" 44*4bc66c0fSBrooks Davis.Sh DESCRIPTION 45*4bc66c0fSBrooks DavisThe 46*4bc66c0fSBrooks Davis.Fn i386_clr_watch 47*4bc66c0fSBrooks Davisfunction 48*4bc66c0fSBrooks Daviswill disable the indicated watch point within the specified debug 49*4bc66c0fSBrooks Davisregister set. 50*4bc66c0fSBrooks Davis.Pp 51*4bc66c0fSBrooks DavisThe 52*4bc66c0fSBrooks Davis.Fn i386_set_watch 53*4bc66c0fSBrooks Davisfunction 54*4bc66c0fSBrooks Daviswill set up the specified debug registers as indicated by the 55*4bc66c0fSBrooks Davisarguments. 56*4bc66c0fSBrooks DavisThe 57*4bc66c0fSBrooks Davis.Fa watchnum 58*4bc66c0fSBrooks Davisargument specifies which watch register is used, 0, 1, 2, 3, or \-1. 59*4bc66c0fSBrooks DavisIf 60*4bc66c0fSBrooks Davis.Fa watchnum 61*4bc66c0fSBrooks Davisis \-1, a free watch register is found and used. 62*4bc66c0fSBrooks DavisIf there are no free 63*4bc66c0fSBrooks Daviswatch registers, an error code of \-1 is returned. 64*4bc66c0fSBrooks DavisThe 65*4bc66c0fSBrooks Davis.Fa watchaddr 66*4bc66c0fSBrooks Davisargument 67*4bc66c0fSBrooks Davisspecifies the watch address, 68*4bc66c0fSBrooks Davis.Fa size 69*4bc66c0fSBrooks Davisspecifies the size in bytes of the area to be watched (1, 2, or 4 bytes), 70*4bc66c0fSBrooks Davisand 71*4bc66c0fSBrooks Davis.Fa access 72*4bc66c0fSBrooks Davisspecifies the type of watch point: 73*4bc66c0fSBrooks Davis.Pp 74*4bc66c0fSBrooks Davis.Bd -literal -offset indent -compact 75*4bc66c0fSBrooks DavisDBREG_DR7_EXEC An execution breakpoint. 76*4bc66c0fSBrooks DavisDBREG_DR7_WRONLY Break only when the watch area is written to. 77*4bc66c0fSBrooks DavisDBREG_DR7_RDWR Break when the watch area is read from or written 78*4bc66c0fSBrooks Davis to. 79*4bc66c0fSBrooks Davis.Ed 80*4bc66c0fSBrooks Davis.Pp 81*4bc66c0fSBrooks DavisNote that these functions do not actually set or clear breakpoints; 82*4bc66c0fSBrooks Davisthey manipulate the indicated debug register set. 83*4bc66c0fSBrooks DavisYou must use 84*4bc66c0fSBrooks Davis.Xr ptrace 2 85*4bc66c0fSBrooks Davisto retrieve and install the debug register values for a process. 86*4bc66c0fSBrooks Davis.Sh RETURN VALUES 87*4bc66c0fSBrooks DavisOn success, the 88*4bc66c0fSBrooks Davis.Fn i386_clr_watch 89*4bc66c0fSBrooks Davisfunction returns 0. 90*4bc66c0fSBrooks DavisOn error, \-1 returned which indicates that 91*4bc66c0fSBrooks Davis.Fa watchnum 92*4bc66c0fSBrooks Davisis invalid (not in the range of 0-3). 93*4bc66c0fSBrooks DavisIf the specified watchnum was already disabled, no error is returned. 94*4bc66c0fSBrooks Davis.Pp 95*4bc66c0fSBrooks DavisOn success, the 96*4bc66c0fSBrooks Davis.Fn i386_set_watch 97*4bc66c0fSBrooks Davisfunction returns the 98*4bc66c0fSBrooks Davis.Fa watchnum 99*4bc66c0fSBrooks Davisargument, or the watchnum actually used in the case where the specified 100*4bc66c0fSBrooks Davis.Fa watchnum 101*4bc66c0fSBrooks Daviswas \-1. 102*4bc66c0fSBrooks DavisOn error, the 103*4bc66c0fSBrooks Davis.Fn i386_set_watch 104*4bc66c0fSBrooks Davisfunction returns \-1 indicating that the watchpoint could not established 105*4bc66c0fSBrooks Davisbecause either no more watchpoints are available, or 106*4bc66c0fSBrooks Davis.Fa watchnum , 107*4bc66c0fSBrooks Davis.Fa size , 108*4bc66c0fSBrooks Davisor 109*4bc66c0fSBrooks Davis.Fa access 110*4bc66c0fSBrooks Davisis invalid. 111*4bc66c0fSBrooks Davis.Sh SEE ALSO 112*4bc66c0fSBrooks Davis.Xr ptrace 2 , 113*4bc66c0fSBrooks Davis.Xr procfs 5 114*4bc66c0fSBrooks Davis.Sh AUTHORS 115*4bc66c0fSBrooks DavisThis man page was written by 116*4bc66c0fSBrooks Davis.An Brian S. Dean . 117