mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Dummy tokenization of asm operands.
This commit is contained in:
parent
4913f0e1e6
commit
d823a24534
@ -351,4 +351,26 @@ out:
|
||||
return TokenColor::Default;
|
||||
}
|
||||
|
||||
std::vector<Tokenizer::AsmToken> Tokenizer::TokenizeAsm( const char* begin, const char* end )
|
||||
{
|
||||
std::vector<AsmToken> ret;
|
||||
while( begin != end )
|
||||
{
|
||||
while( begin != end && isspace( (uint8_t)*begin ) ) begin++;
|
||||
const auto pos = begin;
|
||||
const auto col = IdentifyAsmToken( begin, end );
|
||||
ret.emplace_back( AsmToken { pos, begin, col } );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Tokenizer::AsmTokenColor Tokenizer::IdentifyAsmToken( const char*& begin, const char* end )
|
||||
{
|
||||
static const auto s_regs = GetAsmRegs();
|
||||
static const auto s_sizes = GetAsmSizeDirectives();
|
||||
|
||||
begin = end;
|
||||
return AsmTokenColor::Default;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,12 +47,21 @@ public:
|
||||
Literal, // 0x04, etc
|
||||
};
|
||||
|
||||
struct AsmToken
|
||||
{
|
||||
const char* begin;
|
||||
const char* end;
|
||||
AsmTokenColor color;
|
||||
};
|
||||
|
||||
Tokenizer();
|
||||
|
||||
std::vector<Token> Tokenize( const char* begin, const char* end );
|
||||
std::vector<AsmToken> TokenizeAsm( const char* begin, const char* end );
|
||||
|
||||
private:
|
||||
TokenColor IdentifyToken( const char*& begin, const char* end );
|
||||
AsmTokenColor IdentifyAsmToken( const char*& begin, const char* end );
|
||||
|
||||
bool m_isInComment;
|
||||
bool m_isInPreprocessor;
|
||||
|
@ -891,6 +891,8 @@ 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, opType, jumpConditional, std::move( params ) } );
|
||||
const auto& operands = m_asm.back().operands;
|
||||
m_asm.back().opTokens = m_tokenizer.TokenizeAsm( operands.c_str(), operands.c_str() + operands.size() );
|
||||
|
||||
#if CS_API_MAJOR >= 4
|
||||
auto& entry = m_asm.back();
|
||||
|
@ -98,6 +98,7 @@ private:
|
||||
OpType opType;
|
||||
bool jumpConditional;
|
||||
std::vector<AsmOpParams> params;
|
||||
std::vector<Tokenizer::AsmToken> opTokens;
|
||||
union
|
||||
{
|
||||
RegsX86 readX86[12];
|
||||
|
Loading…
Reference in New Issue
Block a user