mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Collect asm operation type data.
This commit is contained in:
parent
ad23932e9f
commit
9372d9fb28
@ -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();
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user