Annotation of src/sys/sys/ptrace.h, Revision 1.40.10.1
1.40.10.1! yamt 1: /* $NetBSD: ptrace.h,v 1.40 2008/01/05 12:41:43 dsl Exp $ */
1.17 cgd 2:
1.1 cgd 3: /*-
1.15 cgd 4: * Copyright (c) 1984, 1993
5: * The Regents of the University of California. All rights reserved.
1.1 cgd 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.
1.32 agc 15: * 3. Neither the name of the University nor the names of its contributors
1.1 cgd 16: * may be used to endorse or promote products derived from this software
17: * without specific prior written permission.
18: *
19: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29: * SUCH DAMAGE.
30: *
1.16 cgd 31: * @(#)ptrace.h 8.2 (Berkeley) 1/4/94
1.1 cgd 32: */
33:
1.15 cgd 34: #ifndef _SYS_PTRACE_H_
35: #define _SYS_PTRACE_H_
1.1 cgd 36:
37: #define PT_TRACE_ME 0 /* child declares it's being traced */
38: #define PT_READ_I 1 /* read word in child's I space */
39: #define PT_READ_D 2 /* read word in child's D space */
40: #define PT_WRITE_I 4 /* write word in child's I space */
41: #define PT_WRITE_D 5 /* write word in child's D space */
42: #define PT_CONTINUE 7 /* continue the child */
43: #define PT_KILL 8 /* kill the child process */
1.8 cgd 44: #define PT_ATTACH 9 /* attach to running process */
45: #define PT_DETACH 10 /* detach from running process */
1.24 thorpej 46: #define PT_IO 11 /* do I/O to/from the stopped process */
1.27 christos 47: #define PT_DUMPCORE 12 /* make the child generate a core dump */
1.28 nathanw 48: #define PT_LWPINFO 13 /* get info about the LWP */
1.36 christos 49: #define PT_SYSCALL 14 /* stop on syscall entry/exit */
1.6 cgd 50: #define PT_FIRSTMACH 32 /* for machine-specific requests */
51: #include <machine/ptrace.h> /* machine-specific requests, if any */
1.24 thorpej 52:
53: /*
54: * Argument structure for PT_IO.
55: */
56: struct ptrace_io_desc {
57: int piod_op; /* I/O operation (see below) */
58: void *piod_offs; /* child offset */
59: void *piod_addr; /* parent offset */
60: size_t piod_len; /* request length (in)/actual count (out) */
61: };
62:
63: /* piod_op */
64: #define PIOD_READ_D 1 /* read from D space */
65: #define PIOD_WRITE_D 2 /* write to D spcae */
66: #define PIOD_READ_I 3 /* read from I space */
67: #define PIOD_WRITE_I 4 /* write to I space */
1.28 nathanw 68:
69: /*
70: * Argument structure for PT_LWPINFO.
71: */
72: struct ptrace_lwpinfo {
73: lwpid_t pl_lwpid; /* LWP described */
74: int pl_event; /* Event that stopped the LWP */
75: /* Add fields at the end */
76: };
77:
78: #define PL_EVENT_NONE 0
79: #define PL_EVENT_SIGNAL 1
1.6 cgd 80:
1.20 jtc 81: #ifdef _KERNEL
1.15 cgd 82:
1.6 cgd 83: #if defined(PT_GETREGS) || defined(PT_SETREGS)
84: struct reg;
1.37 cube 85: #ifndef process_reg32
86: #define process_reg32 struct reg
87: #endif
88: #ifndef process_reg64
89: #define process_reg64 struct reg
90: #endif
1.6 cgd 91: #endif
1.11 mycroft 92: #if defined(PT_GETFPREGS) || defined(PT_SETFPREGS)
93: struct fpreg;
1.37 cube 94: #ifndef process_fpreg32
95: #define process_fpreg32 struct fpreg
96: #endif
97: #ifndef process_fpreg64
98: #define process_fpreg64 struct fpreg
99: #endif
1.11 mycroft 100: #endif
1.25 thorpej 101:
1.40.10.1! yamt 102: void ptrace_init(void);
! 103:
1.35 christos 104: int process_doregs(struct lwp *, struct lwp *, struct uio *);
105: int process_validregs(struct lwp *);
1.25 thorpej 106:
1.35 christos 107: int process_dofpregs(struct lwp *, struct lwp *, struct uio *);
108: int process_validfpregs(struct lwp *);
1.25 thorpej 109:
1.35 christos 110: int process_domem(struct lwp *, struct lwp *, struct uio *);
1.15 cgd 111:
1.40 dsl 112: void process_stoptrace(void);
1.36 christos 113:
1.33 perry 114: void proc_reparent(struct proc *, struct proc *);
1.11 mycroft 115: #ifdef PT_GETFPREGS
1.40.10.1! yamt 116: #ifdef __HAVE_PROCESS_XFPREGS
! 117: int process_read_xfpregs(struct lwp *, struct fpreg *, size_t *);
! 118: #ifndef process_read_xfpregs32
! 119: #define process_read_xfpregs32 process_read_xfpregs
! 120: #endif
! 121: #ifndef process_read_xfpregs64
! 122: #define process_read_xfpregs64 process_read_xfpregs
! 123: #endif
! 124: #else
1.33 perry 125: int process_read_fpregs(struct lwp *, struct fpreg *);
1.37 cube 126: #ifndef process_read_fpregs32
127: #define process_read_fpregs32 process_read_fpregs
128: #endif
129: #ifndef process_read_fpregs64
130: #define process_read_fpregs64 process_read_fpregs
131: #endif
1.11 mycroft 132: #endif
1.40.10.1! yamt 133: #endif
1.15 cgd 134: #ifdef PT_GETREGS
1.33 perry 135: int process_read_regs(struct lwp *, struct reg *);
1.37 cube 136: #ifndef process_read_regs32
137: #define process_read_regs32 process_read_regs
138: #endif
139: #ifndef process_read_regs64
140: #define process_read_regs64 process_read_regs
141: #endif
1.15 cgd 142: #endif
1.39 christos 143: int process_set_pc(struct lwp *, void *);
1.33 perry 144: int process_sstep(struct lwp *, int);
1.11 mycroft 145: #ifdef PT_SETFPREGS
1.40.10.1! yamt 146: #ifdef __HAVE_PROCESS_XFPREGS
! 147: int process_write_xfpregs(struct lwp *, const struct fpreg *, size_t);
! 148: #else
1.34 scw 149: int process_write_fpregs(struct lwp *, const struct fpreg *);
1.6 cgd 150: #endif
1.40.10.1! yamt 151: #endif
1.15 cgd 152: #ifdef PT_SETREGS
1.34 scw 153: int process_write_regs(struct lwp *, const struct reg *);
1.23 thorpej 154: #endif
155:
156: #ifdef __HAVE_PROCFS_MACHDEP
1.35 christos 157: int ptrace_machdep_dorequest(struct lwp *, struct lwp *, int,
1.39 christos 158: void *, int);
1.15 cgd 159: #endif
1.6 cgd 160:
1.18 cgd 161: #ifndef FIX_SSTEP
162: #define FIX_SSTEP(p)
163: #endif
1.15 cgd 164:
1.20 jtc 165: #else /* !_KERNEL */
1.15 cgd 166:
1.1 cgd 167: #include <sys/cdefs.h>
168:
169: __BEGIN_DECLS
1.39 christos 170: int ptrace(int _request, pid_t _pid, void *_addr, int _data);
1.1 cgd 171: __END_DECLS
172:
1.20 jtc 173: #endif /* !_KERNEL */
1.15 cgd 174:
175: #endif /* !_SYS_PTRACE_H_ */
CVSweb <webmaster@jp.NetBSD.org>