xref: /haiku/headers/private/kernel/arch/user_debugger.h (revision b671e9bbdbd10268a042b4f4cc4317ccd03d105e)
1 /*
2  * Copyright 2005, Ingo Weinhold, bonefish@users.sf.net.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef KERNEL_ARCH_USER_DEBUGGER_H
6 #define KERNEL_ARCH_USER_DEBUGGER_H
7 
8 #include "kernel_debug_config.h"
9 
10 #ifndef _ASSEMBLER
11 
12 #include <debugger.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 struct arch_team_debug_info;
19 struct arch_thread_debug_info;
20 struct thread;
21 
22 void arch_clear_team_debug_info(struct arch_team_debug_info *info);
23 void arch_destroy_team_debug_info(struct arch_team_debug_info *info);
24 void arch_clear_thread_debug_info(struct arch_thread_debug_info *info);
25 void arch_destroy_thread_debug_info(struct arch_thread_debug_info *info);
26 
27 void arch_update_thread_single_step();
28 
29 void arch_set_debug_cpu_state(const debug_cpu_state *cpuState);
30 void arch_get_debug_cpu_state(debug_cpu_state *cpuState);
31 
32 status_t arch_set_breakpoint(void *address);
33 status_t arch_clear_breakpoint(void *address);
34 status_t arch_set_watchpoint(void *address, uint32 type, int32 length);
35 status_t arch_clear_watchpoint(void *address);
36 bool arch_has_breakpoints(struct arch_team_debug_info *info);
37 
38 #if KERNEL_BREAKPOINTS
39 status_t arch_set_kernel_breakpoint(void *address);
40 status_t arch_clear_kernel_breakpoint(void *address);
41 status_t arch_set_kernel_watchpoint(void *address, uint32 type, int32 length);
42 status_t arch_clear_kernel_watchpoint(void *address);
43 #endif
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #include <arch_user_debugger.h>
50 
51 // Defaults for macros defined by the architecture specific header:
52 
53 // maximum number of instruction breakpoints
54 #ifndef DEBUG_MAX_BREAKPOINTS
55 #	define DEBUG_MAX_BREAKPOINTS 0
56 #endif
57 
58 // maximum number of data watchpoints
59 #ifndef DEBUG_MAX_WATCHPOINTS
60 #	define DEBUG_MAX_WATCHPOINTS 0
61 #endif
62 
63 // the software breakpoint instruction
64 #if !defined(DEBUG_SOFTWARE_BREAKPOINT)	\
65 	|| !defined(DEBUG_SOFTWARE_BREAKPOINT_SIZE)
66 #	undef DEBUG_SOFTWARE_BREAKPOINT
67 #	undef DEBUG_SOFTWARE_BREAKPOINT_SIZE
68 #	define DEBUG_SOFTWARE_BREAKPOINT		NULL
69 #	define DEBUG_SOFTWARE_BREAKPOINT_SIZE	0
70 #endif
71 
72 // Boolean whether break- and watchpoints use the same registers. If != 0, then
73 // DEBUG_MAX_BREAKPOINTS == DEBUG_MAX_WATCHPOINTS and either specifies the
74 // total count of break- plus watchpoints.
75 #ifndef DEBUG_SHARED_BREAK_AND_WATCHPOINTS
76 #	define DEBUG_SHARED_BREAK_AND_WATCHPOINTS 0
77 #endif
78 
79 #endif	// _ASSEMBLER
80 
81 #endif	// KERNEL_ARCH_USER_DEBUGGER_H
82