mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Add offset-less GetSymbolForAddress().
This commit is contained in:
parent
a34cfacb5c
commit
02e1a7669c
@ -239,8 +239,7 @@ bool View::ViewDispatch( const char* fileName, int line, uint64_t symAddr )
|
|||||||
if( sit != symMap.end() ) symlen = sit->second.size.Val();
|
if( sit != symMap.end() ) symlen = sit->second.size.Val();
|
||||||
if( symlen == 0 )
|
if( symlen == 0 )
|
||||||
{
|
{
|
||||||
uint32_t offset;
|
const auto parentAddr = m_worker.GetSymbolForAddress( symAddr );
|
||||||
const auto parentAddr = m_worker.GetSymbolForAddress( symAddr, offset );
|
|
||||||
if( parentAddr != 0 )
|
if( parentAddr != 0 )
|
||||||
{
|
{
|
||||||
auto pit = symMap.find( parentAddr );
|
auto pit = symMap.find( parentAddr );
|
||||||
@ -11301,8 +11300,7 @@ void View::DrawStatistics()
|
|||||||
bool pass = m_statisticsFilter.PassFilter( name );
|
bool pass = m_statisticsFilter.PassFilter( name );
|
||||||
if( !pass && v.second.size.Val() == 0 )
|
if( !pass && v.second.size.Val() == 0 )
|
||||||
{
|
{
|
||||||
uint32_t offset;
|
const auto parentAddr = m_worker.GetSymbolForAddress( v.first );
|
||||||
const auto parentAddr = m_worker.GetSymbolForAddress( v.first, offset );
|
|
||||||
if( parentAddr != 0 )
|
if( parentAddr != 0 )
|
||||||
{
|
{
|
||||||
auto pit = symMap.find( parentAddr );
|
auto pit = symMap.find( parentAddr );
|
||||||
@ -11357,8 +11355,7 @@ void View::DrawStatistics()
|
|||||||
bool pass = m_statisticsFilter.PassFilter( name );
|
bool pass = m_statisticsFilter.PassFilter( name );
|
||||||
if( !pass && sit->second.size.Val() == 0 )
|
if( !pass && sit->second.size.Val() == 0 )
|
||||||
{
|
{
|
||||||
uint32_t offset;
|
const auto parentAddr = m_worker.GetSymbolForAddress( v.first );
|
||||||
const auto parentAddr = m_worker.GetSymbolForAddress( v.first, offset );
|
|
||||||
if( parentAddr != 0 )
|
if( parentAddr != 0 )
|
||||||
{
|
{
|
||||||
auto pit = symMap.find( parentAddr );
|
auto pit = symMap.find( parentAddr );
|
||||||
@ -11484,8 +11481,7 @@ void View::DrawStatistics()
|
|||||||
const char* parentName = nullptr;
|
const char* parentName = nullptr;
|
||||||
if( symlen == 0 )
|
if( symlen == 0 )
|
||||||
{
|
{
|
||||||
uint32_t offset;
|
const auto parentAddr = m_worker.GetSymbolForAddress( v.symAddr );
|
||||||
const auto parentAddr = m_worker.GetSymbolForAddress( v.symAddr, offset );
|
|
||||||
if( parentAddr != 0 )
|
if( parentAddr != 0 )
|
||||||
{
|
{
|
||||||
auto pit = symMap.find( parentAddr );
|
auto pit = symMap.find( parentAddr );
|
||||||
|
@ -2397,6 +2397,13 @@ const char* Worker::GetSymbolCode( uint64_t sym, uint32_t& len ) const
|
|||||||
return it->second.data;
|
return it->second.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t Worker::GetSymbolForAddress( uint64_t address ) const
|
||||||
|
{
|
||||||
|
auto it = std::lower_bound( m_data.symbolLoc.begin(), m_data.symbolLoc.end(), address, [] ( const auto& l, const auto& r ) { return l.addr + l.len < r; } );
|
||||||
|
if( it == m_data.symbolLoc.end() || address < it->addr ) return 0;
|
||||||
|
return it->addr;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t Worker::GetSymbolForAddress( uint64_t address, uint32_t& offset ) const
|
uint64_t Worker::GetSymbolForAddress( uint64_t address, uint32_t& offset ) const
|
||||||
{
|
{
|
||||||
auto it = std::lower_bound( m_data.symbolLoc.begin(), m_data.symbolLoc.end(), address, [] ( const auto& l, const auto& r ) { return l.addr + l.len < r; } );
|
auto it = std::lower_bound( m_data.symbolLoc.begin(), m_data.symbolLoc.end(), address, [] ( const auto& l, const auto& r ) { return l.addr + l.len < r; } );
|
||||||
|
@ -438,6 +438,7 @@ public:
|
|||||||
uint64_t GetCanonicalPointer( const CallstackFrameId& id ) const;
|
uint64_t GetCanonicalPointer( const CallstackFrameId& id ) const;
|
||||||
const SymbolData* GetSymbolData( uint64_t sym ) const;
|
const SymbolData* GetSymbolData( uint64_t sym ) const;
|
||||||
const char* GetSymbolCode( uint64_t sym, uint32_t& len ) const;
|
const char* GetSymbolCode( uint64_t sym, uint32_t& len ) const;
|
||||||
|
uint64_t GetSymbolForAddress( uint64_t address ) const;
|
||||||
uint64_t GetSymbolForAddress( uint64_t address, uint32_t& offset ) const;
|
uint64_t GetSymbolForAddress( uint64_t address, uint32_t& offset ) const;
|
||||||
StringIdx GetLocationForAddress( uint64_t address, uint32_t& line ) const;
|
StringIdx GetLocationForAddress( uint64_t address, uint32_t& line ) const;
|
||||||
const Vector<uint64_t>* GetAddressesForLocation( uint32_t fileStringIdx, uint32_t line ) const;
|
const Vector<uint64_t>* GetAddressesForLocation( uint32_t fileStringIdx, uint32_t line ) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user