debug_core.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. atomic_t *send_ready;
  28. };
  29. /* Exception state values */
  30. #define DCPU_WANT_MASTER 0x1 /* Waiting to become a master kgdb cpu */
  31. #define DCPU_NEXT_MASTER 0x2 /* Transition from one master cpu to another */
  32. #define DCPU_IS_SLAVE 0x4 /* Slave cpu enter exception */
  33. #define DCPU_WANT_BT 0x8 /* Slave cpu should backtrace then clear flag */
  34. struct debuggerinfo_struct {
  35. void *debuggerinfo;
  36. struct task_struct *task;
  37. int exception_state;
  38. int ret_state;
  39. int irq_depth;
  40. int enter_kgdb;
  41. bool rounding_up;
  42. };
  43. extern struct debuggerinfo_struct kgdb_info[];
  44. /* kernel debug core break point routines */
  45. extern int dbg_remove_all_break(void);
  46. extern int dbg_set_sw_break(unsigned long addr);
  47. extern int dbg_remove_sw_break(unsigned long addr);
  48. extern int dbg_activate_sw_breakpoints(void);
  49. extern int dbg_deactivate_sw_breakpoints(void);
  50. /* polled character access to i/o module */
  51. extern int dbg_io_get_char(void);
  52. /* stub return value for switching between the gdbstub and kdb */
  53. #define DBG_PASS_EVENT -12345
  54. /* Switch from one cpu to another */
  55. #define DBG_SWITCH_CPU_EVENT -123456
  56. extern int dbg_switch_cpu;
  57. /* gdbstub interface functions */
  58. extern int gdb_serial_stub(struct kgdb_state *ks);
  59. extern void gdbstub_msg_write(const char *s, int len);
  60. /* gdbstub functions used for kdb <-> gdbstub transition */
  61. extern int gdbstub_state(struct kgdb_state *ks, char *cmd);
  62. extern int dbg_kdb_mode;
  63. #ifdef CONFIG_KGDB_KDB
  64. extern int kdb_stub(struct kgdb_state *ks);
  65. extern int kdb_parse(const char *cmdstr);
  66. extern int kdb_common_init_state(struct kgdb_state *ks);
  67. extern int kdb_common_deinit_state(void);
  68. extern void kdb_dump_stack_on_cpu(int cpu);
  69. #else /* ! CONFIG_KGDB_KDB */
  70. static inline int kdb_stub(struct kgdb_state *ks)
  71. {
  72. return DBG_PASS_EVENT;
  73. }
  74. #endif /* CONFIG_KGDB_KDB */
  75. #endif /* _DEBUG_CORE_H_ */