Find Pattern searches now begin at start of current region

This commit is contained in:
dad 2023-10-12 10:37:51 -06:00
parent a4be9f87f5
commit ca637fad33
4 changed files with 19 additions and 12 deletions

View File

@ -1217,7 +1217,6 @@ void CPUDisassembly::findCallsSlot()
void CPUDisassembly::findPatternSlot()
{
HexEditDialog hexEdit(this);
hexEdit.showEntireBlock(true);
hexEdit.isDataCopiable(false);
hexEdit.mHexEdit->setOverwriteMode(false);
hexEdit.setWindowTitle(tr("Find Pattern..."));
@ -1225,12 +1224,11 @@ void CPUDisassembly::findPatternSlot()
return;
dsint addr = rvaToVa(getSelectionStart());
if(hexEdit.entireBlock())
addr = DbgMemFindBaseAddr(addr, 0);
QString command;
if(sender() == mFindPatternRegion)
{
addr = DbgMemFindBaseAddr(addr, 0);
command = QString("findall %1, %2").arg(ToHexString(addr), hexEdit.mHexEdit->pattern());
}
else if(sender() == mFindPatternModule)

View File

@ -1443,15 +1443,13 @@ void CPUDump::binarySaveToFileSlot()
void CPUDump::findPattern()
{
HexEditDialog hexEdit(this);
hexEdit.showEntireBlock(true);
hexEdit.isDataCopiable(false);
hexEdit.mHexEdit->setOverwriteMode(false);
hexEdit.setWindowTitle(tr("Find Pattern..."));
if(hexEdit.exec() != QDialog::Accepted)
return;
dsint addr = rvaToVa(getSelectionStart());
if(hexEdit.entireBlock())
addr = DbgMemFindBaseAddr(addr, 0);
addr = DbgMemFindBaseAddr(addr, 0);
QString addrText = ToPtrString(addr);
DbgCmdExec(QString("findall " + addrText + ", " + hexEdit.mHexEdit->pattern() + ", &data&"));
emit displayReferencesWidget();

View File

@ -865,15 +865,15 @@ void CPUStack::binaryPasteIgnoreSizeSlot()
void CPUStack::findPattern()
{
HexEditDialog hexEdit(this);
hexEdit.showEntireBlock(true);
hexEdit.isDataCopiable(false);
hexEdit.mHexEdit->setOverwriteMode(false);
hexEdit.setWindowTitle(tr("Find Pattern..."));
if(hexEdit.exec() != QDialog::Accepted)
return;
dsint addr = rvaToVa(getSelectionStart());
if(hexEdit.entireBlock())
addr = DbgMemFindBaseAddr(addr, 0);
addr = DbgMemFindBaseAddr(addr, 0);
QString addrText = ToPtrString(addr);
DbgCmdExec(QString("findall " + addrText + ", " + hexEdit.mHexEdit->pattern() + ", &data&"));
emit displayReferencesWidget();

View File

@ -612,12 +612,23 @@ void MemoryMapView::findPatternSlot()
hexEdit.setWindowTitle(tr("Find Pattern..."));
if(hexEdit.exec() != QDialog::Accepted)
return;
duint addr = getSelectionAddr();
entireBlockEnabled = hexEdit.entireBlock();
BridgeSettingSetUint("Gui", "MemoryMapEntireBlock", entireBlockEnabled);
if(entireBlockEnabled)
addr = 0;
DbgCmdExec(QString("findallmem %1, %2, &data&").arg(ToPtrString(addr)).arg(hexEdit.mHexEdit->pattern()));
{
DbgCmdExec(QString("findallmem 0, %2").arg(hexEdit.mHexEdit->pattern()));
}
else
{
QList<duint> selection = getSelection();
if(selection.isEmpty())
return;
duint addrFirst = getCellUserdata(selection.first(), ColAddress);
duint addrLast = getCellUserdata(selection.last(), ColAddress);
duint size = getCellUserdata(selection.last(), ColSize);
DbgCmdExec(QString("findallmem %1, %2, %3").arg(ToPtrString(addrFirst)).arg(hexEdit.mHexEdit->pattern()).arg(ToHexString(addrLast - addrFirst + size)));
}
emit showReferences();
}