debug_core.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Created by: Jason Wessel <jason.wessel@windriver.com>
  3. *
  4. * Copyright (c) 2009 Wind River Systems, Inc. All Rights Reserved.
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #ifndef _DEBUG_CORE_H_
  11. #define _DEBUG_CORE_H_
  12. /*
  13. * These are the private implementation headers between the kernel
  14. * debugger core and the debugger front end code.
  15. */
  16. /* kernel debug core data structures */
  17. struct kgdb_state {
  18. int ex_vector;
  19. int signo;
  20. int err_code;
  21. int cpu;
  22. int pass_exception;
  23. unsigned long thr_query;
  24. unsigned long threadid;
  25. long kgdb_usethreadid;
  26. struct pt_regs *linux_regs;
  27. };
  28. /* Exception state values */
  29. #define DCPU_WANT_MASTER 0x1 /* Waiting to become a master kgdb cpu */
  30. #define DCPU_NEXT_MASTER 0x2 /* Transition from one master cpu to another */
  31. #define DCPU_IS_SLAVE 0x4 /* Slave cpu enter exception */
  32. #define DCPU_SSTEP 0x8 /* CPU is single stepping */
  33. struct debuggerinfo_struct {
  34. void *debuggerinfo;
  35. struct task_struct *task;
  36. int exception_state;
  37. int ret_state;
  38. int irq_depth;
  39. };
  40. extern struct debuggerinfo_struct kgdb_info[];
  41. /* kernel debug core break point routines */
  42. extern int dbg_remove_all_break(void);
  43. extern int dbg_set_sw_break(unsigned long addr);
  44. extern int dbg_remove_sw_break(unsigned long addr);
  45. extern int dbg_activate_sw_breakpoints(void);
  46. extern int dbg_deactivate_sw_breakpoints(void);
  47. /* polled character access to i/o module */
  48. extern int dbg_io_get_char(void);
  49. /* stub return value for switching between the gdbstub and kdb */
  50. #define DBG_PASS_EVENT -12345
  51. /* Switch from one cpu to another */
  52. #define DBG_SWITCH_CPU_EVENT -123456
  53. extern int dbg_switch_cpu;
  54. /* gdbstub interface functions */
  55. extern int gdb_serial_stub(struct kgdb_state *ks);
  56. extern void gdbstub_msg_write(const char *s, int len);
  57. /* gdbstub functions used for kdb <-> gdbstub transition */
  58. extern int gdbstub_state(struct kgdb_state *ks, char *cmd);
  59. extern int dbg_kdb_mode;
  60. #ifdef CONFIG_KGDB_KDB
  61. extern int kdb_stub(struct kgdb_state *ks);
  62. extern int kdb_parse(const char *cmdstr);
  63. #else /* ! CONFIG_KGDB_KDB */
  64. static inline int kdb_stub(struct kgdb_state *ks)
  65. {
  66. return DBG_PASS_EVENT;
  67. }
  68. #endif /* CONFIG_KGDB_KDB */
  69. #endif /* _DEBUG_CORE_H_ */