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