diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 44e377a5..6bbc8142 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -354,7 +354,7 @@ void SourceView::Render( const Worker& worker ) m_targetLine = 0; ImGui::SetScrollHereY(); } - RenderLine( line, lineNum++, 0, iptotal ); + RenderLine( line, lineNum++, 0, iptotal, worker ); } } else @@ -366,7 +366,7 @@ void SourceView::Render( const Worker& worker ) { for( auto i=clipper.DisplayStart; isecond; - RenderLine( m_lines[i], i+1, ipcnt, iptotal ); + RenderLine( m_lines[i], i+1, ipcnt, iptotal, worker ); } } } @@ -428,7 +428,7 @@ static void PrintPercentage( float val ) ImGui::ItemSize( ImVec2( stw * 7, ty ), 0 ); } -void SourceView::RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint32_t iptotal ) +void SourceView::RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint32_t iptotal, const Worker& worker ) { const auto ty = ImGui::GetFontSize(); auto draw = ImGui::GetWindowDrawList(); @@ -458,6 +458,32 @@ void SourceView::RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint memset( buf, ' ', 7 - linesz ); memcpy( buf + 7 - linesz, lineString, linesz+1 ); TextDisabledUnformatted( buf ); + ImGui::SameLine( 0, ty ); + + const auto stw = ImGui::CalcTextSize( " " ).x; + uint32_t match = 0; + auto addresses = worker.GetAddressesForLocation( m_fileStringIdx, lineNum ); + if( addresses ) + { + for( auto& addr : *addresses ) + { + match += ( addr >= m_symAddr && addr < m_symAddr + m_codeLen ); + } + } + if( match > 0 ) + { + const auto asmString = RealToString( match ); + sprintf( buf, "@%s", asmString ); + const auto asmsz = strlen( buf ); + TextDisabledUnformatted( buf ); + ImGui::SameLine( 0, 0 ); + ImGui::ItemSize( ImVec2( stw * ( 8 - asmsz ), ty ), 0 ); + } + else + { + ImGui::ItemSize( ImVec2( stw * 8, ty ), 0 ); + } + ImGui::SameLine( 0, ty ); ImGui::TextUnformatted( line.begin, line.end ); diff --git a/server/TracySourceView.hpp b/server/TracySourceView.hpp index 12459775..beec988a 100644 --- a/server/TracySourceView.hpp +++ b/server/TracySourceView.hpp @@ -37,7 +37,7 @@ public: void Render( const Worker& worker ); private: - void RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint32_t iptotal ); + void RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint32_t iptotal, const Worker& worker ); void RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t iptotal, const Worker& worker, uint64_t& jumpOut ); bool Disassemble( uint64_t symAddr, const Worker& worker );