FreeBSD/Linux Kernel Cross Reference
sys/sys/ptrace.h
1 /* $NetBSD: ptrace.h,v 1.40 2008/01/05 12:41:43 dsl Exp $ */
2
3 /*-
4 * Copyright (c) 1984, 1993
5 * The Regents of the University of California. All rights reserved.
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 * 3. Neither the name of the University nor the names of its contributors
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 *
31 * @(#)ptrace.h 8.2 (Berkeley) 1/4/94
32 */
33
34 #ifndef _SYS_PTRACE_H_
35 #define _SYS_PTRACE_H_
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 */
44 #define PT_ATTACH 9 /* attach to running process */
45 #define PT_DETACH 10 /* detach from running process */
46 #define PT_IO 11 /* do I/O to/from the stopped process */
47 #define PT_DUMPCORE 12 /* make the child generate a core dump */
48 #define PT_LWPINFO 13 /* get info about the LWP */
49 #define PT_SYSCALL 14 /* stop on syscall entry/exit */
50 #define PT_FIRSTMACH 32 /* for machine-specific requests */
51 #include <machine/ptrace.h> /* machine-specific requests, if any */
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 */
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
80
81 #ifdef _KERNEL
82
83 #if defined(PT_GETREGS) || defined(PT_SETREGS)
84 struct reg;
85 #ifndef process_reg32
86 #define process_reg32 struct reg
87 #endif
88 #ifndef process_reg64
89 #define process_reg64 struct reg
90 #endif
91 #endif
92 #if defined(PT_GETFPREGS) || defined(PT_SETFPREGS)
93 struct fpreg;
94 #ifndef process_fpreg32
95 #define process_fpreg32 struct fpreg
96 #endif
97 #ifndef process_fpreg64
98 #define process_fpreg64 struct fpreg
99 #endif
100 #endif
101
102 int process_doregs(struct lwp *, struct lwp *, struct uio *);
103 int process_validregs(struct lwp *);
104
105 int process_dofpregs(struct lwp *, struct lwp *, struct uio *);
106 int process_validfpregs(struct lwp *);
107
108 int process_domem(struct lwp *, struct lwp *, struct uio *);
109
110 void process_stoptrace(void);
111
112 void proc_reparent(struct proc *, struct proc *);
113 #ifdef PT_GETFPREGS
114 int process_read_fpregs(struct lwp *, struct fpreg *);
115 #ifndef process_read_fpregs32
116 #define process_read_fpregs32 process_read_fpregs
117 #endif
118 #ifndef process_read_fpregs64
119 #define process_read_fpregs64 process_read_fpregs
120 #endif
121 #endif
122 #ifdef PT_GETREGS
123 int process_read_regs(struct lwp *, struct reg *);
124 #ifndef process_read_regs32
125 #define process_read_regs32 process_read_regs
126 #endif
127 #ifndef process_read_regs64
128 #define process_read_regs64 process_read_regs
129 #endif
130 #endif
131 int process_set_pc(struct lwp *, void *);
132 int process_sstep(struct lwp *, int);
133 #ifdef PT_SETFPREGS
134 int process_write_fpregs(struct lwp *, const struct fpreg *);
135 #endif
136 #ifdef PT_SETREGS
137 int process_write_regs(struct lwp *, const struct reg *);
138 #endif
139
140 #ifdef __HAVE_PROCFS_MACHDEP
141 int ptrace_machdep_dorequest(struct lwp *, struct lwp *, int,
142 void *, int);
143 #endif
144
145 #ifndef FIX_SSTEP
146 #define FIX_SSTEP(p)
147 #endif
148
149 #else /* !_KERNEL */
150
151 #include <sys/cdefs.h>
152
153 __BEGIN_DECLS
154 int ptrace(int _request, pid_t _pid, void *_addr, int _data);
155 __END_DECLS
156
157 #endif /* !_KERNEL */
158
159 #endif /* !_SYS_PTRACE_H_ */
Cache object: 483462751d1c74f70d996906b70ad77a
|