153197fc4SJason Wessel /* 253197fc4SJason Wessel * Created by: Jason Wessel <jason.wessel@windriver.com> 353197fc4SJason Wessel * 453197fc4SJason Wessel * Copyright (c) 2009 Wind River Systems, Inc. All Rights Reserved. 553197fc4SJason Wessel * 653197fc4SJason Wessel * This file is licensed under the terms of the GNU General Public 753197fc4SJason Wessel * License version 2. This program is licensed "as is" without any 853197fc4SJason Wessel * warranty of any kind, whether express or implied. 953197fc4SJason Wessel */ 1053197fc4SJason Wessel 1153197fc4SJason Wessel #ifndef _DEBUG_CORE_H_ 1253197fc4SJason Wessel #define _DEBUG_CORE_H_ 1353197fc4SJason Wessel /* 1453197fc4SJason Wessel * These are the private implementation headers between the kernel 1553197fc4SJason Wessel * debugger core and the debugger front end code. 1653197fc4SJason Wessel */ 1753197fc4SJason Wessel 1853197fc4SJason Wessel /* kernel debug core data structures */ 1953197fc4SJason Wessel struct kgdb_state { 2053197fc4SJason Wessel int ex_vector; 2153197fc4SJason Wessel int signo; 2253197fc4SJason Wessel int err_code; 2353197fc4SJason Wessel int cpu; 2453197fc4SJason Wessel int pass_exception; 2553197fc4SJason Wessel unsigned long thr_query; 2653197fc4SJason Wessel unsigned long threadid; 2753197fc4SJason Wessel long kgdb_usethreadid; 2853197fc4SJason Wessel struct pt_regs *linux_regs; 2953197fc4SJason Wessel }; 3053197fc4SJason Wessel 3153197fc4SJason Wessel /* Exception state values */ 3253197fc4SJason Wessel #define DCPU_WANT_MASTER 0x1 /* Waiting to become a master kgdb cpu */ 3353197fc4SJason Wessel #define DCPU_NEXT_MASTER 0x2 /* Transition from one master cpu to another */ 3453197fc4SJason Wessel #define DCPU_IS_SLAVE 0x4 /* Slave cpu enter exception */ 3553197fc4SJason Wessel #define DCPU_SSTEP 0x8 /* CPU is single stepping */ 3653197fc4SJason Wessel 3753197fc4SJason Wessel struct debuggerinfo_struct { 3853197fc4SJason Wessel void *debuggerinfo; 3953197fc4SJason Wessel struct task_struct *task; 4053197fc4SJason Wessel int exception_state; 41dcc78711SJason Wessel int ret_state; 42dcc78711SJason Wessel int irq_depth; 4353197fc4SJason Wessel }; 4453197fc4SJason Wessel 4553197fc4SJason Wessel extern struct debuggerinfo_struct kgdb_info[]; 4653197fc4SJason Wessel 4753197fc4SJason Wessel /* kernel debug core break point routines */ 4853197fc4SJason Wessel extern int dbg_remove_all_break(void); 4953197fc4SJason Wessel extern int dbg_set_sw_break(unsigned long addr); 5053197fc4SJason Wessel extern int dbg_remove_sw_break(unsigned long addr); 5153197fc4SJason Wessel extern int dbg_activate_sw_breakpoints(void); 52dcc78711SJason Wessel extern int dbg_deactivate_sw_breakpoints(void); 53dcc78711SJason Wessel 54dcc78711SJason Wessel /* polled character access to i/o module */ 55dcc78711SJason Wessel extern int dbg_io_get_char(void); 56dcc78711SJason Wessel 57dcc78711SJason Wessel /* stub return value for switching between the gdbstub and kdb */ 58dcc78711SJason Wessel #define DBG_PASS_EVENT -12345 59dcc78711SJason Wessel /* Switch from one cpu to another */ 60dcc78711SJason Wessel #define DBG_SWITCH_CPU_EVENT -123456 61dcc78711SJason Wessel extern int dbg_switch_cpu; 6253197fc4SJason Wessel 6353197fc4SJason Wessel /* gdbstub interface functions */ 6453197fc4SJason Wessel extern int gdb_serial_stub(struct kgdb_state *ks); 6553197fc4SJason Wessel extern void gdbstub_msg_write(const char *s, int len); 6653197fc4SJason Wessel 67dcc78711SJason Wessel /* gdbstub functions used for kdb <-> gdbstub transition */ 68dcc78711SJason Wessel extern int gdbstub_state(struct kgdb_state *ks, char *cmd); 69a0de055cSJason Wessel extern int dbg_kdb_mode; 70dcc78711SJason Wessel 71dcc78711SJason Wessel #ifdef CONFIG_KGDB_KDB 72dcc78711SJason Wessel extern int kdb_stub(struct kgdb_state *ks); 73a0de055cSJason Wessel extern int kdb_parse(const char *cmdstr); 74dcc78711SJason Wessel #else /* ! CONFIG_KGDB_KDB */ 75dcc78711SJason Wessel static inline int kdb_stub(struct kgdb_state *ks) 76dcc78711SJason Wessel { 77dcc78711SJason Wessel return DBG_PASS_EVENT; 78dcc78711SJason Wessel } 79dcc78711SJason Wessel #endif /* CONFIG_KGDB_KDB */ 80dcc78711SJason Wessel 8153197fc4SJason Wessel #endif /* _DEBUG_CORE_H_ */ 82