From e34d79c0c730421b08fe42146f1f23b9529f27db Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 6 Apr 2022 01:23:35 +0200 Subject: [PATCH] Display target location for local jumps. --- server/TracySourceView.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index c105ff65..f0a495de 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -3733,6 +3733,21 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr } ImGui::SameLine(); ImGui::Text( "%s+%" PRIu32, jumpName, jumpOffset ); + if( jumpBase == m_baseAddr ) + { + uint32_t srcline; + const auto srcidx = worker.GetLocationForAddress( line.jumpAddr, srcline ); + if( srcline != 0 ) + { + const auto fileName = worker.GetString( srcidx ); + const auto fileColor = GetHsvColor( srcidx.Idx(), 0 ); + TextDisabledUnformatted( "Target location:" ); + ImGui::SameLine(); + SmallColorBox( fileColor ); + ImGui::SameLine(); + ImGui::Text( "%s:%i", fileName, srcline ); + } + } } ImGui::Separator(); } @@ -3857,6 +3872,21 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr } ImGui::SameLine(); ImGui::Text( "%s+%" PRIu32, jumpName, jumpOffset ); + if( jumpBase == m_baseAddr ) + { + uint32_t srcline; + const auto srcidx = worker.GetLocationForAddress( line.jumpAddr, srcline ); + if( srcline != 0 ) + { + const auto fileName = worker.GetString( srcidx ); + const auto fileColor = GetHsvColor( srcidx.Idx(), 0 ); + TextDisabledUnformatted( "Target location:" ); + ImGui::SameLine(); + SmallColorBox( fileColor ); + ImGui::SameLine(); + ImGui::Text( "%s:%i", fileName, srcline ); + } + } ImGui::EndTooltip(); SetFont(); }