Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Created by: Jason Wessel <jason.wessel@windriver.com>
0003  *
0004  * Copyright (c) 2009 Wind River Systems, Inc.  All Rights Reserved.
0005  *
0006  * This file is licensed under the terms of the GNU General Public
0007  * License version 2. This program is licensed "as is" without any
0008  * warranty of any kind, whether express or implied.
0009  */
0010 
0011 #ifndef _DEBUG_CORE_H_
0012 #define _DEBUG_CORE_H_
0013 /*
0014  * These are the private implementation headers between the kernel
0015  * debugger core and the debugger front end code.
0016  */
0017 
0018 /* kernel debug core data structures */
0019 struct kgdb_state {
0020     int         ex_vector;
0021     int         signo;
0022     int         err_code;
0023     int         cpu;
0024     int         pass_exception;
0025     unsigned long       thr_query;
0026     unsigned long       threadid;
0027     long            kgdb_usethreadid;
0028     struct pt_regs      *linux_regs;
0029     atomic_t        *send_ready;
0030 };
0031 
0032 /* Exception state values */
0033 #define DCPU_WANT_MASTER 0x1 /* Waiting to become a master kgdb cpu */
0034 #define DCPU_NEXT_MASTER 0x2 /* Transition from one master cpu to another */
0035 #define DCPU_IS_SLAVE    0x4 /* Slave cpu enter exception */
0036 #define DCPU_WANT_BT     0x8 /* Slave cpu should backtrace then clear flag */
0037 
0038 struct debuggerinfo_struct {
0039     void            *debuggerinfo;
0040     struct task_struct  *task;
0041     int         exception_state;
0042     int         ret_state;
0043     int         irq_depth;
0044     int         enter_kgdb;
0045     bool            rounding_up;
0046 };
0047 
0048 extern struct debuggerinfo_struct kgdb_info[];
0049 
0050 /* kernel debug core break point routines */
0051 extern int dbg_remove_all_break(void);
0052 extern int dbg_set_sw_break(unsigned long addr);
0053 extern int dbg_remove_sw_break(unsigned long addr);
0054 extern int dbg_activate_sw_breakpoints(void);
0055 extern int dbg_deactivate_sw_breakpoints(void);
0056 
0057 /* polled character access to i/o module */
0058 extern int dbg_io_get_char(void);
0059 
0060 /* stub return value for switching between the gdbstub and kdb */
0061 #define DBG_PASS_EVENT -12345
0062 /* Switch from one cpu to another */
0063 #define DBG_SWITCH_CPU_EVENT -123456
0064 extern int dbg_switch_cpu;
0065 
0066 /* gdbstub interface functions */
0067 extern int gdb_serial_stub(struct kgdb_state *ks);
0068 extern void gdbstub_msg_write(const char *s, int len);
0069 
0070 /* gdbstub functions used for kdb <-> gdbstub transition */
0071 extern int gdbstub_state(struct kgdb_state *ks, char *cmd);
0072 extern int dbg_kdb_mode;
0073 
0074 #ifdef CONFIG_KGDB_KDB
0075 extern int kdb_stub(struct kgdb_state *ks);
0076 extern int kdb_parse(const char *cmdstr);
0077 extern int kdb_common_init_state(struct kgdb_state *ks);
0078 extern int kdb_common_deinit_state(void);
0079 extern void kdb_dump_stack_on_cpu(int cpu);
0080 #else /* ! CONFIG_KGDB_KDB */
0081 static inline int kdb_stub(struct kgdb_state *ks)
0082 {
0083     return DBG_PASS_EVENT;
0084 }
0085 #endif /* CONFIG_KGDB_KDB */
0086 
0087 #endif /* _DEBUG_CORE_H_ */