1 /* 2 * Copyright 2005-2009, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 * 5 * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. 6 * Distributed under the terms of the NewOS License. 7 */ 8 #ifndef _KERNEL_ARCH_DEBUG_H 9 #define _KERNEL_ARCH_DEBUG_H 10 11 12 #include <SupportDefs.h> 13 14 #include <arch_debug.h> 15 #include <cpu.h> 16 17 18 struct kernel_args; 19 20 namespace BKernel { 21 struct Thread; 22 } 23 24 using BKernel::Thread; 25 26 27 // arch_debug_get_stack_trace() flags 28 #define STACK_TRACE_KERNEL 0x01 29 #define STACK_TRACE_USER 0x02 30 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 #define arch_debug_get_caller() __builtin_return_address(0) 37 38 status_t arch_debug_init(kernel_args *args); 39 void arch_debug_stack_trace(void); 40 int32 arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount, 41 int32 skipIframes, int32 skipFrames, uint32 flags); 42 void* arch_debug_get_interrupt_pc(bool* _isSyscall); 43 bool arch_debug_contains_call(Thread *thread, const char *symbol, 44 addr_t start, addr_t end); 45 void arch_debug_save_registers(struct arch_debug_registers* registers); 46 void arch_debug_unset_current_thread(void); 47 void arch_debug_call_with_fault_handler(cpu_ent* cpu, jmp_buf jumpBuffer, 48 void (*function)(void*), void* parameter); 49 50 bool arch_is_debug_variable_defined(const char* variableName); 51 status_t arch_set_debug_variable(const char* variableName, uint64 value); 52 status_t arch_get_debug_variable(const char* variableName, uint64* value); 53 54 ssize_t arch_debug_gdb_get_registers(char* buffer, size_t bufferSize); 55 56 #ifdef __cplusplus 57 } 58 #endif 59 60 #endif /* _KERNEL_ARCH_DEBUG_H */ 61