debug_core.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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_SSTEP 0x8 /* CPU is single stepping */
  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. };
  42. extern struct debuggerinfo_struct kgdb_info[];
  43. /* kernel debug core break point routines */
  44. extern int dbg_remove_all_break(void);
  45. extern int dbg_set_sw_break(unsigned long addr);
  46. extern int dbg_remove_sw_break(unsigned long addr);
  47. extern int dbg_activate_sw_breakpoints(void);
  48. extern int dbg_deactivate_sw_breakpoints(void);
  49. /* polled character access to i/o module */
  50. extern int dbg_io_get_char(void);
  51. /* stub return value for switching between the gdbstub and kdb */
  52. #define DBG_PASS_EVENT -12345
  53. /* Switch from one cpu to another */
  54. #define DBG_SWITCH_CPU_EVENT -123456
  55. extern int dbg_switch_cpu;
  56. /* gdbstub interface functions */
  57. extern int gdb_serial_stub(struct kgdb_state *ks);
  58. extern void gdbstub_msg_write(const char *s, int len);
  59. /* gdbstub functions used for kdb <-> gdbstub transition */
  60. extern int gdbstub_state(struct kgdb_state *ks, char *cmd);
  61. extern int dbg_kdb_mode;
  62. #ifdef CONFIG_KGDB_KDB
  63. extern int kdb_stub(struct kgdb_state *ks);
  64. extern int kdb_parse(const char *cmdstr);
  65. extern int kdb_common_init_state(struct kgdb_state *ks);
  66. extern int kdb_common_deinit_state(void);
  67. #else /* ! CONFIG_KGDB_KDB */
  68. static inline int kdb_stub(struct kgdb_state *ks)
  69. {
  70. return DBG_PASS_EVENT;
  71. }
  72. #endif /* CONFIG_KGDB_KDB */
  73. #endif /* _DEBUG_CORE_H_ */