mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 16:54:35 +00:00
Propagate inlines to src line addresses.
This commit is contained in:
parent
ba34596b91
commit
5db18087f5
@ -253,6 +253,7 @@ SourceView::SourceView()
|
|||||||
, m_propagateInlines( false )
|
, m_propagateInlines( false )
|
||||||
, m_cost( CostType::SampleCount )
|
, m_cost( CostType::SampleCount )
|
||||||
, m_showJumps( true )
|
, m_showJumps( true )
|
||||||
|
, m_locAddrIsProp( false )
|
||||||
, m_cpuArch( CpuArchUnknown )
|
, m_cpuArch( CpuArchUnknown )
|
||||||
, m_showLatency( false )
|
, m_showLatency( false )
|
||||||
{
|
{
|
||||||
@ -943,17 +944,6 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker )
|
|||||||
const auto idx = srcidx.Idx();
|
const auto idx = srcidx.Idx();
|
||||||
auto sit = m_sourceFiles.find( idx );
|
auto sit = m_sourceFiles.find( idx );
|
||||||
if( sit == m_sourceFiles.end() ) m_sourceFiles.emplace( idx, srcline );
|
if( sit == m_sourceFiles.end() ) m_sourceFiles.emplace( idx, srcline );
|
||||||
const auto packed = PackFileLine( idx, srcline );
|
|
||||||
auto lit = m_locationAddress.find( packed );
|
|
||||||
if( lit == m_locationAddress.end() )
|
|
||||||
{
|
|
||||||
m_locationAddress.emplace( packed, std::vector<uint64_t>( { op.address } ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
assert( lit->second.back() < op.address );
|
|
||||||
lit->second.push_back( op.address );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
char tmp[16];
|
char tmp[16];
|
||||||
sprintf( tmp, "%" PRIu32, mLineMax );
|
sprintf( tmp, "%" PRIu32, mLineMax );
|
||||||
@ -2123,7 +2113,7 @@ void SourceView::RenderSymbolSourceView( const AddrStatData& as, Worker& worker,
|
|||||||
{
|
{
|
||||||
if( as.ipCountSrc.find( lineNum ) == as.ipCountSrc.end() )
|
if( as.ipCountSrc.find( lineNum ) == as.ipCountSrc.end() )
|
||||||
{
|
{
|
||||||
auto addresses = GetAddressesForLocation( m_source.idx(), lineNum );
|
auto addresses = GetAddressesForLocation( m_source.idx(), lineNum, worker );
|
||||||
if( addresses )
|
if( addresses )
|
||||||
{
|
{
|
||||||
for( auto& addr : *addresses )
|
for( auto& addr : *addresses )
|
||||||
@ -3143,7 +3133,7 @@ void SourceView::RenderLine( const Tokenizer::Line& line, int lineNum, const Add
|
|||||||
if( !m_asm.empty() )
|
if( !m_asm.empty() )
|
||||||
{
|
{
|
||||||
assert( worker && view );
|
assert( worker && view );
|
||||||
auto addresses = GetAddressesForLocation( m_source.idx(), lineNum );
|
auto addresses = GetAddressesForLocation( m_source.idx(), lineNum, *worker );
|
||||||
if( addresses )
|
if( addresses )
|
||||||
{
|
{
|
||||||
for( auto& addr : *addresses )
|
for( auto& addr : *addresses )
|
||||||
@ -4768,7 +4758,7 @@ void SourceView::SelectLine( uint32_t line, const Worker* worker, bool updateAsm
|
|||||||
void SourceView::SelectAsmLines( uint32_t file, uint32_t line, const Worker& worker, bool updateAsmLine, uint64_t targetAddr, bool changeAsmLine )
|
void SourceView::SelectAsmLines( uint32_t file, uint32_t line, const Worker& worker, bool updateAsmLine, uint64_t targetAddr, bool changeAsmLine )
|
||||||
{
|
{
|
||||||
m_selectedAddresses.clear();
|
m_selectedAddresses.clear();
|
||||||
auto addresses = GetAddressesForLocation( file, line );
|
auto addresses = GetAddressesForLocation( file, line, worker );
|
||||||
if( addresses )
|
if( addresses )
|
||||||
{
|
{
|
||||||
const auto& addr = *addresses;
|
const auto& addr = *addresses;
|
||||||
@ -4826,7 +4816,7 @@ void SourceView::SelectAsmLines( uint32_t file, uint32_t line, const Worker& wor
|
|||||||
void SourceView::SelectAsmLinesHover( uint32_t file, uint32_t line, const Worker& worker )
|
void SourceView::SelectAsmLinesHover( uint32_t file, uint32_t line, const Worker& worker )
|
||||||
{
|
{
|
||||||
assert( m_selectedAddressesHover.empty() );
|
assert( m_selectedAddressesHover.empty() );
|
||||||
auto addresses = GetAddressesForLocation( file, line );
|
auto addresses = GetAddressesForLocation( file, line, worker );
|
||||||
if( addresses )
|
if( addresses )
|
||||||
{
|
{
|
||||||
for( auto& v : *addresses )
|
for( auto& v : *addresses )
|
||||||
@ -5481,8 +5471,39 @@ bool SourceView::IsInContext( const Worker& worker, uint64_t addr ) const
|
|||||||
return !m_calcInlineStats || !worker.HasInlineSymbolAddresses() || worker.GetInlineSymbolForAddress( addr ) == m_symAddr;
|
return !m_calcInlineStats || !worker.HasInlineSymbolAddresses() || worker.GetInlineSymbolForAddress( addr ) == m_symAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<uint64_t>* SourceView::GetAddressesForLocation( uint32_t fileStringIdx, uint32_t line ) const
|
const std::vector<uint64_t>* SourceView::GetAddressesForLocation( uint32_t fileStringIdx, uint32_t line, const Worker& worker )
|
||||||
{
|
{
|
||||||
|
if( m_locationAddress.empty() || m_propagateInlines != m_locAddrIsProp )
|
||||||
|
{
|
||||||
|
m_locationAddress.clear();
|
||||||
|
m_locAddrIsProp = m_propagateInlines;
|
||||||
|
|
||||||
|
for( auto& op : m_asm )
|
||||||
|
{
|
||||||
|
auto frame = worker.GetCallstackFrame( worker.PackPointer( op.addr ) );
|
||||||
|
if( frame )
|
||||||
|
{
|
||||||
|
uint8_t end = m_propagateInlines ? frame->size : 1;
|
||||||
|
for( uint8_t i=0; i<end; i++ )
|
||||||
|
{
|
||||||
|
const auto idx = frame->data[i].file.Idx();
|
||||||
|
const auto line = frame->data[i].line;
|
||||||
|
const auto packed = PackFileLine( idx, line );
|
||||||
|
auto lit = m_locationAddress.find( packed );
|
||||||
|
if( lit == m_locationAddress.end() )
|
||||||
|
{
|
||||||
|
m_locationAddress.emplace( packed, std::vector<uint64_t>( { op.addr } ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
assert( lit->second.back() < op.addr );
|
||||||
|
lit->second.emplace_back( op.addr );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto it = m_locationAddress.find( PackFileLine( fileStringIdx, line ) );
|
auto it = m_locationAddress.find( PackFileLine( fileStringIdx, line ) );
|
||||||
if( it == m_locationAddress.end() )
|
if( it == m_locationAddress.end() )
|
||||||
{
|
{
|
||||||
|
@ -203,7 +203,7 @@ private:
|
|||||||
void CheckWrite( size_t line, RegsX86 reg, size_t limit );
|
void CheckWrite( size_t line, RegsX86 reg, size_t limit );
|
||||||
|
|
||||||
bool IsInContext( const Worker& worker, uint64_t addr ) const;
|
bool IsInContext( const Worker& worker, uint64_t addr ) const;
|
||||||
const std::vector<uint64_t>* GetAddressesForLocation( uint32_t fileStringIdx, uint32_t line ) const;
|
const std::vector<uint64_t>* GetAddressesForLocation( uint32_t fileStringIdx, uint32_t line, const Worker& worker );
|
||||||
|
|
||||||
#ifndef TRACY_NO_FILESELECTOR
|
#ifndef TRACY_NO_FILESELECTOR
|
||||||
void Save( const Worker& worker, size_t start = 0, size_t stop = std::numeric_limits<size_t>::max() );
|
void Save( const Worker& worker, size_t start = 0, size_t stop = std::numeric_limits<size_t>::max() );
|
||||||
@ -253,6 +253,7 @@ private:
|
|||||||
bool m_showJumps;
|
bool m_showJumps;
|
||||||
|
|
||||||
unordered_flat_map<uint64_t, std::vector<uint64_t>> m_locationAddress;
|
unordered_flat_map<uint64_t, std::vector<uint64_t>> m_locationAddress;
|
||||||
|
bool m_locAddrIsProp;
|
||||||
|
|
||||||
unordered_flat_map<uint32_t, uint32_t> m_sourceFiles;
|
unordered_flat_map<uint32_t, uint32_t> m_sourceFiles;
|
||||||
unordered_flat_set<uint64_t> m_selectedAddresses;
|
unordered_flat_set<uint64_t> m_selectedAddresses;
|
||||||
|
Loading…
Reference in New Issue
Block a user