Skip to content

Commit 12026da

Browse files
committed
Make ImageEntry m_startAddress/m_endAddress uint64_t as it will later be used in server, and thus not pointing to current process memory
1 parent 9665f7a commit 12026da

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

‎public/client/TracyCallstack.cpp‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class ImageCache
136136
Clear();
137137
}
138138

139-
const ImageEntry* GetImageForAddress( void* address )
139+
const ImageEntry* GetImageForAddress( uint64_t address )
140140
{
141141
const ImageEntry* entry = GetImageForAddressImpl( address );
142142
if( !entry )
@@ -156,12 +156,12 @@ class ImageCache
156156
{
157157
ImageCache* cache = reinterpret_cast<ImageCache*>( data );
158158

159-
const auto startAddress = reinterpret_cast<void*>( info->dlpi_addr );
159+
const auto startAddress = static_cast<uint64_t>( info->dlpi_addr );
160160
if( cache->Contains( startAddress ) ) return 0;
161161

162162
const uint32_t headerCount = info->dlpi_phnum;
163163
assert( headerCount > 0);
164-
const auto endAddress = reinterpret_cast<void*>( info->dlpi_addr +
164+
const auto endAddress = static_cast<uint64_t>( info->dlpi_addr +
165165
info->dlpi_phdr[info->dlpi_phnum - 1].p_vaddr + info->dlpi_phdr[info->dlpi_phnum - 1].p_memsz);
166166

167167
ImageEntry* image = cache->m_images.push_next();
@@ -186,7 +186,7 @@ class ImageCache
186186
return 0;
187187
}
188188

189-
bool Contains( void* startAddress ) const
189+
bool Contains( uint64_t startAddress ) const
190190
{
191191
return std::any_of( m_images.begin(), m_images.end(), [startAddress]( const ImageEntry& entry ) { return startAddress == entry.m_startAddress; } );
192192
}
@@ -236,10 +236,10 @@ class ImageCache
236236
m_haveMainImageName = true;
237237
}
238238

239-
const ImageEntry* GetImageForAddressImpl( void* address ) const
239+
const ImageEntry* GetImageForAddressImpl( uint64_t address ) const
240240
{
241241
auto it = std::lower_bound( m_images.begin(), m_images.end(), address,
242-
[]( const ImageEntry& lhs, const void* rhs ) { return lhs.m_startAddress > rhs; } );
242+
[]( const ImageEntry& lhs, const uint64_t rhs ) { return lhs.m_startAddress > rhs; } );
243243

244244
if( it != m_images.end() && address < it->m_endAddress )
245245
{
@@ -1273,7 +1273,7 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
12731273
uint64_t imageBaseAddress = 0x0;
12741274

12751275
#ifdef TRACY_USE_IMAGE_CACHE
1276-
const auto* image = s_imageCache->GetImageForAddress((void*)ptr);
1276+
const auto* image = s_imageCache->GetImageForAddress( ptr );
12771277
if( image )
12781278
{
12791279
imageName = image->m_name;

‎public/client/TracyCallstack.hpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef __TRACYCALLSTACK_HPP__
22
#define __TRACYCALLSTACK_HPP__
33

4+
#include <stdint.h>
5+
46
#include "../common/TracyApi.h"
57
#include "../common/TracyForceInline.hpp"
68
#include "TracyCallstack.h"
@@ -10,8 +12,8 @@ namespace tracy
1012

1113
struct ImageEntry
1214
{
13-
void* m_startAddress = nullptr;
14-
void* m_endAddress = nullptr;
15+
uint64_t m_startAddress = 0;
16+
uint64_t m_endAddress = 0;
1517
char* m_name = nullptr;
1618
};
1719

0 commit comments

Comments
 (0)