From 1b20a9a58ef571283dd4d342dc9b9189dc3bdb22 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 24 Aug 2008 21:46:10 +0000 Subject: [PATCH] arch_debug_get_interrupt_pc() does now also support the currently debugged thread, if set. This makes "dis" without specified address work when used with "in_context". git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27190 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/arch/x86/arch_debug.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/system/kernel/arch/x86/arch_debug.cpp b/src/system/kernel/arch/x86/arch_debug.cpp index 17580da045..c3dc9b667c 100644 --- a/src/system/kernel/arch/x86/arch_debug.cpp +++ b/src/system/kernel/arch/x86/arch_debug.cpp @@ -710,10 +710,19 @@ arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount, void* arch_debug_get_interrupt_pc() { - struct iframe* frame = i386_get_current_iframe(); - if (frame == NULL) - return NULL; + struct thread* thread = debug_get_debugged_thread(); + if (thread == thread_get_current_thread()) { + struct iframe* frame = i386_get_current_iframe(); + if (frame == NULL) + return NULL; + + return (void*)(addr_t)frame->eip; + } + + addr_t ebp = thread->arch_info.current_stack.esp[2]; + // NOTE: This doesn't work, if the thread is running (on another CPU). + struct iframe* frame = find_previous_iframe(thread, ebp); return (void*)(addr_t)frame->eip; }