Added libbacktrace support.

This commit is contained in:
Бранимир Караџић
2024-10-24 21:08:47 -07:00
parent 34d2948860
commit c875164bd1
4 changed files with 236 additions and 2 deletions

View File

@@ -6,6 +6,12 @@
#define CATCH_CONFIG_RUNNER
#include "test.h"
#include <bx/string.h>
#include <bx/file.h>
namespace bx
{
void debugOutputCallstack(uint32_t _skip);
}
bool testAssertHandler(const bx::Location& _location, const char* _format, va_list _argList)
{
@@ -13,6 +19,10 @@ bool testAssertHandler(const bx::Location& _location, const char* _format, va_li
bx::vprintf(_format, _argList);
bx::printf("\n");
uintptr_t stack[32];
const uint32_t num = bx::getCallStack(2 /* skip self */, BX_COUNTOF(stack), stack);
bx::writeCallstack(bx::getStdOut(), stack, num, bx::ErrorIgnore{});
// Throwing exceptions is required for testing asserts being trigged.
// Use REQUIRE_ASSERTS to test asserts.
throw std::exception();