mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Implement retrieval of kernel symbol names.
This commit is contained in:
parent
0168ab6535
commit
4dc05ab858
@ -559,7 +559,7 @@ static void InitKernelSymbols()
|
||||
fclose( f );
|
||||
if( tmpSym.empty() ) return;
|
||||
|
||||
std::sort( tmpSym.begin(), tmpSym.end(), []( const KernelSymbol& lhs, const KernelSymbol& rhs ) { return lhs.addr < rhs.addr; } );
|
||||
std::sort( tmpSym.begin(), tmpSym.end(), []( const KernelSymbol& lhs, const KernelSymbol& rhs ) { return lhs.addr > rhs.addr; } );
|
||||
s_kernelSymCnt = tmpSym.size();
|
||||
s_kernelSym = (KernelSymbol*)tracy_malloc_fast( sizeof( KernelSymbol ) * s_kernelSymCnt );
|
||||
memcpy( s_kernelSym, tmpSym.data(), sizeof( KernelSymbol ) * s_kernelSymCnt );
|
||||
@ -802,7 +802,8 @@ void SymInfoError( void* /*data*/, const char* /*msg*/, int /*errnum*/ )
|
||||
CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
|
||||
{
|
||||
InitRpmalloc();
|
||||
|
||||
if( ptr >> 63 == 0 )
|
||||
{
|
||||
cb_num = 0;
|
||||
backtrace_pcinfo( cb_bts, ptr, CallstackDataCb, CallstackErrorCb, nullptr );
|
||||
assert( cb_num > 0 );
|
||||
@ -815,6 +816,27 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
|
||||
|
||||
return { cb_data, uint8_t( cb_num ), symloc ? symloc : "[unknown]" };
|
||||
}
|
||||
else if( s_kernelSym )
|
||||
{
|
||||
auto it = std::lower_bound( s_kernelSym, s_kernelSym + s_kernelSymCnt, ptr, []( const KernelSymbol& lhs, const uint64_t& rhs ) { return lhs.addr > rhs; } );
|
||||
if( it != s_kernelSym + s_kernelSymCnt )
|
||||
{
|
||||
cb_data[0].name = CopyStringFast( it->name );
|
||||
cb_data[0].file = CopyStringFast( "<kernel>" );
|
||||
cb_data[0].line = 0;
|
||||
cb_data[0].symLen = 0;
|
||||
cb_data[0].symAddr = it->addr;
|
||||
return { cb_data, 1, it->mod ? it->mod : "<kernel>" };
|
||||
}
|
||||
}
|
||||
|
||||
cb_data[0].name = CopyStringFast( "[unknown]" );
|
||||
cb_data[0].file = CopyStringFast( "<kernel>" );
|
||||
cb_data[0].line = 0;
|
||||
cb_data[0].symLen = 0;
|
||||
cb_data[0].symAddr = 0;
|
||||
return { cb_data, 1, "<kernel>" };
|
||||
}
|
||||
|
||||
#elif TRACY_HAS_CALLSTACK == 5
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user