Support for stack traces in tracing entries:

* Added capture_tracing_stack_trace() which allocates space in the
  tracing buffer and captures the stack trace according to the given
  parameters.
* Added TraceOutput::PrintStackTrace() to print a stack trace thus
  created.
* Added TraceEntry::DumpStackTrace() callback which is supposed to print
  a stack trace for the entry, if it can do that.
* Added "--stacktrace" switch to the "traced" command, which causes the
  stack traces for all entries that have one to be printed as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25205 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-04-27 03:02:01 +00:00
parent 4dd0a2c7b6
commit 65f4015279
2 changed files with 99 additions and 10 deletions
+6
View File
@@ -16,6 +16,8 @@ struct trace_entry {
uint32 flags : 4;
};
struct tracing_stack_trace;
#ifdef __cplusplus
#include <new>
@@ -35,6 +37,7 @@ class TraceOutput {
void Clear();
void Print(const char* format,...);
void PrintStackTrace(tracing_stack_trace* stackTrace);
bool IsFull() const { return fSize >= fCapacity; }
char* Buffer() const { return fBuffer; }
@@ -60,6 +63,7 @@ class TraceEntry : public trace_entry {
virtual ~TraceEntry();
virtual void Dump(TraceOutput& out);
virtual void DumpStackTrace(TraceOutput& out);
size_t Size() const { return size; }
uint16 Flags() const { return flags; }
@@ -140,6 +144,8 @@ uint8* alloc_tracing_buffer(size_t size);
uint8* alloc_tracing_buffer_memcpy(const void* source, size_t size, bool user);
char* alloc_tracing_buffer_strcpy(const char* source, size_t maxSize,
bool user);
tracing_stack_trace* capture_tracing_stack_trace(int32 maxCount,
int32 skipFrames, bool userOnly);
int dump_tracing(int argc, char** argv, WrapperTraceFilter* wrapperFilter);
status_t tracing_init(void);