mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Cleanup.
This commit is contained in:
39
src/bx.cpp
39
src/bx.cpp
@@ -24,18 +24,43 @@ namespace bx
|
|||||||
|
|
||||||
static bool defaultAssertHandler(const Location& _location, const char* _format, va_list _argList)
|
static bool defaultAssertHandler(const Location& _location, const char* _format, va_list _argList)
|
||||||
{
|
{
|
||||||
char temp[8192];
|
char temp[8192];
|
||||||
int32_t pos = 0;
|
int32_t total = 0;
|
||||||
|
|
||||||
pos += snprintf(&temp[pos], max(0, sizeof(temp)-pos), "%s(%d): "
|
StaticMemoryBlockWriter smb(temp, BX_COUNTOF(temp) );
|
||||||
|
|
||||||
|
ErrorIgnore err;
|
||||||
|
|
||||||
|
total += write(&smb, &err, "\n--- ASSERT ---\n\n");
|
||||||
|
|
||||||
|
total += write(&smb, &err, "%s(%d): "
|
||||||
, _location.filePath
|
, _location.filePath
|
||||||
, _location.line
|
, _location.line
|
||||||
);
|
);
|
||||||
pos += vsnprintf(&temp[pos], max(0, sizeof(temp)-pos), _format, _argList);
|
total += write(&smb, _format, _argList, &err);
|
||||||
pos += snprintf(&temp[pos], max(0, sizeof(temp)-pos), "\n");
|
total += write(&smb, "\n\n", &err);
|
||||||
debugOutput(temp);
|
|
||||||
|
|
||||||
debugOutputCallstack(2);
|
uintptr_t stack[32];
|
||||||
|
const uint32_t num = getCallStack(2 /* skip self */, BX_COUNTOF(stack), stack);
|
||||||
|
total += writeCallstack(&smb, stack, num, &err);
|
||||||
|
|
||||||
|
total += write(&smb, &err,
|
||||||
|
"\nBuild info:\n"
|
||||||
|
"\tCompiler: " BX_COMPILER_NAME
|
||||||
|
", CPU: " BX_CPU_NAME
|
||||||
|
", Arch: " BX_ARCH_NAME
|
||||||
|
", OS: " BX_PLATFORM_NAME
|
||||||
|
", CRT: " BX_CRT_NAME
|
||||||
|
", C++: " BX_CPP_NAME
|
||||||
|
|
||||||
|
", Date: " __DATE__
|
||||||
|
", Time: " __TIME__
|
||||||
|
"\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
total += write(&smb, &err, "\n--- END ---\n\n");
|
||||||
|
|
||||||
|
write(getDebugOut(), temp, total, ErrorIgnore{});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user