From 327e30fe7cab3928c3b584978bfafe943193d4f1 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 2 Apr 2020 00:39:17 +0200 Subject: [PATCH] Add source file location tooltip for assembly instructions. This has bad UX, better solution is needed. --- server/TracySourceView.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 66a2fe52..5d022a39 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -497,6 +497,19 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip memset( buf+asz, ' ', 16-asz ); buf[16] = '\0'; TextDisabledUnformatted( buf ); + if( ImGui::IsItemHovered() ) + { + uint32_t srcline; + const auto idx = worker.GetLocationForAddress( line.addr, srcline ); + if( srcline != 0 ) + { + if( m_font ) ImGui::PopFont(); + ImGui::BeginTooltip(); + ImGui::Text( "%s:%i", worker.GetString( idx ), srcline ); + ImGui::EndTooltip(); + if( m_font ) ImGui::PushFont( m_font ); + } + } ImGui::SameLine( 0, ty ); const auto msz = line.mnemonic.size();