From bb8393c918855278eb8dba17b6019ac98c7abd6f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 1 Jan 2023 14:47:10 +0100 Subject: [PATCH] Calculate max operand length. --- server/TracySourceView.cpp | 4 ++++ server/TracySourceView.hpp | 1 + 2 files changed, 5 insertions(+) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index cab0b80e..e2757ab7 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -714,6 +714,7 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker ) if( insn[cnt-1].address - symAddr + insn[cnt-1].size < len ) m_disasmFail = insn[cnt-1].address - symAddr; int bytesMax = 0; int mLenMax = 0; + int oLenMax = 0; m_asm.reserve( cnt ); for( size_t i=0; i mLenMax ) mLenMax = mLen; + const auto oLen = (int)strlen( op.op_str ); + if( oLen > oLenMax ) oLenMax = oLen; if( op.size > bytesMax ) bytesMax = op.size; uint32_t mLineMax = 0; @@ -962,6 +965,7 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker ) } cs_free( insn, cnt ); m_maxMnemonicLen = mLenMax + 1; + m_maxOperandLen = oLenMax + 1; m_maxAsmBytes = bytesMax; if( !m_jumpTable.empty() ) { diff --git a/server/TracySourceView.hpp b/server/TracySourceView.hpp index 21c06dd3..4499babf 100644 --- a/server/TracySourceView.hpp +++ b/server/TracySourceView.hpp @@ -263,6 +263,7 @@ private: uint32_t m_maxLine; int m_maxMnemonicLen; + int m_maxOperandLen; unordered_flat_map m_microArchOpMap; CpuArchitecture m_cpuArch;