From 8caf6b02c62988c5e2d19127923dca4196fd5a4d Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 9 May 2020 12:58:09 +0200 Subject: [PATCH] Allow switching between Intel and AT&T assembly syntax. --- server/TracySourceView.cpp | 13 ++++++++++--- server/TracySourceView.hpp | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 1b69e080..8eacb3ce 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -87,6 +87,7 @@ SourceView::SourceView( ImFont* font ) , m_asmBytes( false ) , m_asmShowSourceLocation( true ) , m_calcInlineStats( true ) + , m_atnt( false ) , m_showJumps( true ) , m_cpuArch( CpuArchUnknown ) , m_showLatency( false ) @@ -522,6 +523,7 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker ) } if( rval != CS_ERR_OK ) return false; cs_option( handle, CS_OPT_DETAIL, CS_OPT_ON ); + cs_option( handle, CS_OPT_SYNTAX, m_atnt ? CS_OPT_SYNTAX_ATT : CS_OPT_SYNTAX_INTEL ); cs_insn* insn; size_t cnt = cs_disasm( handle, (const uint8_t*)code, len, symAddr, 0, &insn ); if( cnt > 0 ) @@ -1513,13 +1515,13 @@ uint64_t SourceView::RenderSymbolAsmView( uint32_t iptotal, unordered_flat_mapname ); } - fprintf( f, "; Tracy Profiler disassembly of symbol %s [%s]\n\n.intel_syntax\n\n", symName, worker.GetCaptureProgram() ); + fprintf( f, "; Tracy Profiler disassembly of symbol %s [%s]\n\n", symName, worker.GetCaptureProgram() ); + if( !m_atnt ) fprintf( f, ".intel_syntax\n\n" ); unordered_flat_map locMap; for( auto& v : m_asm ) diff --git a/server/TracySourceView.hpp b/server/TracySourceView.hpp index 3662ff21..2a16ea44 100644 --- a/server/TracySourceView.hpp +++ b/server/TracySourceView.hpp @@ -201,6 +201,7 @@ private: bool m_asmShowSourceLocation; bool m_calcInlineStats; uint8_t m_maxAsmBytes; + bool m_atnt; std::vector m_lines; std::vector m_asm;