2000-09-21 17:07:27 +00:00
|
|
|
.\" Copyright (c) 2000 Brian S. Dean
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This man-page is based on a similar man-page by Jonathan Lemon
|
|
|
|
.\" which is copyrighted under the following conditions:
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
|
|
|
.Dd August 24, 2000
|
|
|
|
.Os
|
|
|
|
.Dt I386_SET_WATCH 3
|
|
|
|
.Sh NAME
|
|
|
|
.Nm i386_clr_watch ,
|
|
|
|
.Nm i386_set_watch
|
|
|
|
.Nd manage i386 debug register values
|
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In machine/reg.h
|
|
|
|
.In machine/sysarch.h
|
2000-09-21 17:07:27 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn i386_clr_watch "int watchnum" "struct dbreg *d"
|
|
|
|
.Ft int
|
|
|
|
.Fn i386_set_watch "int watchnum" "unsigned int watchaddr" "int size" "int access" "struct dbreg *d"
|
|
|
|
.Sh DESCRIPTION
|
2002-12-18 12:45:11 +00:00
|
|
|
The
|
2000-09-21 17:07:27 +00:00
|
|
|
.Fn i386_clr_watch
|
2002-12-18 12:45:11 +00:00
|
|
|
function
|
2000-09-21 17:07:27 +00:00
|
|
|
will disable the indicated watch point within the specified debug
|
|
|
|
register set.
|
|
|
|
.Pp
|
2002-12-18 12:45:11 +00:00
|
|
|
The
|
2000-09-21 17:07:27 +00:00
|
|
|
.Fn i386_set_watch
|
2002-12-18 12:45:11 +00:00
|
|
|
function
|
2000-09-21 17:07:27 +00:00
|
|
|
will set up the specified debug registers as indicated by the
|
2004-07-02 23:52:20 +00:00
|
|
|
arguments.
|
|
|
|
The
|
2000-09-21 17:07:27 +00:00
|
|
|
.Fa watchnum
|
2004-07-02 23:52:20 +00:00
|
|
|
argument specifies which watch register is used, 0, 1, 2, 3, or -1.
|
|
|
|
If
|
2000-09-21 17:07:27 +00:00
|
|
|
.Fa watchnum
|
2004-07-02 23:52:20 +00:00
|
|
|
is -1, a free watch register is found and used.
|
|
|
|
If there are no free
|
2001-07-15 07:53:42 +00:00
|
|
|
watch registers, an error code of -1 is returned.
|
2002-12-19 09:40:28 +00:00
|
|
|
The
|
|
|
|
.Fa watchaddr
|
|
|
|
argument
|
2001-07-15 07:53:42 +00:00
|
|
|
specifies the watch address,
|
2000-09-21 17:07:27 +00:00
|
|
|
.Fa size
|
|
|
|
specifies the size in bytes of the area to be watched (1, 2, or 4 bytes),
|
|
|
|
and
|
|
|
|
.Fa access
|
2002-12-27 12:15:40 +00:00
|
|
|
specifies the type of watch point:
|
2000-09-21 17:07:27 +00:00
|
|
|
.Pp
|
|
|
|
.Bd -literal -offset indent -compact
|
|
|
|
DBREG_DR7_EXEC An execution breakpoint.
|
|
|
|
DBREG_DR7_WRONLY Break only when the watch area is written to.
|
|
|
|
DBREG_DR7_RDWR Break when the watch area is read from or written
|
|
|
|
to.
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Note that these functions do not actually set or clear breakpoints;
|
2004-07-02 23:52:20 +00:00
|
|
|
they manipulate the indicated debug register set.
|
|
|
|
You must use
|
2000-09-21 17:07:27 +00:00
|
|
|
.Xr ptrace 2
|
|
|
|
to retrieve and install the debug register values for a process.
|
|
|
|
.Sh RETURN VALUES
|
2002-12-18 12:45:11 +00:00
|
|
|
The
|
2000-09-21 17:07:27 +00:00
|
|
|
.Fn i386_clr_watch
|
2002-12-18 12:45:11 +00:00
|
|
|
function
|
2000-09-21 17:07:27 +00:00
|
|
|
returns 0 on success, or -1 if
|
|
|
|
.Fa watchnum
|
|
|
|
is invalid (not in the range of 0-3).
|
|
|
|
.Pp
|
2002-12-18 12:45:11 +00:00
|
|
|
The
|
2000-09-21 17:07:27 +00:00
|
|
|
.Fn i386_set_watch
|
2002-12-18 12:45:11 +00:00
|
|
|
function
|
2000-09-21 17:07:27 +00:00
|
|
|
will return the
|
|
|
|
.Fa watchnum
|
|
|
|
argument, or the watchnum actually used in the case that
|
|
|
|
.Fa watchnum
|
2004-07-02 23:52:20 +00:00
|
|
|
is -1 on success.
|
|
|
|
On error,
|
2000-09-21 17:07:27 +00:00
|
|
|
.Fn i386_set_watch
|
|
|
|
will return -1 indicating that the watchpoint could not be set up
|
|
|
|
because either no more watchpoints are available, or
|
|
|
|
.Fa watchnum ,
|
|
|
|
.Fa size ,
|
|
|
|
or
|
|
|
|
.Fa access
|
|
|
|
is invalid.
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr ptrace 2 ,
|
|
|
|
.Xr procfs 5
|
|
|
|
.Sh AUTHORS
|
|
|
|
This man page was written by
|
|
|
|
.An Brian S. Dean .
|