diff --git a/headers/private/kernel/arch/debug.h b/headers/private/kernel/arch/debug.h index 5a273bfa57..534f64c8de 100644 --- a/headers/private/kernel/arch/debug.h +++ b/headers/private/kernel/arch/debug.h @@ -23,6 +23,7 @@ status_t arch_debug_init(kernel_args *args); void *arch_debug_get_caller(void); int32 arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount, int32 skipFrames, bool userOnly); +void *arch_debug_get_interrupt_pc(); bool arch_debug_contains_call(struct thread *thread, const char *symbol, addr_t start, addr_t end); void arch_debug_save_registers(int *); diff --git a/src/system/kernel/arch/m68k/arch_debug.cpp b/src/system/kernel/arch/m68k/arch_debug.cpp index 25f88a4db5..9895430860 100644 --- a/src/system/kernel/arch/m68k/arch_debug.cpp +++ b/src/system/kernel/arch/m68k/arch_debug.cpp @@ -339,6 +339,14 @@ arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount, } +void* +arch_debug_get_interrupt_pc() +{ + // TODO: Implement! + return NULL; +} + + status_t arch_debug_init(kernel_args *args) { diff --git a/src/system/kernel/arch/ppc/arch_debug.cpp b/src/system/kernel/arch/ppc/arch_debug.cpp index 94581ac3d1..bfa7fd3c4e 100644 --- a/src/system/kernel/arch/ppc/arch_debug.cpp +++ b/src/system/kernel/arch/ppc/arch_debug.cpp @@ -286,6 +286,14 @@ arch_debug_get_caller(void) } +void* +arch_debug_get_interrupt_pc() +{ + // TODO: Implement! + return NULL; +} + + status_t arch_debug_init(kernel_args *args) { diff --git a/src/system/kernel/arch/x86/arch_debug.cpp b/src/system/kernel/arch/x86/arch_debug.cpp index 8d984dfee5..17580da045 100644 --- a/src/system/kernel/arch/x86/arch_debug.cpp +++ b/src/system/kernel/arch/x86/arch_debug.cpp @@ -596,9 +596,13 @@ cmd_in_context(int argc, char** argv) } } + struct thread* previousThread = debug_set_debugged_thread(thread); + // execute the command evaluate_debug_command(commandLine); + debug_set_debugged_thread(previousThread); + // reset the page directory if (oldPageDirectory) write_cr3(oldPageDirectory); @@ -699,6 +703,20 @@ arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount, return count; } +/*! Returns the program counter of this thread where the innermost interrupts + happened. Returns \c NULL, if there's none or a problem occurred retrieving + it. +*/ +void* +arch_debug_get_interrupt_pc() +{ + struct iframe* frame = i386_get_current_iframe(); + if (frame == NULL) + return NULL; + + return (void*)(addr_t)frame->eip; +} + status_t arch_debug_init(kernel_args *args)