mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Hide RtlWalkFrameChain inside library.
This commit is contained in:
parent
ae5c446652
commit
13370dc01c
@ -36,7 +36,11 @@ enum { MaxCbTrace = 16 };
|
|||||||
int cb_num;
|
int cb_num;
|
||||||
CallstackEntry cb_data[MaxCbTrace];
|
CallstackEntry cb_data[MaxCbTrace];
|
||||||
|
|
||||||
extern "C" { t_RtlWalkFrameChain RtlWalkFrameChain = 0; }
|
extern "C"
|
||||||
|
{
|
||||||
|
typedef unsigned long (__stdcall *t_RtlWalkFrameChain)( void**, unsigned long, unsigned long );
|
||||||
|
t_RtlWalkFrameChain RtlWalkFrameChain = 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined __MINGW32__ && API_VERSION_NUMBER < 12
|
#if defined __MINGW32__ && API_VERSION_NUMBER < 12
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -62,6 +66,14 @@ void InitCallstack()
|
|||||||
SymSetOptions( SYMOPT_LOAD_LINES );
|
SymSetOptions( SYMOPT_LOAD_LINES );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TRACY_API tracy_force_inline uintptr_t* CallTrace( int depth )
|
||||||
|
{
|
||||||
|
auto trace = (uintptr_t*)tracy_malloc( ( 1 + depth ) * sizeof( uintptr_t ) );
|
||||||
|
const auto num = RtlWalkFrameChain( (void**)( trace + 1 ), depth, 0 );
|
||||||
|
*trace = num;
|
||||||
|
return trace;
|
||||||
|
}
|
||||||
|
|
||||||
const char* DecodeCallstackPtrFast( uint64_t ptr )
|
const char* DecodeCallstackPtrFast( uint64_t ptr )
|
||||||
{
|
{
|
||||||
static char ret[1024];
|
static char ret[1024];
|
||||||
|
|||||||
@ -1,15 +1,10 @@
|
|||||||
#ifndef __TRACYCALLSTACK_HPP__
|
#ifndef __TRACYCALLSTACK_HPP__
|
||||||
#define __TRACYCALLSTACK_HPP__
|
#define __TRACYCALLSTACK_HPP__
|
||||||
|
|
||||||
|
#include "../common/TracyApi.h"
|
||||||
#include "TracyCallstack.h"
|
#include "TracyCallstack.h"
|
||||||
|
|
||||||
#if TRACY_HAS_CALLSTACK == 1
|
#if TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 5
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
typedef unsigned long (__stdcall *t_RtlWalkFrameChain)( void**, unsigned long, unsigned long );
|
|
||||||
extern t_RtlWalkFrameChain RtlWalkFrameChain;
|
|
||||||
}
|
|
||||||
#elif TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 5
|
|
||||||
# include <unwind.h>
|
# include <unwind.h>
|
||||||
#elif TRACY_HAS_CALLSTACK >= 3
|
#elif TRACY_HAS_CALLSTACK >= 3
|
||||||
# include <execinfo.h>
|
# include <execinfo.h>
|
||||||
@ -46,15 +41,12 @@ void InitCallstack();
|
|||||||
|
|
||||||
#if TRACY_HAS_CALLSTACK == 1
|
#if TRACY_HAS_CALLSTACK == 1
|
||||||
|
|
||||||
|
TRACY_API uintptr_t* CallTrace( int depth );
|
||||||
|
|
||||||
static tracy_force_inline void* Callstack( int depth )
|
static tracy_force_inline void* Callstack( int depth )
|
||||||
{
|
{
|
||||||
assert( depth >= 1 && depth < 63 );
|
assert( depth >= 1 && depth < 63 );
|
||||||
|
return CallTrace( depth );
|
||||||
auto trace = (uintptr_t*)tracy_malloc( ( 1 + depth ) * sizeof( uintptr_t ) );
|
|
||||||
const auto num = RtlWalkFrameChain( (void**)( trace + 1 ), depth, 0 );
|
|
||||||
*trace = num;
|
|
||||||
|
|
||||||
return trace;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 5
|
#elif TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 5
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user