1 /* `ptrace' debugger support interface. Linux version,
2 not architecture-specific.
3 Copyright (C) 1996-2023 Free Software Foundation, Inc.
5 This file is part of the GNU C Library.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, see
19 <https://www.gnu.org/licenses/>. */
22 # error "Never use <bits/ptrace-shared.h> directly; include <sys/ptrace.h> instead."
25 /* Options set using PTRACE_SETOPTIONS. */
26 enum __ptrace_setoptions
28 PTRACE_O_TRACESYSGOOD
= 0x00000001,
29 PTRACE_O_TRACEFORK
= 0x00000002,
30 PTRACE_O_TRACEVFORK
= 0x00000004,
31 PTRACE_O_TRACECLONE
= 0x00000008,
32 PTRACE_O_TRACEEXEC
= 0x00000010,
33 PTRACE_O_TRACEVFORKDONE
= 0x00000020,
34 PTRACE_O_TRACEEXIT
= 0x00000040,
35 PTRACE_O_TRACESECCOMP
= 0x00000080,
36 PTRACE_O_EXITKILL
= 0x00100000,
37 PTRACE_O_SUSPEND_SECCOMP
= 0x00200000,
38 PTRACE_O_MASK
= 0x003000ff
41 enum __ptrace_eventcodes
43 /* Wait extended result codes for the above trace options. */
44 PTRACE_EVENT_FORK
= 1,
45 PTRACE_EVENT_VFORK
= 2,
46 PTRACE_EVENT_CLONE
= 3,
47 PTRACE_EVENT_EXEC
= 4,
48 PTRACE_EVENT_VFORK_DONE
= 5,
49 PTRACE_EVENT_EXIT
= 6,
50 PTRACE_EVENT_SECCOMP
= 7,
51 /* Extended result codes enabled by means other than options. */
52 PTRACE_EVENT_STOP
= 128
55 /* Type of stop for PTRACE_GET_SYSCALL_INFO. */
56 enum __ptrace_get_syscall_info_op
58 PTRACE_SYSCALL_INFO_NONE
= 0,
59 PTRACE_SYSCALL_INFO_ENTRY
= 1,
60 PTRACE_SYSCALL_INFO_EXIT
= 2,
61 PTRACE_SYSCALL_INFO_SECCOMP
= 3
64 /* Arguments for PTRACE_PEEKSIGINFO. */
65 struct __ptrace_peeksiginfo_args
67 __uint64_t off
; /* From which siginfo to start. */
68 __uint32_t flags
; /* Flags for peeksiginfo. */
69 __int32_t nr
; /* How many siginfos to take. */
72 enum __ptrace_peeksiginfo_flags
74 /* Read signals from a shared (process wide) queue. */
75 PTRACE_PEEKSIGINFO_SHARED
= (1 << 0)
78 /* Argument and results of PTRACE_SECCOMP_GET_METADATA. */
79 struct __ptrace_seccomp_metadata
81 __uint64_t filter_off
; /* Input: which filter. */
82 __uint64_t flags
; /* Output: filter's flags. */
85 /* Results of PTRACE_GET_SYSCALL_INFO. */
86 struct __ptrace_syscall_info
88 __uint8_t op
; /* One of the enum
89 __ptrace_get_syscall_info_op
91 __uint32_t arch
__attribute__ ((__aligned__ (4))); /* AUDIT_ARCH_*
93 __uint64_t instruction_pointer
; /* Instruction pointer. */
94 __uint64_t stack_pointer
; /* Stack pointer. */
97 /* System call number and arguments, for
98 PTRACE_SYSCALL_INFO_ENTRY. */
104 /* System call return value and error flag, for
105 PTRACE_SYSCALL_INFO_EXIT. */
111 /* System call number, arguments and SECCOMP_RET_DATA portion of
112 SECCOMP_RET_TRACE return value, for
113 PTRACE_SYSCALL_INFO_SECCOMP. */
123 /* Results of PTRACE_GET_RSEQ_CONFIGURATION. */
124 struct __ptrace_rseq_configuration
126 __uint64_t rseq_abi_pointer
;
127 __uint32_t rseq_abi_size
;
128 __uint32_t signature
;
133 /* Perform process tracing functions. REQUEST is one of the values
134 above, and determines the action to be taken.
135 For all requests except PTRACE_TRACEME, PID specifies the process to be
138 PID and the other arguments described above for the various requests should
139 appear (those that are used for the particular request) as:
140 pid_t PID, void *ADDR, int DATA, void *ADDR2
142 extern long int ptrace (enum __ptrace_request __request
, ...) __THROW
;