mirror of
https://github.com/bkaradzic/bx.git
synced 2026-10-06 08:55:38 +00:00
Lazy load debug help once it's needed to resolve callstack. (#383)
This commit is contained in:
committed by
GitHub
parent
c6131ec676
commit
3ea49f98d6
@@ -46,6 +46,10 @@
|
||||
# include <backtrace.h> // backtrace_syminfo
|
||||
#endif // BX_CONFIG_CALLSTACK_*
|
||||
|
||||
#ifndef BX_CONFIG_CALLSTACK_USE_DBGHELP
|
||||
# define BX_CONFIG_CALLSTACK_USE_DBGHELP BX_PLATFORM_WINDOWS
|
||||
#endif // BX_CONFIG_CALLSTACK_USE_DBGHELP
|
||||
|
||||
#ifndef BX_CONFIG_EXCEPTION_HANDLING_USE_WINDOWS_SEH
|
||||
# define BX_CONFIG_EXCEPTION_HANDLING_USE_WINDOWS_SEH BX_PLATFORM_WINDOWS
|
||||
#endif // BX_CONFIG_EXCEPTION_HANDLING_USE_WINDOWS_SEH
|
||||
@@ -684,7 +688,7 @@ namespace bx
|
||||
return total;
|
||||
}
|
||||
|
||||
#elif BX_PLATFORM_WINDOWS
|
||||
#elif BX_CONFIG_CALLSTACK_USE_DBGHELP
|
||||
|
||||
struct DbgHelpSymbolInfo
|
||||
{
|
||||
@@ -729,7 +733,7 @@ namespace bx
|
||||
|
||||
struct DbgHelpSymbolResolve
|
||||
{
|
||||
DbgHelpSymbolResolve()
|
||||
void init()
|
||||
{
|
||||
m_imageHlpDll = dlopen("dbghelp.dll");
|
||||
|
||||
@@ -855,6 +859,15 @@ namespace bx
|
||||
|
||||
total += write(_writer, _err, "\t #: %-*s Line %-*s Function ---\n", kWidth, "File ---", kWidthPc, "PC ---");
|
||||
|
||||
static bool initCalled = false;
|
||||
|
||||
if (!initCalled)
|
||||
{
|
||||
initCalled = true;
|
||||
|
||||
s_dbgHelpSymbolResolve.init();
|
||||
}
|
||||
|
||||
for (uint32_t ii = 0; ii < _num && _err->isOk(); ++ii)
|
||||
{
|
||||
FixedString1024 functionName;
|
||||
|
||||
Reference in New Issue
Block a user