Calculate symbol address for parents earlier.

While currently this makes no sense, it will be also used in common code
path.
This commit is contained in:
Bartosz Taudul 2021-03-26 00:17:46 +01:00
parent ec16182887
commit 29133431bc
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -2463,6 +2463,27 @@ void SourceView::RenderAsmLine( AsmLine& line, uint32_t ipcnt, uint32_t iptotal,
auto sit = m_asmSampleSelect.find( idx ); auto sit = m_asmSampleSelect.find( idx );
if( PrintPercentage( 100.f * ipcnt / iptotal, sit == m_asmSampleSelect.end() ? 0xFFFFFFFF : 0xFF8888FF ) ) if( PrintPercentage( 100.f * ipcnt / iptotal, sit == m_asmSampleSelect.end() ? 0xFFFFFFFF : 0xFF8888FF ) )
{ {
uint64_t symAddrParents = m_baseAddr;
auto inlineList = worker.GetInlineSymbolList( m_baseAddr, m_codeLen );
if( inlineList )
{
const auto cfi = worker.PackPointer( line.addr );
const auto symEnd = m_baseAddr + m_codeLen;
while( *inlineList < symEnd )
{
auto ipmap = worker.GetSymbolInstructionPointers( *inlineList );
if( ipmap )
{
if( ipmap->find( cfi ) != ipmap->end() )
{
symAddrParents = *inlineList;
break;
}
}
inlineList++;
}
}
if( m_font ) ImGui::PopFont(); if( m_font ) ImGui::PopFont();
ImGui::BeginTooltip(); ImGui::BeginTooltip();
TextFocused( "Time:", TimeToString( ipcnt * worker.GetSamplingPeriod() ) ); TextFocused( "Time:", TimeToString( ipcnt * worker.GetSamplingPeriod() ) );
@ -2525,35 +2546,7 @@ void SourceView::RenderAsmLine( AsmLine& line, uint32_t ipcnt, uint32_t iptotal,
} }
else if( ImGui::IsMouseClicked( 2 ) ) else if( ImGui::IsMouseClicked( 2 ) )
{ {
auto inlineList = worker.GetInlineSymbolList( m_baseAddr, m_codeLen ); view.ShowSampleParents( symAddrParents );
if( inlineList )
{
const auto cfi = worker.PackPointer( line.addr );
bool found = false;
const auto symEnd = m_baseAddr + m_codeLen;
while( *inlineList < symEnd )
{
auto ipmap = worker.GetSymbolInstructionPointers( *inlineList );
if( ipmap )
{
if( ipmap->find( cfi ) != ipmap->end() )
{
view.ShowSampleParents( *inlineList );
found = true;
break;
}
}
inlineList++;
}
if( !found )
{
view.ShowSampleParents( m_baseAddr );
}
}
else
{
view.ShowSampleParents( m_baseAddr );
}
} }
} }
draw->AddLine( wpos + ImVec2( 0, 1 ), wpos + ImVec2( 0, ty-2 ), GetHotnessColor( ipcnt, ipmax ) ); draw->AddLine( wpos + ImVec2( 0, 1 ), wpos + ImVec2( 0, ty-2 ), GetHotnessColor( ipcnt, ipmax ) );