mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Support for callstacks on Linux without glibc
This commit is contained in:
parent
561d2dc360
commit
ad48c32e1e
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
#ifdef TRACY_HAS_CALLSTACK
|
#ifdef TRACY_HAS_CALLSTACK
|
||||||
|
|
||||||
#if defined _WIN32 || defined __CYGWIN__
|
#if TRACY_HAS_CALLSTACK == 1
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <dbghelp.h>
|
# include <dbghelp.h>
|
||||||
#elif defined _GNU_SOURCE
|
#elif TRACY_HAS_CALLSTACK >= 2
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# include <cxxabi.h>
|
# include <cxxabi.h>
|
||||||
#endif
|
#endif
|
||||||
@ -14,7 +14,7 @@
|
|||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined _WIN32 || defined __CYGWIN__
|
#if TRACY_HAS_CALLSTACK == 1
|
||||||
|
|
||||||
extern "C" t_RtlWalkFrameChain RtlWalkFrameChain = 0;
|
extern "C" t_RtlWalkFrameChain RtlWalkFrameChain = 0;
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ CallstackEntry DecodeCallstackPtr( uint64_t ptr )
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined __ANDROID__
|
#elif TRACY_HAS_CALLSTACK == 2
|
||||||
|
|
||||||
CallstackEntry DecodeCallstackPtr( uint64_t ptr )
|
CallstackEntry DecodeCallstackPtr( uint64_t ptr )
|
||||||
{
|
{
|
||||||
@ -156,7 +156,7 @@ CallstackEntry DecodeCallstackPtr( uint64_t ptr )
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined _GNU_SOURCE
|
#elif TRACY_HAS_CALLSTACK == 3
|
||||||
|
|
||||||
CallstackEntry DecodeCallstackPtr( uint64_t ptr )
|
CallstackEntry DecodeCallstackPtr( uint64_t ptr )
|
||||||
{
|
{
|
||||||
|
@ -2,18 +2,23 @@
|
|||||||
#define __TRACYCALLSTACK_HPP__
|
#define __TRACYCALLSTACK_HPP__
|
||||||
|
|
||||||
#if defined _WIN32 || defined __CYGWIN__
|
#if defined _WIN32 || defined __CYGWIN__
|
||||||
# define TRACY_HAS_CALLSTACK
|
# define TRACY_HAS_CALLSTACK 1
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
typedef unsigned long (__stdcall *t_RtlWalkFrameChain)( void**, unsigned long, unsigned long );
|
typedef unsigned long (__stdcall *t_RtlWalkFrameChain)( void**, unsigned long, unsigned long );
|
||||||
extern t_RtlWalkFrameChain RtlWalkFrameChain;
|
extern t_RtlWalkFrameChain RtlWalkFrameChain;
|
||||||
}
|
}
|
||||||
#elif defined __ANDROID__
|
#elif defined __ANDROID__
|
||||||
# define TRACY_HAS_CALLSTACK
|
# define TRACY_HAS_CALLSTACK 2
|
||||||
# include <unwind.h>
|
# include <unwind.h>
|
||||||
#elif defined _GNU_SOURCE
|
#elif defined __linux
|
||||||
# define TRACY_HAS_CALLSTACK
|
# if defined _GNU_SOURCE && defined __has_include && __has_include(<execinfo.h>)
|
||||||
# include <execinfo.h>
|
# define TRACY_HAS_CALLSTACK 3
|
||||||
|
# include <execinfo.h>
|
||||||
|
# elif defined __has_include && __has_include(<unwind.h>)
|
||||||
|
# define TRACY_HAS_CALLSTACK 2
|
||||||
|
# include <unwind.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +43,7 @@ struct CallstackEntry
|
|||||||
|
|
||||||
CallstackEntry DecodeCallstackPtr( uint64_t ptr );
|
CallstackEntry DecodeCallstackPtr( uint64_t ptr );
|
||||||
|
|
||||||
#if defined _WIN32 || defined __CYGWIN__
|
#if TRACY_HAS_CALLSTACK == 1
|
||||||
|
|
||||||
void InitCallstack();
|
void InitCallstack();
|
||||||
|
|
||||||
@ -53,7 +58,7 @@ static tracy_force_inline void* Callstack( int depth )
|
|||||||
return trace;
|
return trace;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined __ANDROID__
|
#elif TRACY_HAS_CALLSTACK == 2
|
||||||
|
|
||||||
static tracy_force_inline void InitCallstack() {}
|
static tracy_force_inline void InitCallstack() {}
|
||||||
|
|
||||||
@ -88,7 +93,7 @@ static tracy_force_inline void* Callstack( int depth )
|
|||||||
return trace;
|
return trace;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined _GNU_SOURCE
|
#elif TRACY_HAS_CALLSTACK == 3
|
||||||
|
|
||||||
static tracy_force_inline void InitCallstack() {}
|
static tracy_force_inline void InitCallstack() {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user