1 #ifndef _LINUX_PTRACE_H
2 #define _LINUX_PTRACE_H
4 #include <linux/compiler.h>
5 #include <linux/sched.h>
18 #define PT_SEIZED 0x00010000
19 #define PT_PTRACED 0x00000001
20 #define PT_DTRACE 0x00000002
21 #define PT_PTRACE_CAP 0x00000004
23 #define PT_OPT_FLAG_SHIFT 3
25 #define PT_EVENT_FLAG(event) (1 << (PT_OPT_FLAG_SHIFT + (event)))
26 #define PT_TRACESYSGOOD PT_EVENT_FLAG(0)
27 #define PT_TRACE_FORK PT_EVENT_FLAG(PTRACE_EVENT_FORK)
28 #define PT_TRACE_VFORK PT_EVENT_FLAG(PTRACE_EVENT_VFORK)
29 #define PT_TRACE_CLONE PT_EVENT_FLAG(PTRACE_EVENT_CLONE)
30 #define PT_TRACE_EXEC PT_EVENT_FLAG(PTRACE_EVENT_EXEC)
31 #define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE)
32 #define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT)
33 #define PT_TRACE_SECCOMP PT_EVENT_FLAG(PTRACE_EVENT_SECCOMP)
36 #define PT_SINGLESTEP_BIT 31
37 #define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT)
38 #define PT_BLOCKSTEP_BIT 30
39 #define PT_BLOCKSTEP (1<<PT_BLOCKSTEP_BIT)
42 unsigned long addr,
unsigned long data);
48 unsigned long addr,
unsigned long data);
54 #define PTRACE_MODE_READ 0x01
55 #define PTRACE_MODE_ATTACH 0x02
56 #define PTRACE_MODE_NOAUDIT 0x04
103 static inline bool ptrace_event_enabled(
struct task_struct *task,
int event)
118 static inline void ptrace_event(
int event,
unsigned long message)
143 INIT_LIST_HEAD(&child->
ptraced);
144 #ifdef CONFIG_HAVE_HW_BREAKPOINT
170 static inline void ptrace_release_task(
struct task_struct *task)
177 #ifndef force_successful_syscall_return
189 #define force_successful_syscall_return() do { } while (0)
192 #ifndef is_syscall_success
198 #define is_syscall_success(regs) (!IS_ERR_VALUE((unsigned long)(regs_return_value(regs))))
209 #ifndef arch_has_single_step
219 #define arch_has_single_step() (0)
252 #ifndef arch_has_block_step
262 #define arch_has_block_step() (0)
281 #ifdef ARCH_HAS_USER_SINGLE_STEP_INFO
288 memset(info, 0,
sizeof(*info));
293 #ifndef arch_ptrace_stop_needed
308 #define arch_ptrace_stop_needed(code, info) (0)
311 #ifndef arch_ptrace_stop
325 #define arch_ptrace_stop(code, info) do { } while (0)
328 #ifndef current_pt_regs
329 #define current_pt_regs() task_pt_regs(current)
333 unsigned long args[6],
unsigned int maxargs,
334 unsigned long *
sp,
unsigned long *
pc);
336 #ifdef CONFIG_HAVE_HW_BREAKPOINT
337 extern int ptrace_get_breakpoints(
struct task_struct *tsk);
338 extern void ptrace_put_breakpoints(
struct task_struct *tsk);
340 static inline void ptrace_put_breakpoints(
struct task_struct *tsk) { }