* Reverted r25209. We need the symbol even with tracing disabled, since

modules could use it. Moved the tracing_stack_trace definition out of
  the conditional section instead.
* Made the TraceOutput::Print()/PrintStackTrace() method no-ops when
  tracing is disabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25211 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-04-27 14:00:37 +00:00
parent 1cae077af9
commit b2d95c3c1d

View File

@ -20,6 +20,12 @@
#include <util/AutoLock.h>
struct tracing_stack_trace {
int32 depth;
addr_t return_addresses[0];
};
#if ENABLE_TRACING
//#define TRACE_TRACING
@ -37,11 +43,6 @@ enum {
FILTER_MATCH = 0x08
};
struct tracing_stack_trace {
int32 depth;
addr_t return_addresses[0];
};
static const size_t kTraceOutputBufferSize = 10240;
static const size_t kBufferSize = MAX_TRACE_SIZE / 4;
@ -239,6 +240,7 @@ TraceOutput::Clear()
void
TraceOutput::Print(const char* format,...)
{
#if ENABLE_TRACING
if (IsFull())
return;
@ -246,13 +248,14 @@ TraceOutput::Print(const char* format,...)
va_start(args, format);
fSize += vsnprintf(fBuffer + fSize, fCapacity - fSize, format, args);
va_end(args);
#endif
}
#if ENABLE_TRACING
void
TraceOutput::PrintStackTrace(tracing_stack_trace* stackTrace)
{
#if ENABLE_TRACING
if (stackTrace == NULL || stackTrace->depth <= 0)
return;
@ -272,8 +275,8 @@ TraceOutput::PrintStackTrace(tracing_stack_trace* stackTrace)
} else
Print(" %p\n", (void*)address);
}
#endif
}
#endif // ENABLE_TRACING
void