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)
|
if(mShowMnemonicBrief)
|
||||||
{
|
{
|
||||||
char brief[MAX_STRING_SIZE] = "";
|
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(' ');
|
int index = mnem.indexOf(' ');
|
||||||
if(index != -1)
|
if(index != -1)
|
||||||
mnem.truncate(index);
|
mnem.truncate(index);
|
||||||
|
|
|
@ -367,6 +367,7 @@ QString CapstoneTokenizer::printValue(const TokenValue & value, bool expandModul
|
||||||
|
|
||||||
bool CapstoneTokenizer::tokenizePrefix()
|
bool CapstoneTokenizer::tokenizePrefix()
|
||||||
{
|
{
|
||||||
|
//TODO: what happens with multiple prefixes?
|
||||||
bool hasPrefix = true;
|
bool hasPrefix = true;
|
||||||
QStringList prefixText;
|
QStringList prefixText;
|
||||||
|
|
||||||
|
|
|
@ -1909,14 +1909,12 @@ void CPUDisassembly::mnemonicBriefSlot()
|
||||||
|
|
||||||
void CPUDisassembly::mnemonicHelpSlot()
|
void CPUDisassembly::mnemonicHelpSlot()
|
||||||
{
|
{
|
||||||
BASIC_INSTRUCTION_INFO disasm;
|
unsigned char data[16] = { 0xCC };
|
||||||
DbgDisasmFastAt(rvaToVa(getInitialSelection()), &disasm);
|
auto addr = rvaToVa(getInitialSelection());
|
||||||
if(!*disasm.instruction)
|
DbgMemRead(addr, data, sizeof(data));
|
||||||
return;
|
Zydis zydis;
|
||||||
char* space = strstr(disasm.instruction, " ");
|
zydis.Disassemble(addr, data);
|
||||||
if(space)
|
DbgCmdExecDirect(QString("mnemonichelp %1").arg(zydis.Mnemonic().c_str()).toUtf8().constData());
|
||||||
*space = '\0';
|
|
||||||
DbgCmdExecDirect(QString("mnemonichelp %1").arg(disasm.instruction).toUtf8().constData());
|
|
||||||
emit displayLogWidget();
|
emit displayLogWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue