ptrace.h revision 92383
1251881Speter/*- 2251881Speter * Copyright (c) 1984, 1993 3251881Speter * The Regents of the University of California. All rights reserved. 4251881Speter * 5251881Speter * Redistribution and use in source and binary forms, with or without 6251881Speter * modification, are permitted provided that the following conditions 7251881Speter * are met: 8251881Speter * 1. Redistributions of source code must retain the above copyright 9251881Speter * notice, this list of conditions and the following disclaimer. 10251881Speter * 2. Redistributions in binary form must reproduce the above copyright 11251881Speter * notice, this list of conditions and the following disclaimer in the 12251881Speter * documentation and/or other materials provided with the distribution. 13251881Speter * 3. All advertising materials mentioning features or use of this software 14251881Speter * must display the following acknowledgement: 15251881Speter * This product includes software developed by the University of 16251881Speter * California, Berkeley and its contributors. 17251881Speter * 4. Neither the name of the University nor the names of its contributors 18251881Speter * may be used to endorse or promote products derived from this software 19251881Speter * without specific prior written permission. 20251881Speter * 21251881Speter * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22251881Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23251881Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24251881Speter * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25251881Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26251881Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27251881Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28251881Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29251881Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30251881Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31251881Speter * SUCH DAMAGE. 32251881Speter * 33251881Speter * @(#)ptrace.h 8.2 (Berkeley) 1/4/94 34251881Speter * $FreeBSD: head/sys/sys/ptrace.h 92383 2002-03-16 00:25:53Z des $ 35251881Speter */ 36251881Speter 37251881Speter#ifndef _SYS_PTRACE_H_ 38251881Speter#define _SYS_PTRACE_H_ 39251881Speter 40251881Speter#define PT_TRACE_ME 0 /* child declares it's being traced */ 41251881Speter#define PT_READ_I 1 /* read word in child's I space */ 42251881Speter#define PT_READ_D 2 /* read word in child's D space */ 43251881Speter/* was PT_READ_U 3 * read word in child's user structure */ 44251881Speter#define PT_WRITE_I 4 /* write word in child's I space */ 45251881Speter#define PT_WRITE_D 5 /* write word in child's D space */ 46251881Speter/* was PT_WRITE_U 6 * write word in child's user structure */ 47251881Speter#define PT_CONTINUE 7 /* continue the child */ 48251881Speter#define PT_KILL 8 /* kill the child process */ 49251881Speter#define PT_STEP 9 /* single step the child */ 50251881Speter 51251881Speter#define PT_ATTACH 10 /* trace some running process */ 52251881Speter#define PT_DETACH 11 /* stop tracing a process */ 53251881Speter 54251881Speter#define PT_GETREGS 33 /* get general-purpose registers */ 55251881Speter#define PT_SETREGS 34 /* set general-purpose registers */ 56251881Speter#define PT_GETFPREGS 35 /* get floating-point registers */ 57251881Speter#define PT_SETFPREGS 36 /* set floating-point registers */ 58251881Speter#define PT_GETDBREGS 37 /* get debugging registers */ 59251881Speter#define PT_SETDBREGS 38 /* set debugging registers */ 60251881Speter 61251881Speter#define PT_FIRSTMACH 64 /* for machine-specific requests */ 62251881Speter#include <machine/ptrace.h> /* machine-specific requests, if any */ 63251881Speter 64251881Speter#ifdef _KERNEL 65251881Speterint ptrace_set_pc(struct thread *_td, unsigned long _addr); 66251881Speterint ptrace_single_step(struct thread *_td); 67251881Speter 68251881Speter/* 69251881Speter * These are prototypes for functions that implement some of the 70251881Speter * debugging functionality exported by procfs / linprocfs and by the 71251881Speter * ptrace(2) syscall. They used to be part of procfs, but they don't 72251881Speter * really belong there. 73251881Speter */ 74251881Speterstruct reg; 75251881Speterstruct fpreg; 76251881Speterstruct dbreg; 77251881Speterstruct uio; 78251881Speterint proc_read_regs(struct thread *_td, struct reg *_reg); 79251881Speterint proc_write_regs(struct thread *_td, struct reg *_reg); 80251881Speterint proc_read_fpregs(struct thread *_td, struct fpreg *_fpreg); 81251881Speterint proc_write_fpregs(struct thread *_td, struct fpreg *_fpreg); 82251881Speterint proc_read_dbregs(struct thread *_td, struct dbreg *_dbreg); 83251881Speterint proc_write_dbregs(struct thread *_td, struct dbreg *_dbreg); 84251881Speterint proc_sstep(struct thread *_td); 85251881Speterint proc_rwmem(struct proc *_p, struct uio *_uio); 86251881Speter#else /* !_KERNEL */ 87251881Speter 88251881Speter#include <sys/cdefs.h> 89251881Speter 90251881Speter__BEGIN_DECLS 91251881Speterint ptrace(int _request, pid_t _pid, caddr_t _addr, int _data); 92251881Speter__END_DECLS 93251881Speter 94251881Speter#endif /* !_KERNEL */ 95251881Speter 96251881Speter#endif /* !_SYS_PTRACE_H_ */ 97251881Speter