xref: /linux-6.15/kernel/debug/debug_core.h (revision 53197fc4)
1*53197fc4SJason Wessel /*
2*53197fc4SJason Wessel  * Created by: Jason Wessel <[email protected]>
3*53197fc4SJason Wessel  *
4*53197fc4SJason Wessel  * Copyright (c) 2009 Wind River Systems, Inc.  All Rights Reserved.
5*53197fc4SJason Wessel  *
6*53197fc4SJason Wessel  * This file is licensed under the terms of the GNU General Public
7*53197fc4SJason Wessel  * License version 2. This program is licensed "as is" without any
8*53197fc4SJason Wessel  * warranty of any kind, whether express or implied.
9*53197fc4SJason Wessel  */
10*53197fc4SJason Wessel 
11*53197fc4SJason Wessel #ifndef _DEBUG_CORE_H_
12*53197fc4SJason Wessel #define _DEBUG_CORE_H_
13*53197fc4SJason Wessel /*
14*53197fc4SJason Wessel  * These are the private implementation headers between the kernel
15*53197fc4SJason Wessel  * debugger core and the debugger front end code.
16*53197fc4SJason Wessel  */
17*53197fc4SJason Wessel 
18*53197fc4SJason Wessel /* kernel debug core data structures */
19*53197fc4SJason Wessel struct kgdb_state {
20*53197fc4SJason Wessel 	int			ex_vector;
21*53197fc4SJason Wessel 	int			signo;
22*53197fc4SJason Wessel 	int			err_code;
23*53197fc4SJason Wessel 	int			cpu;
24*53197fc4SJason Wessel 	int			pass_exception;
25*53197fc4SJason Wessel 	unsigned long		thr_query;
26*53197fc4SJason Wessel 	unsigned long		threadid;
27*53197fc4SJason Wessel 	long			kgdb_usethreadid;
28*53197fc4SJason Wessel 	struct pt_regs		*linux_regs;
29*53197fc4SJason Wessel };
30*53197fc4SJason Wessel 
31*53197fc4SJason Wessel /* Exception state values */
32*53197fc4SJason Wessel #define DCPU_WANT_MASTER 0x1 /* Waiting to become a master kgdb cpu */
33*53197fc4SJason Wessel #define DCPU_NEXT_MASTER 0x2 /* Transition from one master cpu to another */
34*53197fc4SJason Wessel #define DCPU_IS_SLAVE    0x4 /* Slave cpu enter exception */
35*53197fc4SJason Wessel #define DCPU_SSTEP       0x8 /* CPU is single stepping */
36*53197fc4SJason Wessel 
37*53197fc4SJason Wessel struct debuggerinfo_struct {
38*53197fc4SJason Wessel 	void			*debuggerinfo;
39*53197fc4SJason Wessel 	struct task_struct	*task;
40*53197fc4SJason Wessel 	int			exception_state;
41*53197fc4SJason Wessel };
42*53197fc4SJason Wessel 
43*53197fc4SJason Wessel extern struct debuggerinfo_struct kgdb_info[];
44*53197fc4SJason Wessel 
45*53197fc4SJason Wessel /* kernel debug core break point routines */
46*53197fc4SJason Wessel extern int dbg_remove_all_break(void);
47*53197fc4SJason Wessel extern int dbg_set_sw_break(unsigned long addr);
48*53197fc4SJason Wessel extern int dbg_remove_sw_break(unsigned long addr);
49*53197fc4SJason Wessel extern int dbg_activate_sw_breakpoints(void);
50*53197fc4SJason Wessel 
51*53197fc4SJason Wessel /* gdbstub interface functions */
52*53197fc4SJason Wessel extern int gdb_serial_stub(struct kgdb_state *ks);
53*53197fc4SJason Wessel extern void gdbstub_msg_write(const char *s, int len);
54*53197fc4SJason Wessel 
55*53197fc4SJason Wessel #endif /* _DEBUG_CORE_H_ */
56