diff options
| author | Dan Engelbrecht <[email protected]> | 2025-09-26 16:45:54 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-09-26 16:45:54 +0200 |
| commit | d22b84461e4f1a9dd77c8f93488a6914a2436090 (patch) | |
| tree | aeb4ed5312c500cb649dea427e30638070303ede /src/zencore/include | |
| parent | fix for C4244 truncation warning (#515) (diff) | |
| download | zen-d22b84461e4f1a9dd77c8f93488a6914a2436090.tar.xz zen-d22b84461e4f1a9dd77c8f93488a6914a2436090.zip | |
Make sure we call the previous terminate handle if present when we intercept terminate calls (#514)
Improvement: Make sure we call the previous terminate handle if present when we intercept terminate calls
Improvement: Avoid allocating memory for call stack in terminate handle and assert callback
Diffstat (limited to 'src/zencore/include')
| -rw-r--r-- | src/zencore/include/zencore/callstack.h | 12 | ||||
| -rw-r--r-- | src/zencore/include/zencore/zencore.h | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/zencore/include/zencore/callstack.h b/src/zencore/include/zencore/callstack.h index ef4ba0e91..ca8171435 100644 --- a/src/zencore/include/zencore/callstack.h +++ b/src/zencore/include/zencore/callstack.h @@ -32,6 +32,18 @@ GetFrameSymbols(const CallstackFrames* Callstack) void FormatCallstack(const CallstackFrames* Callstack, StringBuilderBase& SB, std::string_view Prefix); std::string CallstackToString(const CallstackFrames* Callstack, std::string_view Prefix = {}); +typedef void (*CallstackRawCallback)(void* UserData, uint32_t FrameIndex, const char* FrameText); + +constexpr size_t +CallstackRawMemorySize(int FramesToSkip, int FramesToCapture) +{ + return sizeof(CallstackFrames) + sizeof(void*) * (FramesToSkip + FramesToCapture); +} + +void CallstackToStringRaw(const CallstackFrames* Callstack, void* CallbackUserData, CallstackRawCallback Callback); + +CallstackFrames* GetCallstackRaw(void* CaptureBuffer, int FramesToSkip, int FramesToCapture); + void callstack_forcelink(); // internal } // namespace zen diff --git a/src/zencore/include/zencore/zencore.h b/src/zencore/include/zencore/zencore.h index d21c0e7e2..b5eb3e3e8 100644 --- a/src/zencore/include/zencore/zencore.h +++ b/src/zencore/include/zencore/zencore.h @@ -58,11 +58,11 @@ struct AssertImpl [[noreturn]] (const char* Filename, int LineNumber, const char* FunctionName, const char* Msg); virtual void ZEN_FORCENOINLINE ZEN_DEBUG_SECTION - OnAssert(const char* Filename, int LineNumber, const char* FunctionName, const char* Msg, CallstackFrames* Callstack); + OnAssert(const char* Filename, int LineNumber, const char* FunctionName, const char* Msg, const CallstackFrames* Callstack); protected: static void ZEN_FORCENOINLINE ZEN_DEBUG_SECTION ThrowAssertException - [[noreturn]] (const char* Filename, int LineNumber, const char* FunctionName, const char* Msg, CallstackFrames* Callstack); + [[noreturn]] (const char* Filename, int LineNumber, const char* FunctionName, const char* Msg, const CallstackFrames* Callstack); static AssertImpl* CurrentAssertImpl; static AssertImpl DefaultAssertImpl; AssertImpl* NextAssertImpl = nullptr; |