1 |
13 |
serginhofr |
#ifndef _LINUX_PTRACE_H
|
2 |
|
|
#define _LINUX_PTRACE_H
|
3 |
|
|
/* ptrace.h */
|
4 |
|
|
/* structs and defines to help the user use the ptrace system call. */
|
5 |
|
|
|
6 |
|
|
/* has the defines to get at the registers. */
|
7 |
|
|
|
8 |
|
|
#include <linux/types.h>
|
9 |
|
|
|
10 |
|
|
#define PTRACE_TRACEME 0
|
11 |
|
|
#define PTRACE_PEEKTEXT 1
|
12 |
|
|
#define PTRACE_PEEKDATA 2
|
13 |
|
|
#define PTRACE_PEEKUSR 3
|
14 |
|
|
#define PTRACE_POKETEXT 4
|
15 |
|
|
#define PTRACE_POKEDATA 5
|
16 |
|
|
#define PTRACE_POKEUSR 6
|
17 |
|
|
#define PTRACE_CONT 7
|
18 |
|
|
#define PTRACE_KILL 8
|
19 |
|
|
#define PTRACE_SINGLESTEP 9
|
20 |
|
|
|
21 |
|
|
#define PTRACE_ATTACH 16
|
22 |
|
|
#define PTRACE_DETACH 17
|
23 |
|
|
|
24 |
|
|
#define PTRACE_SYSCALL 24
|
25 |
|
|
|
26 |
|
|
/* 0x4200-0x4300 are reserved for architecture-independent additions. */
|
27 |
|
|
#define PTRACE_SETOPTIONS 0x4200
|
28 |
|
|
#define PTRACE_GETEVENTMSG 0x4201
|
29 |
|
|
#define PTRACE_GETSIGINFO 0x4202
|
30 |
|
|
#define PTRACE_SETSIGINFO 0x4203
|
31 |
|
|
|
32 |
|
|
/*
|
33 |
|
|
* Generic ptrace interface that exports the architecture specific regsets
|
34 |
|
|
* using the corresponding NT_* types (which are also used in the core dump).
|
35 |
|
|
* Please note that the NT_PRSTATUS note type in a core dump contains a full
|
36 |
|
|
* 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the
|
37 |
|
|
* elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the
|
38 |
|
|
* other user_regset flavors, the user_regset layout and the ELF core dump note
|
39 |
|
|
* payload are exactly the same layout.
|
40 |
|
|
*
|
41 |
|
|
* This interface usage is as follows:
|
42 |
|
|
* struct iovec iov = { buf, len};
|
43 |
|
|
*
|
44 |
|
|
* ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov);
|
45 |
|
|
*
|
46 |
|
|
* On the successful completion, iov.len will be updated by the kernel,
|
47 |
|
|
* specifying how much the kernel has written/read to/from the user's iov.buf.
|
48 |
|
|
*/
|
49 |
|
|
#define PTRACE_GETREGSET 0x4204
|
50 |
|
|
#define PTRACE_SETREGSET 0x4205
|
51 |
|
|
|
52 |
|
|
#define PTRACE_SEIZE 0x4206
|
53 |
|
|
#define PTRACE_INTERRUPT 0x4207
|
54 |
|
|
#define PTRACE_LISTEN 0x4208
|
55 |
|
|
|
56 |
|
|
#define PTRACE_PEEKSIGINFO 0x4209
|
57 |
|
|
|
58 |
|
|
struct ptrace_peeksiginfo_args {
|
59 |
|
|
__u64 off; /* from which siginfo to start */
|
60 |
|
|
__u32 flags;
|
61 |
|
|
__s32 nr; /* how may siginfos to take */
|
62 |
|
|
};
|
63 |
|
|
|
64 |
|
|
#define PTRACE_GETSIGMASK 0x420a
|
65 |
|
|
#define PTRACE_SETSIGMASK 0x420b
|
66 |
|
|
|
67 |
|
|
/* Read signals from a shared (process wide) queue */
|
68 |
|
|
#define PTRACE_PEEKSIGINFO_SHARED (1 << 0)
|
69 |
|
|
|
70 |
|
|
/* Wait extended result codes for the above trace options. */
|
71 |
|
|
#define PTRACE_EVENT_FORK 1
|
72 |
|
|
#define PTRACE_EVENT_VFORK 2
|
73 |
|
|
#define PTRACE_EVENT_CLONE 3
|
74 |
|
|
#define PTRACE_EVENT_EXEC 4
|
75 |
|
|
#define PTRACE_EVENT_VFORK_DONE 5
|
76 |
|
|
#define PTRACE_EVENT_EXIT 6
|
77 |
|
|
#define PTRACE_EVENT_SECCOMP 7
|
78 |
|
|
/* Extended result codes which enabled by means other than options. */
|
79 |
|
|
#define PTRACE_EVENT_STOP 128
|
80 |
|
|
|
81 |
|
|
/* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */
|
82 |
|
|
#define PTRACE_O_TRACESYSGOOD 1
|
83 |
|
|
#define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
|
84 |
|
|
#define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
|
85 |
|
|
#define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
|
86 |
|
|
#define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
|
87 |
|
|
#define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
|
88 |
|
|
#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
|
89 |
|
|
#define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
|
90 |
|
|
|
91 |
|
|
/* eventless options */
|
92 |
|
|
#define PTRACE_O_EXITKILL (1 << 20)
|
93 |
|
|
|
94 |
|
|
#define PTRACE_O_MASK (0x000000ff | PTRACE_O_EXITKILL)
|
95 |
|
|
|
96 |
|
|
#include <asm/ptrace.h>
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
#endif /* _LINUX_PTRACE_H */
|