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
This commit is contained in:
Ingo Weinhold
2009-12-31 17:21:17 +00:00
parent 91bd177eb1
commit 4502d80d7e
+7 -4
View File
@@ -1538,10 +1538,13 @@ tracing_stack_trace*
capture_tracing_stack_trace(int32 maxCount, int32 skipFrames, bool kernelOnly) capture_tracing_stack_trace(int32 maxCount, int32 skipFrames, bool kernelOnly)
{ {
#if ENABLE_TRACING #if ENABLE_TRACING
// TODO: page_fault_exception() doesn't allow us to gracefully handle // page_fault_exception() doesn't allow us to gracefully handle a bad
// a bad address in the stack trace, if interrupts are disabled. // 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()) if (!are_interrupts_enabled())
return NULL; kernelOnly = true;
tracing_stack_trace* stackTrace tracing_stack_trace* stackTrace
= (tracing_stack_trace*)alloc_tracing_buffer( = (tracing_stack_trace*)alloc_tracing_buffer(
@@ -1550,7 +1553,7 @@ capture_tracing_stack_trace(int32 maxCount, int32 skipFrames, bool kernelOnly)
if (stackTrace != NULL) { if (stackTrace != NULL) {
stackTrace->depth = arch_debug_get_stack_trace( stackTrace->depth = arch_debug_get_stack_trace(
stackTrace->return_addresses, maxCount, 0, skipFrames + 1, 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; return stackTrace;