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