Fast callstack retrieval for linux.

This commit is contained in:
Bartosz Taudul 2019-03-05 18:56:39 +01:00
parent 1bbf296351
commit 4509412efb

View File

@ -314,12 +314,28 @@ static inline char* CopyString( const char* src )
return dst; return dst;
} }
static int FastCallstackDataCb( void* data, uintptr_t pc, const char* fn, int lineno, const char* function )
{
if( function )
{
strcpy( data, function );
}
else
{
*data = '\0';
}
return 1;
}
static void FastCallstackErrorCb( void* data, const char* /*msg*/, int /*errnum*/ )
{
*data = '\0';
}
const char* DecodeCallstackPtrFast( uint64_t ptr ) const char* DecodeCallstackPtrFast( uint64_t ptr )
{ {
static char ret[1024]; static char ret[1024];
backtrace_pcinfo( cb_bts, ptr, FastCallstackDataCb, FastCallstackErrorCb, ret );
// TODO
return ret; return ret;
} }