From 29133431bcf55e760a427d35168d00f3e2ba16e7 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 26 Mar 2021 00:17:46 +0100 Subject: [PATCH] Calculate symbol address for parents earlier. While currently this makes no sense, it will be also used in common code path. --- server/TracySourceView.cpp | 51 ++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index cda275e0..526c9501 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -2463,6 +2463,27 @@ void SourceView::RenderAsmLine( AsmLine& line, uint32_t ipcnt, uint32_t iptotal, auto sit = m_asmSampleSelect.find( idx ); 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(); ImGui::BeginTooltip(); 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 ) ) { - auto inlineList = worker.GetInlineSymbolList( m_baseAddr, m_codeLen ); - 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 ); - } + view.ShowSampleParents( symAddrParents ); } } draw->AddLine( wpos + ImVec2( 0, 1 ), wpos + ImVec2( 0, ty-2 ), GetHotnessColor( ipcnt, ipmax ) );