Implement underlining of the stack location you select in the disassembly
This commit is contained in:
parent
69c67f2456
commit
c7fc8ff920
|
@ -858,6 +858,24 @@ void HexDump::getColumnRichText(int col, dsint rva, RichTextPainter::List & rich
|
|||
}
|
||||
}
|
||||
|
||||
auto dataStartAddr = rvaToVa(rva);
|
||||
auto dataEndAddr = dataStartAddr + wBufferByteCount - 1;
|
||||
|
||||
if(mUnderlineRangeStartVa && mUnderlineRangeEndVa)
|
||||
{
|
||||
// Check if the highlight ranges overlap
|
||||
if(mUnderlineRangeStartVa <= dataEndAddr && dataStartAddr <= mUnderlineRangeEndVa)
|
||||
{
|
||||
for(RichTextPainter::CustomRichText_t & token : richText)
|
||||
{
|
||||
token.underline = true;
|
||||
token.underlineColor = token.textColor;
|
||||
}
|
||||
while(richText.back().text == QStringLiteral(" "))
|
||||
richText.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
delete[] wData;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -220,6 +220,8 @@ protected:
|
|||
QAction* mCopyAddress;
|
||||
QAction* mCopyRva;
|
||||
QAction* mCopySelection;
|
||||
duint mUnderlineRangeStartVa = 0;
|
||||
duint mUnderlineRangeEndVa = 0;
|
||||
};
|
||||
|
||||
#endif // _HEXDUMP_H
|
||||
|
|
|
@ -598,6 +598,9 @@ void CPUStack::disasmSelectionChanged(dsint parVA)
|
|||
return;
|
||||
DbgDisasmAt(parVA, &instr);
|
||||
|
||||
duint underlineStart = 0;
|
||||
duint underlineEnd = 0;
|
||||
|
||||
for(int i = 0; i < instr.argcount; i++)
|
||||
{
|
||||
const DISASM_ARG & arg = instr.arg[i];
|
||||
|
@ -605,12 +608,29 @@ void CPUStack::disasmSelectionChanged(dsint parVA)
|
|||
{
|
||||
if(arg.value >= mMemPage->getBase() && arg.value < mMemPage->getBase() + mMemPage->getSize())
|
||||
{
|
||||
//TODO: When the stack is unaligned?
|
||||
stackDumpAt(arg.value & (~(sizeof(void*) - 1)), mCsp);
|
||||
return;
|
||||
if(Config()->getBool("Gui", "AutoFollowInStack"))
|
||||
{
|
||||
//TODO: When the stack is unaligned?
|
||||
stackDumpAt(arg.value & (~(sizeof(void*) - 1)), mCsp);
|
||||
}
|
||||
else
|
||||
{
|
||||
BASIC_INSTRUCTION_INFO info;
|
||||
DbgDisasmFastAt(parVA, &info);
|
||||
underlineStart = arg.value;
|
||||
underlineEnd = mUnderlineRangeStartVa + info.memory.size - 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mUnderlineRangeStartVa != underlineStart || mUnderlineRangeEndVa != underlineEnd)
|
||||
{
|
||||
mUnderlineRangeStartVa = underlineStart;
|
||||
mUnderlineRangeEndVa = underlineEnd;
|
||||
reloadData();
|
||||
}
|
||||
}
|
||||
|
||||
void CPUStack::gotoCspSlot()
|
||||
|
|
|
@ -83,9 +83,7 @@ CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
|
|||
|
||||
mStack = new CPUStack(mDump, 0); //stack widget
|
||||
ui->mBotRightFrameLayout->addWidget(mStack);
|
||||
if(Config()->getBool("Gui", "AutoFollowInStack"))
|
||||
connect(mDisas, SIGNAL(selectionChanged(dsint)), mStack, SLOT(disasmSelectionChanged(dsint)));
|
||||
connect(Config(), SIGNAL(guiOptionsUpdated()), this, SLOT(guiOptionsUpdated()));
|
||||
connect(mDisas, SIGNAL(selectionChanged(dsint)), mStack, SLOT(disasmSelectionChanged(dsint)));
|
||||
|
||||
// load column config
|
||||
mDisas->loadColumnFromConfig("CPUDisassembly");
|
||||
|
@ -163,14 +161,6 @@ void CPUWidget::setDefaultDisposition()
|
|||
ui->mTopLeftUpperHSplitter->setStretchFactor(1, 64);
|
||||
}
|
||||
|
||||
void CPUWidget::guiOptionsUpdated()
|
||||
{
|
||||
if(Config()->getBool("Gui", "AutoFollowInStack"))
|
||||
connect(mDisas, SIGNAL(selectionChanged(dsint)), mStack, SLOT(disasmSelectionChanged(dsint)), Qt::UniqueConnection);
|
||||
else
|
||||
disconnect(mDisas, SIGNAL(selectionChanged(dsint)), mStack, SLOT(disasmSelectionChanged(dsint)));
|
||||
}
|
||||
|
||||
void CPUWidget::setDisasmFocus()
|
||||
{
|
||||
if(disasMode == 1)
|
||||
|
|
|
@ -66,7 +66,6 @@ private:
|
|||
|
||||
private slots:
|
||||
void splitterMoved(int pos, int index);
|
||||
void guiOptionsUpdated();
|
||||
void attachGraph(QWidget* widget);
|
||||
void detachGraph();
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>260</width>
|
||||
<height>197</height>
|
||||
<height>166</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
|
Loading…
Reference in New Issue