From b2a7fcb4045ff77189f7431fde83e16e21258736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 18 Oct 2009 19:50:13 +0000 Subject: [PATCH] * Added an arch_debug_stack_trace() function that is called from the KDL loop in case there aren't any KDL commands available yet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33642 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/arch/debug.h | 3 ++- src/system/kernel/arch/arm/arch_debug.cpp | 17 ++++++++++++----- src/system/kernel/arch/m68k/arch_debug.cpp | 6 ++++++ src/system/kernel/arch/ppc/arch_debug.cpp | 7 +++++++ src/system/kernel/arch/x86/arch_debug.cpp | 7 +++++++ src/system/kernel/debug/debug.cpp | 3 +++ 6 files changed, 37 insertions(+), 6 deletions(-) diff --git a/headers/private/kernel/arch/debug.h b/headers/private/kernel/arch/debug.h index a910fa9626..1f51e9559e 100644 --- a/headers/private/kernel/arch/debug.h +++ b/headers/private/kernel/arch/debug.h @@ -1,5 +1,5 @@ /* - * Copyright 2005-2008, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2005-2009, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -23,6 +23,7 @@ extern "C" { #endif status_t arch_debug_init(kernel_args *args); +void arch_debug_stack_trace(void); void *arch_debug_get_caller(void); int32 arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount, int32 skipIframes, int32 skipFrames, bool userOnly); diff --git a/src/system/kernel/arch/arm/arch_debug.cpp b/src/system/kernel/arch/arm/arch_debug.cpp index 81f494ee12..bdc73b7ff3 100644 --- a/src/system/kernel/arch/arm/arch_debug.cpp +++ b/src/system/kernel/arch/arm/arch_debug.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2008, Haiku Inc. All rights reserved. + * Copyright 2003-2009, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -241,6 +241,12 @@ arch_debug_contains_call(struct thread *thread, const char *symbol, } +void +arch_debug_stack_trace(void) +{ +} + + void * arch_debug_get_caller(void) { @@ -376,19 +382,20 @@ arch_debug_init(kernel_args *args) return B_NO_ERROR; } + void arch_debug_call_with_fault_handler(cpu_ent* cpu, jmp_buf jumpBuffer, - void (*function)(void*), void* parameter) + void (*function)(void*), void* parameter) { - // TODO: Implement! Most likely in assembly. - longjmp(jumpBuffer, 1); + // TODO: Implement! Most likely in assembly. + longjmp(jumpBuffer, 1); } void arch_debug_unset_current_thread(void) { - // TODO: Implement! + // TODO: Implement! } diff --git a/src/system/kernel/arch/m68k/arch_debug.cpp b/src/system/kernel/arch/m68k/arch_debug.cpp index 7b50744226..816ddf4b60 100644 --- a/src/system/kernel/arch/m68k/arch_debug.cpp +++ b/src/system/kernel/arch/m68k/arch_debug.cpp @@ -253,6 +253,12 @@ arch_debug_save_registers(int *regs) } +void +arch_debug_stack_trace(void) +{ +} + + bool arch_debug_contains_call(struct thread *thread, const char *symbol, addr_t start, addr_t end) diff --git a/src/system/kernel/arch/ppc/arch_debug.cpp b/src/system/kernel/arch/ppc/arch_debug.cpp index 94a2f21b1e..841d787ef2 100644 --- a/src/system/kernel/arch/ppc/arch_debug.cpp +++ b/src/system/kernel/arch/ppc/arch_debug.cpp @@ -259,6 +259,13 @@ arch_debug_save_registers(int *regs) } +void +arch_debug_stack_trace(void) +{ + stack_trace(0, NULL); +} + + bool arch_debug_contains_call(struct thread *thread, const char *symbol, addr_t start, addr_t end) diff --git a/src/system/kernel/arch/x86/arch_debug.cpp b/src/system/kernel/arch/x86/arch_debug.cpp index b7bb283f28..b26373d047 100644 --- a/src/system/kernel/arch/x86/arch_debug.cpp +++ b/src/system/kernel/arch/x86/arch_debug.cpp @@ -883,6 +883,13 @@ cmd_in_context(int argc, char** argv) // #pragma mark - +void +arch_debug_stack_trace(void) +{ + stack_trace(0, NULL); +} + + bool arch_debug_contains_call(struct thread *thread, const char *symbol, addr_t start, addr_t end) diff --git a/src/system/kernel/debug/debug.cpp b/src/system/kernel/debug/debug.cpp index d1f98fd5f8..ded2e1960f 100644 --- a/src/system/kernel/debug/debug.cpp +++ b/src/system/kernel/debug/debug.cpp @@ -733,6 +733,9 @@ kernel_debugger_loop(const char* message, int32 cpu) } } + if (!has_debugger_command("help")) + arch_debug_stack_trace(); + int32 continuableLine = -1; // Index of the previous command line, if the command returned // B_KDEBUG_CONT, i.e. asked to be repeatable, -1 otherwise.