diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 598ff790..2dd70a7a 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -661,6 +661,13 @@ uint64_t SourceView::RenderSymbolAsmView( uint32_t iptotal, unordered_flat_mapsecond; - RenderAsmLine( line, ipcnt, iptotal, worker, jumpOut ); + RenderAsmLine( line, ipcnt, iptotal, worker, jumpOut, maxAddrLen ); insList.emplace_back( line.addr ); } } @@ -709,7 +716,7 @@ uint64_t SourceView::RenderSymbolAsmView( uint32_t iptotal, unordered_flat_mapAddLine( wpos + ImVec2( 0, ty+2 ), wpos + ImVec2( w, ty+2 ), 0x08FFFFFF ); } -void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t iptotal, const Worker& worker, uint64_t& jumpOut ) +void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t iptotal, const Worker& worker, uint64_t& jumpOut, int maxAddrLen ) { const auto ty = ImGui::GetFontSize(); auto draw = ImGui::GetWindowDrawList(); @@ -929,8 +936,8 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip sprintf( buf, "%" PRIx64, line.addr ); } const auto asz = strlen( buf ); - memset( buf+asz, ' ', 16-asz ); - buf[16] = '\0'; + memset( buf+asz, ' ', maxAddrLen-asz ); + buf[maxAddrLen] = '\0'; TextDisabledUnformatted( buf ); bool lineHovered = false; @@ -1011,7 +1018,7 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip const auto th4 = floor( ts.y / 4 ); const auto& mjl = m_maxJumpLevel; const auto col = GetHsvColor( line.jumpAddr, 6 ); - const auto xoff = ( iptotal == 0 ? 0 : ( 7 * ts.x + ts.y ) ) + 19 * ts.x + ( m_asmShowSourceLocation ? 36 * ts.x : 0 ); + const auto xoff = ( iptotal == 0 ? 0 : ( 7 * ts.x + ts.y ) ) + (3+maxAddrLen) * ts.x + ( m_asmShowSourceLocation ? 36 * ts.x : 0 ); draw->AddLine( wpos + ImVec2( xoff + JumpSeparation * mjl + th2, th2 ), wpos + ImVec2( xoff + JumpSeparation * mjl + th2 + JumpArrow / 2, th2 ), col ); draw->AddLine( wpos + ImVec2( xoff + JumpSeparation * mjl + th2, th2 ), wpos + ImVec2( xoff + JumpSeparation * mjl + th2 + th4, th2 - th4 ), col ); diff --git a/server/TracySourceView.hpp b/server/TracySourceView.hpp index 63aba7df..0624c56f 100644 --- a/server/TracySourceView.hpp +++ b/server/TracySourceView.hpp @@ -64,7 +64,7 @@ private: uint64_t RenderSymbolAsmView( uint32_t iptotal, unordered_flat_map ipcount, const Worker& worker ); 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 ); + void RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t iptotal, const Worker& worker, uint64_t& jumpOut, int maxAddrLen ); void SelectLine( uint32_t line, const Worker* worker, bool changeAsmLine = true, uint64_t targetAddr = 0 ); void SelectAsmLines( uint32_t file, uint32_t line, const Worker& worker, bool changeAsmLine = true, uint64_t targetAddr = 0 );