14bc66c0fSBrooks Davis.\" Copyright (c) 2000 Brian S. Dean 24bc66c0fSBrooks Davis.\" All rights reserved. 34bc66c0fSBrooks Davis.\" 44bc66c0fSBrooks Davis.\" This man-page is based on a similar man-page by Jonathan Lemon 54bc66c0fSBrooks Davis.\" which is copyrighted under the following conditions: 64bc66c0fSBrooks Davis.\" 74bc66c0fSBrooks Davis.\" Redistribution and use in source and binary forms, with or without 84bc66c0fSBrooks Davis.\" modification, are permitted provided that the following conditions 94bc66c0fSBrooks Davis.\" are met: 104bc66c0fSBrooks Davis.\" 1. Redistributions of source code must retain the above copyright 114bc66c0fSBrooks Davis.\" notice, this list of conditions and the following disclaimer. 124bc66c0fSBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright 134bc66c0fSBrooks Davis.\" notice, this list of conditions and the following disclaimer in the 144bc66c0fSBrooks Davis.\" documentation and/or other materials provided with the distribution. 154bc66c0fSBrooks Davis.\" 164bc66c0fSBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 174bc66c0fSBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 184bc66c0fSBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 194bc66c0fSBrooks Davis.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 204bc66c0fSBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 214bc66c0fSBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 224bc66c0fSBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 234bc66c0fSBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 244bc66c0fSBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 254bc66c0fSBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 264bc66c0fSBrooks Davis.\" SUCH DAMAGE. 274bc66c0fSBrooks Davis.\" 284bc66c0fSBrooks Davis.Dd August 24, 2000 294bc66c0fSBrooks Davis.Dt I386_SET_WATCH 3 304bc66c0fSBrooks Davis.Os 314bc66c0fSBrooks Davis.Sh NAME 324bc66c0fSBrooks Davis.Nm i386_clr_watch , 334bc66c0fSBrooks Davis.Nm i386_set_watch 344bc66c0fSBrooks Davis.Nd manage i386 debug register values 354bc66c0fSBrooks Davis.Sh LIBRARY 364bc66c0fSBrooks Davis.Lb libc 374bc66c0fSBrooks Davis.Sh SYNOPSIS 384bc66c0fSBrooks Davis.In machine/reg.h 394bc66c0fSBrooks Davis.In machine/sysarch.h 404bc66c0fSBrooks Davis.Ft int 414bc66c0fSBrooks Davis.Fn i386_clr_watch "int watchnum" "struct dbreg *d" 424bc66c0fSBrooks Davis.Ft int 434bc66c0fSBrooks Davis.Fn i386_set_watch "int watchnum" "unsigned int watchaddr" "int size" "int access" "struct dbreg *d" 444bc66c0fSBrooks Davis.Sh DESCRIPTION 454bc66c0fSBrooks DavisThe 464bc66c0fSBrooks Davis.Fn i386_clr_watch 474bc66c0fSBrooks Davisfunction 484bc66c0fSBrooks Daviswill disable the indicated watch point within the specified debug 494bc66c0fSBrooks Davisregister set. 504bc66c0fSBrooks Davis.Pp 514bc66c0fSBrooks DavisThe 524bc66c0fSBrooks Davis.Fn i386_set_watch 534bc66c0fSBrooks Davisfunction 544bc66c0fSBrooks Daviswill set up the specified debug registers as indicated by the 554bc66c0fSBrooks Davisarguments. 564bc66c0fSBrooks DavisThe 574bc66c0fSBrooks Davis.Fa watchnum 584bc66c0fSBrooks Davisargument specifies which watch register is used, 0, 1, 2, 3, or \-1. 594bc66c0fSBrooks DavisIf 604bc66c0fSBrooks Davis.Fa watchnum 614bc66c0fSBrooks Davisis \-1, a free watch register is found and used. 624bc66c0fSBrooks DavisIf there are no free 634bc66c0fSBrooks Daviswatch registers, an error code of \-1 is returned. 644bc66c0fSBrooks DavisThe 654bc66c0fSBrooks Davis.Fa watchaddr 664bc66c0fSBrooks Davisargument 674bc66c0fSBrooks Davisspecifies the watch address, 684bc66c0fSBrooks Davis.Fa size 694bc66c0fSBrooks Davisspecifies the size in bytes of the area to be watched (1, 2, or 4 bytes), 704bc66c0fSBrooks Davisand 714bc66c0fSBrooks Davis.Fa access 724bc66c0fSBrooks Davisspecifies the type of watch point: 734bc66c0fSBrooks Davis.Pp 744bc66c0fSBrooks Davis.Bd -literal -offset indent -compact 754bc66c0fSBrooks DavisDBREG_DR7_EXEC An execution breakpoint. 764bc66c0fSBrooks DavisDBREG_DR7_WRONLY Break only when the watch area is written to. 774bc66c0fSBrooks DavisDBREG_DR7_RDWR Break when the watch area is read from or written 784bc66c0fSBrooks Davis to. 794bc66c0fSBrooks Davis.Ed 804bc66c0fSBrooks Davis.Pp 814bc66c0fSBrooks DavisNote that these functions do not actually set or clear breakpoints; 824bc66c0fSBrooks Davisthey manipulate the indicated debug register set. 834bc66c0fSBrooks DavisYou must use 844bc66c0fSBrooks Davis.Xr ptrace 2 854bc66c0fSBrooks Davisto retrieve and install the debug register values for a process. 864bc66c0fSBrooks Davis.Sh RETURN VALUES 874bc66c0fSBrooks DavisOn success, the 884bc66c0fSBrooks Davis.Fn i386_clr_watch 894bc66c0fSBrooks Davisfunction returns 0. 904bc66c0fSBrooks DavisOn error, \-1 returned which indicates that 914bc66c0fSBrooks Davis.Fa watchnum 924bc66c0fSBrooks Davisis invalid (not in the range of 0-3). 934bc66c0fSBrooks DavisIf the specified watchnum was already disabled, no error is returned. 944bc66c0fSBrooks Davis.Pp 954bc66c0fSBrooks DavisOn success, the 964bc66c0fSBrooks Davis.Fn i386_set_watch 974bc66c0fSBrooks Davisfunction returns the 984bc66c0fSBrooks Davis.Fa watchnum 994bc66c0fSBrooks Davisargument, or the watchnum actually used in the case where the specified 1004bc66c0fSBrooks Davis.Fa watchnum 1014bc66c0fSBrooks Daviswas \-1. 1024bc66c0fSBrooks DavisOn error, the 1034bc66c0fSBrooks Davis.Fn i386_set_watch 1044bc66c0fSBrooks Davisfunction returns \-1 indicating that the watchpoint could not established 1054bc66c0fSBrooks Davisbecause either no more watchpoints are available, or 1064bc66c0fSBrooks Davis.Fa watchnum , 1074bc66c0fSBrooks Davis.Fa size , 1084bc66c0fSBrooks Davisor 1094bc66c0fSBrooks Davis.Fa access 1104bc66c0fSBrooks Davisis invalid. 1114bc66c0fSBrooks Davis.Sh SEE ALSO 1124bc66c0fSBrooks Davis.Xr ptrace 2 , 113*1a720cbeSAlexander Ziaee.Xr procfs 4 1144bc66c0fSBrooks Davis.Sh AUTHORS 1154bc66c0fSBrooks DavisThis man page was written by 1164bc66c0fSBrooks Davis.An Brian S. Dean . 117