diff options
author | Bartosz Taudul <wolf@nereid.pl> | 2022-09-11 01:30:37 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf@nereid.pl> | 2022-09-11 01:30:37 +0300 |
commit | 9372d9fb2812567b6585cabc614618be852a5763 (patch) | |
tree | d5b12b8660eb12497d51e4f653232f7338b5c815 /server | |
parent | ad23932e9f2d4cfa6445f1ed6e61e9e6b3e469a9 (diff) |
Collect asm operation type data.
Diffstat (limited to 'server')
-rw-r--r-- | server/TracySourceView.cpp | 15 | ||||
-rw-r--r-- | server/TracySourceView.hpp | 11 |
2 files changed, 25 insertions, 1 deletions
diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 5b54deaf..6439d956 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -701,6 +701,7 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker ) const auto& detail = *op.detail; bool hasJump = false; bool jumpConditional = false; + OpType opType = OpType::None; for( auto j=0; j<detail.groups_count; j++ ) { if( detail.groups[j] == CS_GRP_JUMP || detail.groups[j] == CS_GRP_CALL || detail.groups[j] == CS_GRP_RET ) @@ -709,6 +710,18 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker ) break; } } + for( auto j=0; j<detail.groups_count; j++ ) + { + if( detail.groups[j] == CS_GRP_JUMP && opType < OpType::Jump ) opType = OpType::Jump; + else if( detail.groups[j] == CS_GRP_BRANCH_RELATIVE && opType < OpType::Branch ) opType = OpType::Branch; + else if( detail.groups[j] == CS_GRP_CALL && opType < OpType::Call ) opType = OpType::Call; + else if( detail.groups[j] == CS_GRP_RET && opType < OpType::Ret ) opType = OpType::Ret; + else if( detail.groups[j] == CS_GRP_PRIVILEGE && opType < OpType::Privileged ) + { + opType = OpType::Privileged; + break; + } + } uint64_t jumpAddr = 0; if( hasJump ) { @@ -875,7 +888,7 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker ) } } } - m_asm.emplace_back( AsmLine { op.address, jumpAddr, op.mnemonic, op.op_str, (uint8_t)op.size, leaData, jumpConditional, std::move( params ) } ); + m_asm.emplace_back( AsmLine { op.address, jumpAddr, op.mnemonic, op.op_str, (uint8_t)op.size, leaData, opType, jumpConditional, std::move( params ) } ); #if CS_API_MAJOR >= 4 auto& entry = m_asm.back(); diff --git a/server/TracySourceView.hpp b/server/TracySourceView.hpp index 162305d6..120a188d 100644 --- a/server/TracySourceView.hpp +++ b/server/TracySourceView.hpp @@ -77,6 +77,16 @@ private: enum { RegMask = 0x0FF }; enum { FlagMask = 0xF00 }; + enum class OpType : uint8_t + { + None, + Jump, + Branch, + Call, + Ret, + Privileged + }; + struct AsmLine { uint64_t addr; @@ -85,6 +95,7 @@ private: std::string operands; uint8_t len; LeaData leaData; + OpType opType; bool jumpConditional; std::vector<AsmOpParams> params; union |