mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Remove CodeLocation query and CodeInformation response.
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
#include "TracyFastVector.hpp"
|
||||
#include "TracyStringHelpers.hpp"
|
||||
#include "../common/TracyAlloc.hpp"
|
||||
#include "../common/TracyStackFrames.hpp"
|
||||
#include "TracyDebug.hpp"
|
||||
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
@@ -385,85 +384,6 @@ CallstackSymbolData DecodeSymbolAddress( uint64_t ptr )
|
||||
return sym;
|
||||
}
|
||||
|
||||
CallstackSymbolData DecodeCodeAddress( uint64_t ptr )
|
||||
{
|
||||
CallstackSymbolData sym = {};
|
||||
const auto proc = GetCurrentProcess();
|
||||
bool done = false;
|
||||
|
||||
char buf[sizeof( SYMBOL_INFO ) + MaxNameSize];
|
||||
auto si = (SYMBOL_INFO*)buf;
|
||||
si->SizeOfStruct = sizeof( SYMBOL_INFO );
|
||||
si->MaxNameLen = MaxNameSize;
|
||||
|
||||
IMAGEHLP_LINE64 line;
|
||||
DWORD displacement = 0;
|
||||
line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
|
||||
|
||||
#ifdef TRACY_DBGHELP_LOCK
|
||||
DBGHELP_LOCK;
|
||||
#endif
|
||||
#if !defined TRACY_NO_CALLSTACK_INLINES
|
||||
if( _SymAddrIncludeInlineTrace )
|
||||
{
|
||||
DWORD inlineNum = _SymAddrIncludeInlineTrace( proc, ptr );
|
||||
DWORD ctx = 0;
|
||||
DWORD idx;
|
||||
BOOL doInline = FALSE;
|
||||
if( inlineNum != 0 ) doInline = _SymQueryInlineTrace( proc, ptr, 0, ptr, ptr, &ctx, &idx );
|
||||
if( doInline )
|
||||
{
|
||||
if( _SymGetLineFromInlineContext( proc, ptr, ctx, 0, &displacement, &line ) != 0 )
|
||||
{
|
||||
sym.file = CopyString( line.FileName );
|
||||
sym.line = line.LineNumber;
|
||||
sym.needFree = true;
|
||||
done = true;
|
||||
|
||||
if( _SymFromInlineContext( proc, ptr, ctx, nullptr, si ) != 0 )
|
||||
{
|
||||
sym.symAddr = si->Address;
|
||||
}
|
||||
else
|
||||
{
|
||||
sym.symAddr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if( !done )
|
||||
{
|
||||
const auto res = SymGetLineFromAddr64( proc, ptr, &displacement, &line );
|
||||
if( res == 0 || line.LineNumber >= 0xF00000 )
|
||||
{
|
||||
sym.file = "[unknown]";
|
||||
sym.line = 0;
|
||||
sym.symAddr = 0;
|
||||
sym.needFree = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sym.file = CopyString( line.FileName );
|
||||
sym.line = line.LineNumber;
|
||||
sym.needFree = true;
|
||||
|
||||
if( SymFromAddr( proc, ptr, nullptr, si ) != 0 )
|
||||
{
|
||||
sym.symAddr = si->Address;
|
||||
}
|
||||
else
|
||||
{
|
||||
sym.symAddr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef TRACY_DBGHELP_LOCK
|
||||
DBGHELP_UNLOCK;
|
||||
#endif
|
||||
return sym;
|
||||
}
|
||||
|
||||
CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
|
||||
{
|
||||
int write;
|
||||
@@ -900,42 +820,6 @@ CallstackSymbolData DecodeSymbolAddress( uint64_t ptr )
|
||||
return sym;
|
||||
}
|
||||
|
||||
static int CodeDataCb( void* data, uintptr_t pc, uintptr_t lowaddr, const char* fn, int lineno, const char* function )
|
||||
{
|
||||
if( !fn ) return 1;
|
||||
|
||||
const auto fnsz = strlen( fn );
|
||||
if( fnsz >= s_tracySkipSubframesMinLen )
|
||||
{
|
||||
auto ptr = s_tracySkipSubframes;
|
||||
do
|
||||
{
|
||||
if( fnsz >= ptr->len && memcmp( fn + fnsz - ptr->len, ptr->str, ptr->len ) == 0 ) return 0;
|
||||
ptr++;
|
||||
}
|
||||
while( ptr->str );
|
||||
}
|
||||
|
||||
auto& sym = *(CallstackSymbolData*)data;
|
||||
sym.file = NormalizePath( fn );
|
||||
if( !sym.file ) sym.file = CopyString( fn );
|
||||
sym.line = lineno;
|
||||
sym.needFree = true;
|
||||
sym.symAddr = lowaddr;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void CodeErrorCb( void* /*data*/, const char* /*msg*/, int /*errnum*/ )
|
||||
{
|
||||
}
|
||||
|
||||
CallstackSymbolData DecodeCodeAddress( uint64_t ptr )
|
||||
{
|
||||
CallstackSymbolData sym = { "[unknown]", 0, false, 0 };
|
||||
backtrace_pcinfo( cb_bts, ptr, CodeDataCb, CodeErrorCb, &sym );
|
||||
return sym;
|
||||
}
|
||||
|
||||
static int CallstackDataCb( void* /*data*/, uintptr_t pc, uintptr_t lowaddr, const char* fn, int lineno, const char* function )
|
||||
{
|
||||
cb_data[cb_num].symLen = 0;
|
||||
@@ -1122,11 +1006,6 @@ CallstackSymbolData DecodeSymbolAddress( uint64_t ptr )
|
||||
return CallstackSymbolData { symloc, 0, false, 0 };
|
||||
}
|
||||
|
||||
CallstackSymbolData DecodeCodeAddress( uint64_t ptr )
|
||||
{
|
||||
return DecodeSymbolAddress( ptr );
|
||||
}
|
||||
|
||||
CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
|
||||
{
|
||||
static CallstackEntry cb;
|
||||
|
||||
@@ -51,7 +51,6 @@ struct CallstackEntryData
|
||||
};
|
||||
|
||||
CallstackSymbolData DecodeSymbolAddress( uint64_t ptr );
|
||||
CallstackSymbolData DecodeCodeAddress( uint64_t ptr );
|
||||
const char* DecodeCallstackPtrFast( uint64_t ptr );
|
||||
CallstackEntryData DecodeCallstackPtr( uint64_t ptr );
|
||||
void InitCallstack();
|
||||
|
||||
@@ -2173,16 +2173,6 @@ static void FreeAssociatedMemory( const QueueItem& item )
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QueueType::CodeInformation:
|
||||
{
|
||||
uint8_t needFree = MemRead<uint8_t>( &item.codeInformationFat.needFree );
|
||||
if( needFree )
|
||||
{
|
||||
ptr = MemRead<uint64_t>( &item.codeInformationFat.fileString );
|
||||
tracy_free( (void*)ptr );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QueueType::SymbolCodeMetadata:
|
||||
ptr = MemRead<uint64_t>( &item.symbolCodeMetadata.ptr );
|
||||
tracy_free( (void*)ptr );
|
||||
@@ -2481,14 +2471,6 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
|
||||
if( needFree ) tracy_free_fast( (void*)fileString );
|
||||
break;
|
||||
}
|
||||
case QueueType::CodeInformation:
|
||||
{
|
||||
auto fileString = (const char*)MemRead<uint64_t>( &item->codeInformationFat.fileString );
|
||||
auto needFree = MemRead<uint8_t>( &item->codeInformationFat.needFree );
|
||||
SendSingleString( fileString );
|
||||
if( needFree ) tracy_free_fast( (void*)fileString );
|
||||
break;
|
||||
}
|
||||
case QueueType::SymbolCodeMetadata:
|
||||
{
|
||||
auto symbol = MemRead<uint64_t>( &item->symbolCodeMetadata.symbol );
|
||||
@@ -3163,15 +3145,6 @@ void Profiler::QueueSymbolQuery( uint64_t symbol )
|
||||
#endif
|
||||
}
|
||||
|
||||
void Profiler::QueueCodeLocation( uint64_t ptr )
|
||||
{
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
m_symbolQueue.emplace( SymbolQueueItem { SymbolQueueItemType::CodeLocation, ptr } );
|
||||
#else
|
||||
AckServerQuery();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Profiler::QueueExternalName( uint64_t ptr )
|
||||
{
|
||||
#ifdef TRACY_HAS_SYSTEM_TRACING
|
||||
@@ -3228,19 +3201,6 @@ void Profiler::HandleSymbolQueueItem( const SymbolQueueItem& si )
|
||||
TracyLfqCommit;
|
||||
break;
|
||||
}
|
||||
case SymbolQueueItemType::CodeLocation:
|
||||
{
|
||||
const auto sym = DecodeCodeAddress( si.ptr );
|
||||
const uint64_t offset = si.ptr - sym.symAddr;
|
||||
TracyLfqPrepare( QueueType::CodeInformation );
|
||||
MemWrite( &item->codeInformationFat.ptrOffset, offset );
|
||||
MemWrite( &item->codeInformationFat.line, sym.line );
|
||||
MemWrite( &item->codeInformationFat.symAddr, sym.symAddr );
|
||||
MemWrite( &item->codeInformationFat.fileString, (uint64_t)sym.file );
|
||||
MemWrite( &item->codeInformationFat.needFree, (uint8_t)sym.needFree );
|
||||
TracyLfqCommit;
|
||||
break;
|
||||
}
|
||||
#ifdef TRACY_HAS_SYSTEM_TRACING
|
||||
case SymbolQueueItemType::ExternalName:
|
||||
{
|
||||
@@ -3404,9 +3364,6 @@ bool Profiler::HandleServerQuery()
|
||||
HandleSymbolCodeQuery( ptr, extra );
|
||||
break;
|
||||
#endif
|
||||
case ServerQueryCodeLocation:
|
||||
QueueCodeLocation( ptr );
|
||||
break;
|
||||
case ServerQuerySourceCode:
|
||||
HandleSourceCodeQuery();
|
||||
break;
|
||||
|
||||
@@ -167,7 +167,6 @@ class Profiler
|
||||
{
|
||||
CallstackFrame,
|
||||
SymbolQuery,
|
||||
CodeLocation,
|
||||
ExternalName,
|
||||
KernelCode
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user