FreeBSD/Linux Kernel Cross Reference
sys/sys/ptrace.h
1 /* $NetBSD: ptrace.h,v 1.32 2003/08/07 16:34:11 agc 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_FIRSTMACH 32 /* for machine-specific requests */
50 #include <machine/ptrace.h> /* machine-specific requests, if any */
51
52 /*
53 * Argument structure for PT_IO.
54 */
55 struct ptrace_io_desc {
56 int piod_op; /* I/O operation (see below) */
57 void *piod_offs; /* child offset */
58 void *piod_addr; /* parent offset */
59 size_t piod_len; /* request length (in)/actual count (out) */
60 };
61
62 /* piod_op */
63 #define PIOD_READ_D 1 /* read from D space */
64 #define PIOD_WRITE_D 2 /* write to D spcae */
65 #define PIOD_READ_I 3 /* read from I space */
66 #define PIOD_WRITE_I 4 /* write to I space */
67
68 /*
69 * Argument structure for PT_LWPINFO.
70 */
71 struct ptrace_lwpinfo {
72 lwpid_t pl_lwpid; /* LWP described */
73 int pl_event; /* Event that stopped the LWP */
74 /* Add fields at the end */
75 };
76
77 #define PL_EVENT_NONE 0
78 #define PL_EVENT_SIGNAL 1
79
80 #ifdef _KERNEL
81
82 #if defined(PT_GETREGS) || defined(PT_SETREGS)
83 struct reg;
84 #endif
85 #if defined(PT_GETFPREGS) || defined(PT_SETFPREGS)
86 struct fpreg;
87 #endif
88
89 int process_doregs __P((struct proc *, struct lwp *, struct uio *));
90 int process_validregs __P((struct proc *));
91
92 int process_dofpregs __P((struct proc *, struct lwp *, struct uio *));
93 int process_validfpregs __P((struct proc *));
94
95 int process_domem __P((struct proc *, struct proc *, struct uio *));
96 int process_checkioperm __P((struct proc *, struct proc *));
97
98 void proc_reparent __P((struct proc *, struct proc *));
99 #ifdef PT_GETFPREGS
100 int process_read_fpregs __P((struct lwp *, struct fpreg *));
101 #endif
102 #ifdef PT_GETREGS
103 int process_read_regs __P((struct lwp *, struct reg *));
104 #endif
105 int process_set_pc __P((struct lwp *, caddr_t));
106 int process_sstep __P((struct lwp *, int));
107 #ifdef PT_SETFPREGS
108 int process_write_fpregs __P((struct lwp *, struct fpreg *));
109 #endif
110 #ifdef PT_SETREGS
111 int process_write_regs __P((struct lwp *, struct reg *));
112 #endif
113
114 #ifdef __HAVE_PROCFS_MACHDEP
115 int ptrace_machdep_dorequest(struct proc *, struct lwp *, int,
116 caddr_t, int);
117 #endif
118
119 #ifndef FIX_SSTEP
120 #define FIX_SSTEP(p)
121 #endif
122
123 #else /* !_KERNEL */
124
125 #include <sys/cdefs.h>
126
127 __BEGIN_DECLS
128 int ptrace __P((int _request, pid_t _pid, caddr_t _addr, int _data));
129 __END_DECLS
130
131 #endif /* !_KERNEL */
132
133 #endif /* !_SYS_PTRACE_H_ */
Cache object: 31947edeb20ca58adf022c5ab5e05685
|