Skip to content

Commit e1e9fb6

Browse files
committed
Rename TRACY_USE_IMAGE_CACHE to TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE
Windows is already using a cache, and the only platforms that won't have one for now are those without dl_iterate_phdr.
1 parent 3b5b32d commit e1e9fb6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

‎public/client/TracyCallstack.cpp‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ extern "C" const char* ___tracy_demangle( const char* mangled )
110110
#endif
111111

112112
#if defined(TRACY_USE_LIBBACKTRACE) && TRACY_HAS_CALLSTACK != 4 // dl_iterate_phdr is required for the current image cache. Need to move it to libbacktrace?
113-
# define TRACY_USE_IMAGE_CACHE
113+
# define TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE
114114
# include <link.h>
115115
#endif
116116

@@ -188,7 +188,7 @@ class ImageCache
188188
bool m_sorted = true;
189189
};
190190

191-
#ifdef TRACY_USE_IMAGE_CACHE
191+
#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE
192192
// when we have access to dl_iterate_phdr(), we can build a cache of address ranges to image paths
193193
// so we can quickly determine which image an address falls into.
194194
// We refresh this cache only when we hit an address that doesn't fall into any known range.
@@ -294,7 +294,7 @@ class ImageCacheDlIteratePhdr : public ImageCache
294294
m_haveMainImageName = false;
295295
}
296296
};
297-
#endif //#ifdef TRACY_USE_IMAGE_CACHE
297+
#endif //#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE
298298

299299
// when "TRACY_SYMBOL_OFFLINE_RESOLVE" is set, instead of fully resolving symbols at runtime,
300300
// simply resolve the offset and image name (which will be enough the resolving to be done offline)
@@ -812,9 +812,9 @@ struct backtrace_state* cb_bts = nullptr;
812812
int cb_num;
813813
CallstackEntry cb_data[MaxCbTrace];
814814
int cb_fixup;
815-
#ifdef TRACY_USE_IMAGE_CACHE
815+
#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE
816816
static ImageCacheDlIteratePhdr* s_imageCache = nullptr;
817-
#endif //#ifdef TRACY_USE_IMAGE_CACHE
817+
#endif //#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE
818818

819819
#ifdef TRACY_DEBUGINFOD
820820
debuginfod_client* s_debuginfod;
@@ -1009,10 +1009,10 @@ void InitCallstack()
10091009
{
10101010
InitRpmalloc();
10111011

1012-
#ifdef TRACY_USE_IMAGE_CACHE
1012+
#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE
10131013
s_imageCache = (ImageCacheDlIteratePhdr*)tracy_malloc( sizeof( ImageCacheDlIteratePhdr ) );
10141014
new(s_imageCache) ImageCacheDlIteratePhdr();
1015-
#endif //#ifdef TRACY_USE_IMAGE_CACHE
1015+
#endif //#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE
10161016

10171017
#ifndef TRACY_SYMBOL_OFFLINE_RESOLVE
10181018
s_shouldResolveSymbolsOffline = ShouldResolveSymbolsOffline();
@@ -1106,13 +1106,13 @@ debuginfod_client* GetDebuginfodClient()
11061106

11071107
void EndCallstack()
11081108
{
1109-
#ifdef TRACY_USE_IMAGE_CACHE
1109+
#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE
11101110
if( s_imageCache )
11111111
{
11121112
s_imageCache->~ImageCacheDlIteratePhdr();
11131113
tracy_free( s_imageCache );
11141114
}
1115-
#endif //#ifdef TRACY_USE_IMAGE_CACHE
1115+
#endif //#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE
11161116
#ifndef TRACY_DEMANGLE
11171117
___tracy_free_demangle_buffer();
11181118
#endif
@@ -1307,7 +1307,7 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
13071307
const char* imageName = nullptr;
13081308
uint64_t imageBaseAddress = 0x0;
13091309

1310-
#ifdef TRACY_USE_IMAGE_CACHE
1310+
#ifdef TRACY_HAS_DL_ITERATE_PHDR_TO_REFRESH_IMAGE_CACHE
13111311
const auto* image = s_imageCache->GetImageForAddress( ptr );
13121312
if( image )
13131313
{

0 commit comments

Comments
 (0)