Make SearchWidget set search.in only locally (#2578)

This commit is contained in:
Florian Märkl 2021-01-24 14:11:46 +01:00 committed by GitHub
parent 753d4a7bb5
commit 3c2b263de7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 16 deletions

3
.gitignore vendored
View File

@ -96,5 +96,6 @@ src/out
# astyle backup .orig files # astyle backup .orig files
*.orig *.orig
# Gdb's history # Local gdb files
.gdb_history .gdb_history
.gdbinit

View File

@ -3349,12 +3349,17 @@ bool CutterCore::isAddressMapped(RVA addr)
return !Core()->cmdRawAt(QString("om."), addr).isEmpty(); return !Core()->cmdRawAt(QString("om."), addr).isEmpty();
} }
QList<SearchDescription> CutterCore::getAllSearch(QString search_for, QString space) QList<SearchDescription> CutterCore::getAllSearch(QString searchFor, QString space, QString in)
{ {
CORE_LOCK(); CORE_LOCK();
QList<SearchDescription> searchRef; QList<SearchDescription> searchRef;
QJsonArray searchArray = cmdj(space + QString(" ") + search_for).array(); QJsonArray searchArray;
{
TempConfig cfg;
cfg.set("search.in", in);
searchArray = cmdj(QString("%1 %2").arg(space, searchFor)).array();
}
if (space == "/Rj") { if (space == "/Rj") {
for (const QJsonValue &value : searchArray) { for (const QJsonValue &value : searchArray) {

View File

@ -557,7 +557,7 @@ public:
bool isAddressMapped(RVA addr); bool isAddressMapped(RVA addr);
QList<MemoryMapDescription> getMemoryMap(); QList<MemoryMapDescription> getMemoryMap();
QList<SearchDescription> getAllSearch(QString search_for, QString space); QList<SearchDescription> getAllSearch(QString searchFor, QString space, QString in);
BlockStatistics getBlockStatistics(unsigned int blocksCount); BlockStatistics getBlockStatistics(unsigned int blocksCount);
QList<BreakpointDescription> getBreakpoints(); QList<BreakpointDescription> getBreakpoints();
QList<ProcessDescription> getAllProcesses(); QList<ProcessDescription> getAllProcesses();

View File

@ -227,7 +227,6 @@ void SearchWidget::updateSearchBoundaries()
mapIter = boundaries.cbegin(); mapIter = boundaries.cbegin();
ui->searchInCombo->setCurrentIndex(ui->searchInCombo->findData(mapIter.key())); ui->searchInCombo->setCurrentIndex(ui->searchInCombo->findData(mapIter.key()));
Config()->setConfig("search.in", mapIter.key());
ui->searchInCombo->blockSignals(true); ui->searchInCombo->blockSignals(true);
ui->searchInCombo->clear(); ui->searchInCombo->clear();
@ -265,12 +264,12 @@ void SearchWidget::refreshSearchspaces()
void SearchWidget::refreshSearch() void SearchWidget::refreshSearch()
{ {
QString search_for = ui->filterLineEdit->text(); QString searchFor = ui->filterLineEdit->text();
QVariant searchspace_data = ui->searchspaceCombo->currentData(); QString searchSpace = ui->searchspaceCombo->currentData().toString();
QString searchspace = searchspace_data.toString(); QString searchIn = ui->searchInCombo->currentData().toString();
search_model->beginResetModel(); search_model->beginResetModel();
search = Core()->getAllSearch(search_for, searchspace); search = Core()->getAllSearch(searchFor, searchSpace, searchIn);
search_model->endResetModel(); search_model->endResetModel();
qhelpers::adjustColumns(ui->searchTreeView, 3, 0); qhelpers::adjustColumns(ui->searchTreeView, 3, 0);
@ -313,9 +312,3 @@ void SearchWidget::updatePlaceholderText(int index)
ui->filterLineEdit->setPlaceholderText("jmp rax"); ui->filterLineEdit->setPlaceholderText("jmp rax");
} }
} }
void SearchWidget::on_searchInCombo_currentIndexChanged(int index)
{
Config()->setConfig("search.in",
ui->searchInCombo->itemData(index).toString());
}

View File

@ -68,7 +68,6 @@ public:
~SearchWidget(); ~SearchWidget();
private slots: private slots:
void on_searchInCombo_currentIndexChanged(int index);
void searchChanged(); void searchChanged();
void updateSearchBoundaries(); void updateSearchBoundaries();
void refreshSearchspaces(); void refreshSearchspaces();