1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Support for callstacks on Linux without glibc

This commit is contained in:
Arvid Gerstmann
2018-07-14 11:08:17 +02:00
parent 561d2dc360
commit ad48c32e1e
2 changed files with 18 additions and 13 deletions
+13 -8
View File
@@ -2,18 +2,23 @@
#define __TRACYCALLSTACK_HPP__
#if defined _WIN32 || defined __CYGWIN__
# define TRACY_HAS_CALLSTACK
# define TRACY_HAS_CALLSTACK 1
extern "C"
{
typedef unsigned long (__stdcall *t_RtlWalkFrameChain)( void**, unsigned long, unsigned long );
extern t_RtlWalkFrameChain RtlWalkFrameChain;
}
#elif defined __ANDROID__
# define TRACY_HAS_CALLSTACK
# define TRACY_HAS_CALLSTACK 2
# include <unwind.h>
#elif defined _GNU_SOURCE
# define TRACY_HAS_CALLSTACK
# include <execinfo.h>
#elif defined __linux
# if defined _GNU_SOURCE && defined __has_include && __has_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
@@ -38,7 +43,7 @@ struct CallstackEntry
CallstackEntry DecodeCallstackPtr( uint64_t ptr );
#if defined _WIN32 || defined __CYGWIN__
#if TRACY_HAS_CALLSTACK == 1
void InitCallstack();
@@ -53,7 +58,7 @@ static tracy_force_inline void* Callstack( int depth )
return trace;
}
#elif defined __ANDROID__
#elif TRACY_HAS_CALLSTACK == 2
static tracy_force_inline void InitCallstack() {}
@@ -88,7 +93,7 @@ static tracy_force_inline void* Callstack( int depth )
return trace;
}
#elif defined _GNU_SOURCE
#elif TRACY_HAS_CALLSTACK == 3
static tracy_force_inline void InitCallstack() {}