From 4502d80d7e46775573ccdee7f74da9af70ec2ba8 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 31 Dec 2009 17:21:17 +0000 Subject: [PATCH] capture_tracing_stack_trace(): * When interrupts are disabled, it is still safe to capture the kernel stack trace. The respective TODO preceded the introduction of the "kernelOnly" flag. * Actually made "kernelOnly" work. The wrong flag was passed to arch_debug_get_stack_trace() in case it was false, so we never captured user stack traces. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34832 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/debug/tracing.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/system/kernel/debug/tracing.cpp b/src/system/kernel/debug/tracing.cpp index de528f6d0f..3601f268ac 100644 --- a/src/system/kernel/debug/tracing.cpp +++ b/src/system/kernel/debug/tracing.cpp @@ -1538,10 +1538,13 @@ tracing_stack_trace* capture_tracing_stack_trace(int32 maxCount, int32 skipFrames, bool kernelOnly) { #if ENABLE_TRACING - // TODO: page_fault_exception() doesn't allow us to gracefully handle - // a bad address in the stack trace, if interrupts are disabled. + // page_fault_exception() doesn't allow us to gracefully handle a bad + // address in the stack trace, if interrupts are disabled, so we always + // restrict the stack traces to the kernel only in this case. A bad address + // in the kernel stack trace would still cause a panic(), but this is + // probably even desired. if (!are_interrupts_enabled()) - return NULL; + kernelOnly = true; tracing_stack_trace* stackTrace = (tracing_stack_trace*)alloc_tracing_buffer( @@ -1550,7 +1553,7 @@ capture_tracing_stack_trace(int32 maxCount, int32 skipFrames, bool kernelOnly) if (stackTrace != NULL) { stackTrace->depth = arch_debug_get_stack_trace( stackTrace->return_addresses, maxCount, 0, skipFrames + 1, - STACK_TRACE_KERNEL | (kernelOnly ? 0 : STACK_TRACE_KERNEL)); + STACK_TRACE_KERNEL | (kernelOnly ? 0 : STACK_TRACE_USER)); } return stackTrace;