31 #include "precompiled.h"
68 int bt_size = backtrace(bt, 3);
76 static const size_t N_FRAMES = 16;
79 wchar_t *bufpos = buf;
80 wchar_t *bufend = buf + max_chars;
85 static const size_t MAX_OUT_CHARS = 1024;
87 for (
size_t i = 0; (int)i < bt_size && bufpos+MAX_OUT_CHARS < bufend; i++)
97 len = swprintf(bufpos, MAX_OUT_CHARS, L
"(%p) %ls:%d %ls\n", bt[i], file, line, symbol);
99 len = swprintf(bufpos, MAX_OUT_CHARS, L
"(%p) %ls\n", bt[i], symbol);
103 len = swprintf(bufpos, MAX_OUT_CHARS, L
"(%p)\n", bt[i]);
111 memcpy(&bufpos[MAX_OUT_CHARS-6], L
"...\n", 5*
sizeof(
wchar_t));
130 char** symbols = backtrace_symbols(&ptr_of_interest, 1);
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
static const size_t DEBUG_SYMBOL_CHARS
Maximum number of characters (including null terminator) written to user's buffers by debug_ResolveSy...
int swprintf_s(wchar_t *buf, size_t max_chars, const wchar_t *fmt,...) WPRINTF_ARGS(3)
LIB_API void debug_SetThreadName(const char *name)
inform the debugger of the current thread's name.
const Status NOT_SUPPORTED
static const size_t DEBUG_FILE_CHARS
LIB_API void * debug_GetCaller(void *context, const wchar_t *lastFuncToSkip)
return the caller of a certain function on the call stack.
i64 Status
Error handling system.
LIB_API Status debug_ResolveSymbol(void *ptr_of_interest, wchar_t *sym_name, wchar_t *file, int *line)
read and return symbol information for the given address.
LIB_API Status debug_DumpStack(wchar_t *buf, size_t maxChars, void *context, const wchar_t *lastFuncToSkip)
write a complete stack trace (including values of local variables) into the specified buffer...