aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/ptrace.h
blob: def3b6184a7962756c11ec849d68d962b2f98567 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 *  linux/arch/arm/kernel/ptrace.h
 *
 *  Copyright (C) 2000-2003 Russell King
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#include <linux/ptrace.h>

extern void ptrace_cancel_bpt(struct task_struct *);
extern void ptrace_set_bpt(struct task_struct *);
extern void ptrace_break(struct task_struct *, struct pt_regs *);

/*
 * make sure single-step breakpoint is gone.
 */
static inline void single_step_disable(struct task_struct *task)
{
	task->ptrace &= ~PT_SINGLESTEP;
	ptrace_cancel_bpt(task);
}

static inline void single_step_enable(struct task_struct *task)
{
	task->ptrace |= PT_SINGLESTEP;
}

/*
 * Send SIGTRAP if we're single-stepping
 */
static inline void single_step_trap(struct task_struct *task)
{
	if (task->ptrace & PT_SINGLESTEP) {
		ptrace_cancel_bpt(task);
		send_sig(SIGTRAP, task, 1);
	}
}

static inline void single_step_clear(struct task_struct *task)
{
	if (task->ptrace & PT_SINGLESTEP)
		ptrace_cancel_bpt(task);
}

static inline void single_step_set(struct task_struct *task)
{
	if (task->ptrace & PT_SINGLESTEP)
		ptrace_set_bpt(task);
}