debug.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
  3. */
  4. #ifndef _ASM_POWERPC_DEBUG_H
  5. #define _ASM_POWERPC_DEBUG_H
  6. #include <asm/hw_breakpoint.h>
  7. struct pt_regs;
  8. extern struct dentry *powerpc_debugfs_root;
  9. #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
  10. extern int (*__debugger)(struct pt_regs *regs);
  11. extern int (*__debugger_ipi)(struct pt_regs *regs);
  12. extern int (*__debugger_bpt)(struct pt_regs *regs);
  13. extern int (*__debugger_sstep)(struct pt_regs *regs);
  14. extern int (*__debugger_iabr_match)(struct pt_regs *regs);
  15. extern int (*__debugger_break_match)(struct pt_regs *regs);
  16. extern int (*__debugger_fault_handler)(struct pt_regs *regs);
  17. #define DEBUGGER_BOILERPLATE(__NAME) \
  18. static inline int __NAME(struct pt_regs *regs) \
  19. { \
  20. if (unlikely(__ ## __NAME)) \
  21. return __ ## __NAME(regs); \
  22. return 0; \
  23. }
  24. DEBUGGER_BOILERPLATE(debugger)
  25. DEBUGGER_BOILERPLATE(debugger_ipi)
  26. DEBUGGER_BOILERPLATE(debugger_bpt)
  27. DEBUGGER_BOILERPLATE(debugger_sstep)
  28. DEBUGGER_BOILERPLATE(debugger_iabr_match)
  29. DEBUGGER_BOILERPLATE(debugger_break_match)
  30. DEBUGGER_BOILERPLATE(debugger_fault_handler)
  31. #else
  32. static inline int debugger(struct pt_regs *regs) { return 0; }
  33. static inline int debugger_ipi(struct pt_regs *regs) { return 0; }
  34. static inline int debugger_bpt(struct pt_regs *regs) { return 0; }
  35. static inline int debugger_sstep(struct pt_regs *regs) { return 0; }
  36. static inline int debugger_iabr_match(struct pt_regs *regs) { return 0; }
  37. static inline int debugger_break_match(struct pt_regs *regs) { return 0; }
  38. static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
  39. #endif
  40. void set_breakpoint(struct arch_hw_breakpoint *brk);
  41. void __set_breakpoint(struct arch_hw_breakpoint *brk);
  42. #ifdef CONFIG_PPC_ADV_DEBUG_REGS
  43. extern void do_send_trap(struct pt_regs *regs, unsigned long address,
  44. unsigned long error_code, int signal_code, int brkpt);
  45. #else
  46. extern void do_break(struct pt_regs *regs, unsigned long address,
  47. unsigned long error_code);
  48. #endif
  49. #endif /* _ASM_POWERPC_DEBUG_H */