Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/kernel/ptrace.h |
| 3 | * |
| 4 | * Copyright (C) 2000-2003 Russell King |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
Russell King | b2a0d36 | 2007-03-04 09:50:28 +0000 | [diff] [blame] | 10 | #include <linux/ptrace.h> |
| 11 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | extern void ptrace_cancel_bpt(struct task_struct *); |
| 13 | extern void ptrace_set_bpt(struct task_struct *); |
| 14 | extern void ptrace_break(struct task_struct *, struct pt_regs *); |
Russell King | b2a0d36 | 2007-03-04 09:50:28 +0000 | [diff] [blame] | 15 | |
| 16 | /* |
| 17 | * make sure single-step breakpoint is gone. |
| 18 | */ |
| 19 | static inline void single_step_disable(struct task_struct *task) |
| 20 | { |
| 21 | task->ptrace &= ~PT_SINGLESTEP; |
| 22 | ptrace_cancel_bpt(task); |
| 23 | } |
| 24 | |
| 25 | static inline void single_step_enable(struct task_struct *task) |
| 26 | { |
| 27 | task->ptrace |= PT_SINGLESTEP; |
| 28 | } |
| 29 | |
| 30 | /* |
| 31 | * Send SIGTRAP if we're single-stepping |
| 32 | */ |
| 33 | static inline void single_step_trap(struct task_struct *task) |
| 34 | { |
| 35 | if (task->ptrace & PT_SINGLESTEP) { |
| 36 | ptrace_cancel_bpt(task); |
| 37 | send_sig(SIGTRAP, task, 1); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | static inline void single_step_clear(struct task_struct *task) |
| 42 | { |
| 43 | if (task->ptrace & PT_SINGLESTEP) |
| 44 | ptrace_cancel_bpt(task); |
| 45 | } |
| 46 | |
| 47 | static inline void single_step_set(struct task_struct *task) |
| 48 | { |
| 49 | if (task->ptrace & PT_SINGLESTEP) |
| 50 | ptrace_set_bpt(task); |
| 51 | } |