debug_core.h 2.3 KB

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