mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +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;
|
const auto& detail = *op.detail;
|
||||||
bool hasJump = false;
|
bool hasJump = false;
|
||||||
bool jumpConditional = false;
|
bool jumpConditional = false;
|
||||||
|
OpType opType = OpType::None;
|
||||||
for( auto j=0; j<detail.groups_count; j++ )
|
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 )
|
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;
|
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;
|
uint64_t jumpAddr = 0;
|
||||||
if( hasJump )
|
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
|
#if CS_API_MAJOR >= 4
|
||||||
auto& entry = m_asm.back();
|
auto& entry = m_asm.back();
|
||||||
|
@ -77,6 +77,16 @@ private:
|
|||||||
enum { RegMask = 0x0FF };
|
enum { RegMask = 0x0FF };
|
||||||
enum { FlagMask = 0xF00 };
|
enum { FlagMask = 0xF00 };
|
||||||
|
|
||||||
|
enum class OpType : uint8_t
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Jump,
|
||||||
|
Branch,
|
||||||
|
Call,
|
||||||
|
Ret,
|
||||||
|
Privileged
|
||||||
|
};
|
||||||
|
|
||||||
struct AsmLine
|
struct AsmLine
|
||||||
{
|
{
|
||||||
uint64_t addr;
|
uint64_t addr;
|
||||||
@ -85,6 +95,7 @@ private:
|
|||||||
std::string operands;
|
std::string operands;
|
||||||
uint8_t len;
|
uint8_t len;
|
||||||
LeaData leaData;
|
LeaData leaData;
|
||||||
|
OpType opType;
|
||||||
bool jumpConditional;
|
bool jumpConditional;
|
||||||
std::vector<AsmOpParams> params;
|
std::vector<AsmOpParams> params;
|
||||||
union
|
union
|
||||||
|
Loading…
Reference in New Issue
Block a user