ptrace.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. */
  10. #include <linux/ptrace.h>
  11. extern void ptrace_cancel_bpt(struct task_struct *);
  12. extern void ptrace_set_bpt(struct task_struct *);
  13. extern void ptrace_break(struct task_struct *, struct pt_regs *);
  14. /*
  15. * make sure single-step breakpoint is gone.
  16. */
  17. static inline void single_step_disable(struct task_struct *task)
  18. {
  19. task->ptrace &= ~PT_SINGLESTEP;
  20. ptrace_cancel_bpt(task);
  21. }
  22. static inline void single_step_enable(struct task_struct *task)
  23. {
  24. task->ptrace |= PT_SINGLESTEP;
  25. }
  26. /*
  27. * Send SIGTRAP if we're single-stepping
  28. */
  29. static inline void single_step_trap(struct task_struct *task)
  30. {
  31. if (task->ptrace & PT_SINGLESTEP) {
  32. ptrace_cancel_bpt(task);
  33. send_sig(SIGTRAP, task, 1);
  34. }
  35. }
  36. static inline void single_step_clear(struct task_struct *task)
  37. {
  38. if (task->ptrace & PT_SINGLESTEP)
  39. ptrace_cancel_bpt(task);
  40. }
  41. static inline void single_step_set(struct task_struct *task)
  42. {
  43. if (task->ptrace & PT_SINGLESTEP)
  44. ptrace_set_bpt(task);
  45. }