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