{ \
ASSERT_TRUE(trace_size >= strlen(stack_trace) + 1, "insufficient estimated stack trace size"); \
if (trace_size < strlen(stack_trace) + 1) { \
\
LOG(a_sprintf("failure in stack trace return: estimated size (%d) was less than actual (%d)", \
trace_size, strlen(stack_trace))); \
\
free(stack_trace); \
return failure_return; \
} \
ASSERT_TRUE(strlen(stack_trace) > 1, "empty stack trace"); \
if (strlen(stack_trace) < 2) { \
LOG("failure in stack trace return: the trace output string was empty!"); \
return failure_return; \
} \
LOG(astring("\n\n################\n\n") + header + "\n" + stack_trace); \
\
free(stack_trace); \
}
char * full_trace() const
provides the current stack trace in a newly malloc'd string.
int full_trace_size() const
this returns an estimated number of bytes needed for the full_trace().
callstack_tracker & thread_wide_stack_trace()
the single instance of callstack_tracker.
super helpful macro that shows the current stack trace and checks it for validity. this shouldn't impact the trace, since all the code is embedded inline from the macro. this does require that LOG() is defined, and that a failure return value is expected from the embedding function.