GUI: mnemonic help and brief now work better with prefixes
This commit is contained in:
parent
16fdf57f41
commit
289a6b1911
|
@ -664,7 +664,18 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
|
|||
if(mShowMnemonicBrief)
|
||||
{
|
||||
char brief[MAX_STRING_SIZE] = "";
|
||||
QString mnem = mInstBuffer.at(rowOffset).instStr;
|
||||
QString mnem;
|
||||
for(const CapstoneTokenizer::SingleToken & token : mInstBuffer.at(rowOffset).tokens.tokens)
|
||||
{
|
||||
if(token.type != CapstoneTokenizer::TokenType::Space && token.type != CapstoneTokenizer::TokenType::Prefix)
|
||||
{
|
||||
mnem = token.text;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(mnem.isEmpty())
|
||||
mnem = mInstBuffer.at(rowOffset).instStr;
|
||||
|
||||
int index = mnem.indexOf(' ');
|
||||
if(index != -1)
|
||||
mnem.truncate(index);
|
||||
|
|
|
@ -367,6 +367,7 @@ QString CapstoneTokenizer::printValue(const TokenValue & value, bool expandModul
|
|||
|
||||
bool CapstoneTokenizer::tokenizePrefix()
|
||||
{
|
||||
//TODO: what happens with multiple prefixes?
|
||||
bool hasPrefix = true;
|
||||
QStringList prefixText;
|
||||
|
||||
|
|
|
@ -1909,14 +1909,12 @@ void CPUDisassembly::mnemonicBriefSlot()
|
|||
|
||||
void CPUDisassembly::mnemonicHelpSlot()
|
||||
{
|
||||
BASIC_INSTRUCTION_INFO disasm;
|
||||
DbgDisasmFastAt(rvaToVa(getInitialSelection()), &disasm);
|
||||
if(!*disasm.instruction)
|
||||
return;
|
||||
char* space = strstr(disasm.instruction, " ");
|
||||
if(space)
|
||||
*space = '\0';
|
||||
DbgCmdExecDirect(QString("mnemonichelp %1").arg(disasm.instruction).toUtf8().constData());
|
||||
unsigned char data[16] = { 0xCC };
|
||||
auto addr = rvaToVa(getInitialSelection());
|
||||
DbgMemRead(addr, data, sizeof(data));
|
||||
Zydis zydis;
|
||||
zydis.Disassemble(addr, data);
|
||||
DbgCmdExecDirect(QString("mnemonichelp %1").arg(zydis.Mnemonic().c_str()).toUtf8().constData());
|
||||
emit displayLogWidget();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue