1#include <Foundation/FoundationInternal.h>
2PL_FOUNDATION_INTERNAL_HEADER
4#include <Foundation/System/StackTracer.h>
6#include <Foundation/Math/Math.h>
8#if __has_include(<execinfo.h>)
10# define HAS_EXECINFO 1
33 char** ppSymbols = backtrace_symbols(trace.
GetPtr(), trace.
GetCount());
35 if (ppSymbols !=
nullptr)
37 for (plUInt32 i = 0; i < trace.
GetCount(); i++)
39 size_t uiLen =
plMath::Min(strlen(ppSymbols[i]),
static_cast<size_t>(PL_ARRAY_SIZE(szBuffer)) - 2);
40 memcpy(szBuffer, ppSymbols[i], uiLen);
41 szBuffer[uiLen] =
'\n';
42 szBuffer[uiLen + 1] =
'\0';
50 printFunc(
"Could not record stack trace on this Linux system, because execinfo.h is not available.");
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
PL_ALWAYS_INLINE plUInt32 GetCount() const
Returns the number of elements in the array.
Definition ArrayPtr.h:142
PL_ALWAYS_INLINE PointerType GetPtr() const
Returns the pointer to the array.
Definition ArrayPtr.h:118
static void ResolveStackTrace(const plArrayPtr< void * > &trace, PrintFunc printFunc)
Print a stack trace.
Definition StackTracer_NoImpl.h:12
static plUInt32 GetStackTrace(plArrayPtr< void * > &ref_trace, void *pContext=nullptr)
Captures the current stack trace.
Definition StackTracer_NoImpl.h:7
constexpr PL_ALWAYS_INLINE T Min(T f1, T f2)
Returns the smaller value, f1 or f2.
Definition Math_inl.h:27
The data that is broadcast whenever a plugin is (un-) loaded.
Definition Plugin.h:11