ptrace.h revision 84637
1219974Smav/*- 2219974Smav * Copyright (c) 1984, 1993 3235092Smav * The Regents of the University of California. All rights reserved. 4219974Smav * 5219974Smav * Redistribution and use in source and binary forms, with or without 6219974Smav * modification, are permitted provided that the following conditions 7219974Smav * are met: 8219974Smav * 1. Redistributions of source code must retain the above copyright 9219974Smav * notice, this list of conditions and the following disclaimer. 10219974Smav * 2. Redistributions in binary form must reproduce the above copyright 11219974Smav * notice, this list of conditions and the following disclaimer in the 12219974Smav * documentation and/or other materials provided with the distribution. 13219974Smav * 3. All advertising materials mentioning features or use of this software 14219974Smav * must display the following acknowledgement: 15219974Smav * This product includes software developed by the University of 16219974Smav * California, Berkeley and its contributors. 17219974Smav * 4. Neither the name of the University nor the names of its contributors 18219974Smav * may be used to endorse or promote products derived from this software 19219974Smav * without specific prior written permission. 20219974Smav * 21219974Smav * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22219974Smav * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23219974Smav * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24219974Smav * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25219974Smav * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26219974Smav * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27219974Smav * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28219974Smav * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29219974Smav * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30219974Smav * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31219974Smav * SUCH DAMAGE. 32219974Smav * 33219974Smav * @(#)ptrace.h 8.2 (Berkeley) 1/4/94 34219974Smav * $FreeBSD: head/sys/sys/ptrace.h 84637 2001-10-07 20:08:42Z des $ 35219974Smav */ 36219974Smav 37219974Smav#ifndef _SYS_PTRACE_H_ 38219974Smav#define _SYS_PTRACE_H_ 39219974Smav 40219974Smav#define PT_TRACE_ME 0 /* child declares it's being traced */ 41219974Smav#define PT_READ_I 1 /* read word in child's I space */ 42219974Smav#define PT_READ_D 2 /* read word in child's D space */ 43219974Smav/* was PT_READ_U 3 * read word in child's user structure */ 44219974Smav#define PT_WRITE_I 4 /* write word in child's I space */ 45219974Smav#define PT_WRITE_D 5 /* write word in child's D space */ 46219974Smav/* was PT_WRITE_U 6 * write word in child's user structure */ 47219974Smav#define PT_CONTINUE 7 /* continue the child */ 48219974Smav#define PT_KILL 8 /* kill the child process */ 49219974Smav#define PT_STEP 9 /* single step the child */ 50219974Smav 51219974Smav#define PT_ATTACH 10 /* trace some running process */ 52219974Smav#define PT_DETACH 11 /* stop tracing a process */ 53219974Smav 54219974Smav#define PT_FIRSTMACH 32 /* for machine-specific requests */ 55219974Smav#include <machine/ptrace.h> /* machine-specific requests, if any */ 56219974Smav 57219974Smav#ifdef _KERNEL 58219974Smavint ptrace_set_pc(struct thread *_td, unsigned long _addr); 59219974Smavint ptrace_single_step(struct thread *_td); 60219974Smav 61219974Smav/* 62219974Smav * These are prototypes for functions that implement some of the 63219974Smav * debugging functionality exported by procfs / linprocfs and by the 64219974Smav * ptrace(2) syscall. They used to be part of procfs, but they don't 65219974Smav * really belong there. 66219974Smav */ 67219974Smavstruct reg; 68230244Sjimharrisstruct fpreg; 69230244Sjimharrisstruct dbreg; 70230244Sjimharrisint procfs_read_regs(struct thread *_td, struct reg *_reg); 71230244Sjimharrisint procfs_write_regs(struct thread *_td, struct reg *_reg); 72219974Smavint procfs_read_fpregs(struct thread *_td, struct fpreg *_fpreg); 73219974Smavint procfs_write_fpregs(struct thread *_td, struct fpreg *_fpreg); 74219974Smavint procfs_read_dbregs(struct thread *_td, struct dbreg *_dbreg); 75219974Smavint procfs_write_dbregs(struct thread *_td, struct dbreg *_dbreg); 76219974Smavint procfs_sstep(struct thread *_td); 77219974Smavint proc_rwmem(struct proc *_p, struct uio *_uio); 78219974Smav#else /* !_KERNEL */ 79219974Smav 80219974Smav#include <sys/cdefs.h> 81219974Smav 82219974Smav__BEGIN_DECLS 83219974Smavint ptrace(int _request, pid_t _pid, caddr_t _addr, int _data); 84219974Smav__END_DECLS 85219974Smav 86219974Smav#endif /* !_KERNEL */ 87219974Smav 88219974Smav#endif /* !_SYS_PTRACE_H_ */ 89219974Smav