2 * Created by: Jason Wessel <jason.wessel@windriver.com>
4 * Copyright (c) 2009 Wind River Systems, Inc. All Rights Reserved.
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.
11 #ifndef _DEBUG_CORE_H_
12 #define _DEBUG_CORE_H_
14 * These are the private implementation headers between the kernel
15 * debugger core and the debugger front end code.
18 /* kernel debug core data structures */
25 unsigned long thr_query;
26 unsigned long threadid;
27 long kgdb_usethreadid;
28 struct pt_regs *linux_regs;
32 /* Exception state values */
33 #define DCPU_WANT_MASTER 0x1 /* Waiting to become a master kgdb cpu */
34 #define DCPU_NEXT_MASTER 0x2 /* Transition from one master cpu to another */
35 #define DCPU_IS_SLAVE 0x4 /* Slave cpu enter exception */
36 #define DCPU_WANT_BT 0x8 /* Slave cpu should backtrace then clear flag */
38 struct debuggerinfo_struct {
40 struct task_struct *task;
48 extern struct debuggerinfo_struct kgdb_info[];
50 /* kernel debug core break point routines */
51 extern int dbg_remove_all_break(void);
52 extern int dbg_set_sw_break(unsigned long addr);
53 extern int dbg_remove_sw_break(unsigned long addr);
54 extern int dbg_activate_sw_breakpoints(void);
55 extern int dbg_deactivate_sw_breakpoints(void);
57 /* polled character access to i/o module */
58 extern int dbg_io_get_char(void);
60 /* stub return value for switching between the gdbstub and kdb */
61 #define DBG_PASS_EVENT -12345
62 /* Switch from one cpu to another */
63 #define DBG_SWITCH_CPU_EVENT -123456
64 extern int dbg_switch_cpu;
66 /* gdbstub interface functions */
67 extern int gdb_serial_stub(struct kgdb_state *ks);
68 extern void gdbstub_msg_write(const char *s, int len);
70 /* gdbstub functions used for kdb <-> gdbstub transition */
71 extern int gdbstub_state(struct kgdb_state *ks, char *cmd);
72 extern int dbg_kdb_mode;
74 #ifdef CONFIG_KGDB_KDB
75 extern int kdb_stub(struct kgdb_state *ks);
76 extern int kdb_parse(const char *cmdstr);
77 extern int kdb_common_init_state(struct kgdb_state *ks);
78 extern int kdb_common_deinit_state(void);
79 extern void kdb_dump_stack_on_cpu(int cpu);
80 #else /* ! CONFIG_KGDB_KDB */
81 static inline int kdb_stub(struct kgdb_state *ks)
83 return DBG_PASS_EVENT;
85 #endif /* CONFIG_KGDB_KDB */
87 #endif /* _DEBUG_CORE_H_ */