mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Add support for offline symbol resolving by setting the "TRACY_SYMBOL_OFFLINE_RESOLVE=1" env var
- Add a tool "tracy-edit" that allows loading a tracy capture, patching symbols and recompress the result - Add offline symbol resolvers for linux (using addr2line) and windows (using dbghelper)
This commit is contained in:
committed by
trodrigues
parent
906f73cab3
commit
f4f75eac64
+31
-3
@@ -553,11 +553,12 @@ Worker::Worker( const char* name, const char* program, const std::vector<ImportE
|
||||
}
|
||||
}
|
||||
|
||||
Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks, bool allowStringModification)
|
||||
: m_hasData( true )
|
||||
, m_stream( nullptr )
|
||||
, m_buffer( nullptr )
|
||||
, m_inconsistentSamples( false )
|
||||
, m_allowStringModification(allowStringModification)
|
||||
{
|
||||
auto loadStart = std::chrono::high_resolution_clock::now();
|
||||
|
||||
@@ -707,7 +708,12 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
|
||||
f.Read( sz );
|
||||
m_data.stringMap.reserve( sz );
|
||||
m_data.stringData.reserve_exact( sz, m_slab );
|
||||
|
||||
if( !m_allowStringModification )
|
||||
{
|
||||
m_data.stringData.reserve_exact( sz, m_slab );
|
||||
}
|
||||
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
{
|
||||
uint64_t ptr, ssz;
|
||||
@@ -716,7 +722,16 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
f.Read( dst, ssz );
|
||||
dst[ssz] = '\0';
|
||||
m_data.stringMap.emplace( charutil::StringKey { dst, size_t( ssz ) }, i );
|
||||
m_data.stringData[i] = ( dst );
|
||||
|
||||
if( m_allowStringModification )
|
||||
{
|
||||
m_data.stringData.push_back( dst );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_data.stringData[i] = ( dst );
|
||||
}
|
||||
|
||||
pointerMap.emplace( ptr, dst );
|
||||
}
|
||||
|
||||
@@ -2411,6 +2426,19 @@ const char* Worker::GetString( const StringIdx& idx ) const
|
||||
return m_data.stringData[idx.Idx()];
|
||||
}
|
||||
|
||||
uint32_t Worker::AddNewString(const char* newString)
|
||||
{
|
||||
assert(m_allowStringModification);
|
||||
uint64_t sz = strlen(newString);
|
||||
auto ptr = m_slab.Alloc<char>( sz+1 );
|
||||
memcpy( ptr, newString, sz );
|
||||
ptr[sz] = '\0';
|
||||
uint32_t idx = m_data.stringData.size();
|
||||
m_data.stringMap.emplace( charutil::StringKey { ptr, sz }, idx );
|
||||
m_data.stringData.push_back( ptr );
|
||||
return idx;
|
||||
}
|
||||
|
||||
static const char* BadExternalThreadNames[] = {
|
||||
"ntdll.dll",
|
||||
"???",
|
||||
|
||||
@@ -446,7 +446,7 @@ public:
|
||||
|
||||
Worker( const char* addr, uint16_t port );
|
||||
Worker( const char* name, const char* program, const std::vector<ImportEventTimeline>& timeline, const std::vector<ImportEventMessages>& messages, const std::vector<ImportEventPlots>& plots, const std::unordered_map<uint64_t, std::string>& threadNames );
|
||||
Worker( FileRead& f, EventType::Type eventMask = EventType::All, bool bgTasks = true );
|
||||
Worker( FileRead& f, EventType::Type eventMask = EventType::All, bool bgTasks = true, bool allowStringModification = false);
|
||||
~Worker();
|
||||
|
||||
const std::string& GetAddr() const { return m_addr; }
|
||||
@@ -549,6 +549,8 @@ public:
|
||||
StringIdx GetLocationForAddress( uint64_t address, uint32_t& line ) const;
|
||||
const uint64_t* GetInlineSymbolList( uint64_t sym, uint32_t len );
|
||||
|
||||
unordered_flat_map<CallstackFrameId, CallstackFrameData*, CallstackFrameIdHash, CallstackFrameIdCompare>& GetCallstackFrameMap() { return m_data.callstackFrameMap; }
|
||||
|
||||
#ifndef TRACY_NO_STATISTICS
|
||||
const VarArray<CallstackFrameId>& GetParentCallstack( uint32_t idx ) const { return *m_data.parentCallstackPayload[idx]; }
|
||||
const CallstackFrameData* GetParentCallstackFrame( const CallstackFrameId& ptr ) const;
|
||||
@@ -665,6 +667,8 @@ public:
|
||||
|
||||
void CacheSourceFiles();
|
||||
|
||||
uint32_t AddNewString(const char* newString);
|
||||
|
||||
private:
|
||||
void Network();
|
||||
void Exec();
|
||||
@@ -984,6 +988,7 @@ private:
|
||||
bool m_combineSamples;
|
||||
bool m_identifySamples = false;
|
||||
bool m_inconsistentSamples;
|
||||
bool m_allowStringModification = false;
|
||||
|
||||
short_ptr<GpuCtxData> m_gpuCtxMap[256];
|
||||
uint32_t m_pendingCallstackId = 0;
|
||||
|
||||
Reference in New Issue
Block a user