mirror of https://github.com/PCSX2/pcsx2.git
Debugger: Support 'unknown initial value' search types
This commit is contained in:
parent
1f0d6f0ac7
commit
3e1f2b8b9d
|
@ -40,6 +40,7 @@ MemorySearchWidget::MemorySearchWidget(QWidget* parent)
|
||||||
connect(m_ui.listSearchResults->verticalScrollBar(), &QScrollBar::valueChanged, this, &MemorySearchWidget::onSearchResultsListScroll);
|
connect(m_ui.listSearchResults->verticalScrollBar(), &QScrollBar::valueChanged, this, &MemorySearchWidget::onSearchResultsListScroll);
|
||||||
connect(m_ui.listSearchResults, &QListView::customContextMenuRequested, this, &MemorySearchWidget::onListSearchResultsContextMenu);
|
connect(m_ui.listSearchResults, &QListView::customContextMenuRequested, this, &MemorySearchWidget::onListSearchResultsContextMenu);
|
||||||
connect(m_ui.cmbSearchType, &QComboBox::currentIndexChanged, this, &MemorySearchWidget::onSearchTypeChanged);
|
connect(m_ui.cmbSearchType, &QComboBox::currentIndexChanged, this, &MemorySearchWidget::onSearchTypeChanged);
|
||||||
|
connect(m_ui.cmbSearchComparison, &QComboBox::currentIndexChanged, this, &MemorySearchWidget::onSearchComparisonChanged);
|
||||||
|
|
||||||
// Ensures we don't retrigger the load results function unintentionally
|
// Ensures we don't retrigger the load results function unintentionally
|
||||||
m_resultsLoadTimer.setInterval(100);
|
m_resultsLoadTimer.setInterval(100);
|
||||||
|
@ -249,7 +250,6 @@ bool handleSearchComparison(SearchComparison searchComparison, u32 searchAddress
|
||||||
}
|
}
|
||||||
case SearchComparison::IncreasedBy:
|
case SearchComparison::IncreasedBy:
|
||||||
{
|
{
|
||||||
|
|
||||||
const T priorValue = priorResult->getValue<T>();
|
const T priorValue = priorResult->getValue<T>();
|
||||||
const T expectedIncrease = searchValue + priorValue;
|
const T expectedIncrease = searchValue + priorValue;
|
||||||
return memoryValueComparator(SearchComparison::Equals, readValue, expectedIncrease);
|
return memoryValueComparator(SearchComparison::Equals, readValue, expectedIncrease);
|
||||||
|
@ -282,6 +282,10 @@ bool handleSearchComparison(SearchComparison searchComparison, u32 searchAddress
|
||||||
const T expectedDecrease = priorValue - searchValue;
|
const T expectedDecrease = priorValue - searchValue;
|
||||||
return memoryValueComparator(SearchComparison::Equals, readValue, expectedIncrease) || memoryValueComparator(SearchComparison::Equals, readValue, expectedDecrease);
|
return memoryValueComparator(SearchComparison::Equals, readValue, expectedIncrease) || memoryValueComparator(SearchComparison::Equals, readValue, expectedDecrease);
|
||||||
}
|
}
|
||||||
|
case SearchComparison::UnknownValue:
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
Console.Error("Debugger: Unknown type when doing memory search!");
|
Console.Error("Debugger: Unknown type when doing memory search!");
|
||||||
return false;
|
return false;
|
||||||
|
@ -506,63 +510,66 @@ void MemorySearchWidget::onSearchButtonClicked()
|
||||||
const bool isFilterSearch = sender() == m_ui.btnFilterSearch;
|
const bool isFilterSearch = sender() == m_ui.btnFilterSearch;
|
||||||
unsigned long long value;
|
unsigned long long value;
|
||||||
|
|
||||||
switch (searchType)
|
if(searchComparison != SearchComparison::UnknownValue)
|
||||||
{
|
{
|
||||||
case SearchType::ByteType:
|
switch (searchType)
|
||||||
case SearchType::Int16Type:
|
{
|
||||||
case SearchType::Int32Type:
|
case SearchType::ByteType:
|
||||||
case SearchType::Int64Type:
|
case SearchType::Int16Type:
|
||||||
value = searchValue.toULongLong(&ok, searchHex ? 16 : 10);
|
case SearchType::Int32Type:
|
||||||
break;
|
case SearchType::Int64Type:
|
||||||
case SearchType::FloatType:
|
value = searchValue.toULongLong(&ok, searchHex ? 16 : 10);
|
||||||
case SearchType::DoubleType:
|
|
||||||
searchValue.toDouble(&ok);
|
|
||||||
break;
|
|
||||||
case SearchType::StringType:
|
|
||||||
ok = !searchValue.isEmpty();
|
|
||||||
break;
|
|
||||||
case SearchType::ArrayType:
|
|
||||||
ok = !searchValue.trimmed().isEmpty();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ok)
|
|
||||||
{
|
|
||||||
QMessageBox::critical(this, tr("Debugger"), tr("Invalid search value"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (searchType)
|
|
||||||
{
|
|
||||||
case SearchType::ArrayType:
|
|
||||||
case SearchType::StringType:
|
|
||||||
case SearchType::DoubleType:
|
|
||||||
case SearchType::FloatType:
|
|
||||||
break;
|
|
||||||
case SearchType::Int64Type:
|
|
||||||
if (value <= std::numeric_limits<unsigned long long>::max())
|
|
||||||
break;
|
break;
|
||||||
case SearchType::Int32Type:
|
case SearchType::FloatType:
|
||||||
if (value <= std::numeric_limits<unsigned long>::max())
|
case SearchType::DoubleType:
|
||||||
|
searchValue.toDouble(&ok);
|
||||||
break;
|
break;
|
||||||
case SearchType::Int16Type:
|
case SearchType::StringType:
|
||||||
if (value <= std::numeric_limits<unsigned short>::max())
|
ok = !searchValue.isEmpty();
|
||||||
break;
|
break;
|
||||||
case SearchType::ByteType:
|
case SearchType::ArrayType:
|
||||||
if (value <= std::numeric_limits<unsigned char>::max())
|
ok = !searchValue.trimmed().isEmpty();
|
||||||
break;
|
break;
|
||||||
default:
|
}
|
||||||
QMessageBox::critical(this, tr("Debugger"), tr("Value is larger than type"));
|
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("Debugger"), tr("Invalid search value"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFilterSearch && (searchComparison == SearchComparison::Changed || searchComparison == SearchComparison::ChangedBy
|
switch (searchType)
|
||||||
|| searchComparison == SearchComparison::Decreased || searchComparison == SearchComparison::DecreasedBy
|
{
|
||||||
|| searchComparison == SearchComparison::Increased || searchComparison == SearchComparison::IncreasedBy
|
case SearchType::ArrayType:
|
||||||
|| searchComparison == SearchComparison::NotChanged))
|
case SearchType::StringType:
|
||||||
{
|
case SearchType::DoubleType:
|
||||||
QMessageBox::critical(this, tr("Debugger"), tr("This search comparison can only be used with filter searches."));
|
case SearchType::FloatType:
|
||||||
return;
|
break;
|
||||||
|
case SearchType::Int64Type:
|
||||||
|
if (value <= std::numeric_limits<unsigned long long>::max())
|
||||||
|
break;
|
||||||
|
case SearchType::Int32Type:
|
||||||
|
if (value <= std::numeric_limits<unsigned long>::max())
|
||||||
|
break;
|
||||||
|
case SearchType::Int16Type:
|
||||||
|
if (value <= std::numeric_limits<unsigned short>::max())
|
||||||
|
break;
|
||||||
|
case SearchType::ByteType:
|
||||||
|
if (value <= std::numeric_limits<unsigned char>::max())
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
QMessageBox::critical(this, tr("Debugger"), tr("Value is larger than type"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isFilterSearch && (searchComparison == SearchComparison::Changed || searchComparison == SearchComparison::ChangedBy
|
||||||
|
|| searchComparison == SearchComparison::Decreased || searchComparison == SearchComparison::DecreasedBy
|
||||||
|
|| searchComparison == SearchComparison::Increased || searchComparison == SearchComparison::IncreasedBy
|
||||||
|
|| searchComparison == SearchComparison::NotChanged))
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("Debugger"), tr("This search comparison can only be used with filter searches."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QFutureWatcher<std::vector<SearchResult>>* workerWatcher = new QFutureWatcher<std::vector<SearchResult>>();
|
QFutureWatcher<std::vector<SearchResult>>* workerWatcher = new QFutureWatcher<std::vector<SearchResult>>();
|
||||||
|
@ -654,6 +661,11 @@ void MemorySearchWidget::onSearchTypeChanged(int newIndex)
|
||||||
updateSearchComparisonSelections();
|
updateSearchComparisonSelections();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MemorySearchWidget::onSearchComparisonChanged(int newValue)
|
||||||
|
{
|
||||||
|
m_ui.txtSearchValue->setEnabled(getCurrentSearchComparison() != SearchComparison::UnknownValue);
|
||||||
|
}
|
||||||
|
|
||||||
void MemorySearchWidget::updateSearchComparisonSelections()
|
void MemorySearchWidget::updateSearchComparisonSelections()
|
||||||
{
|
{
|
||||||
const QString selectedComparisonLabel = m_ui.cmbSearchComparison->currentText();
|
const QString selectedComparisonLabel = m_ui.cmbSearchComparison->currentText();
|
||||||
|
@ -704,5 +716,11 @@ std::vector<SearchComparison> MemorySearchWidget::getValidSearchComparisonsForSt
|
||||||
comparisons.push_back(SearchComparison::ChangedBy);
|
comparisons.push_back(SearchComparison::ChangedBy);
|
||||||
comparisons.push_back(SearchComparison::NotChanged);
|
comparisons.push_back(SearchComparison::NotChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!hasResults)
|
||||||
|
{
|
||||||
|
comparisons.push_back(SearchComparison::UnknownValue);
|
||||||
|
}
|
||||||
|
|
||||||
return comparisons;
|
return comparisons;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ public:
|
||||||
Changed,
|
Changed,
|
||||||
ChangedBy,
|
ChangedBy,
|
||||||
NotChanged,
|
NotChanged,
|
||||||
|
UnknownValue,
|
||||||
Invalid
|
Invalid
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ public:
|
||||||
insert(SearchComparison::Changed, tr("Changed"));
|
insert(SearchComparison::Changed, tr("Changed"));
|
||||||
insert(SearchComparison::ChangedBy, tr("Changed By"));
|
insert(SearchComparison::ChangedBy, tr("Changed By"));
|
||||||
insert(SearchComparison::NotChanged, tr("Not Changed"));
|
insert(SearchComparison::NotChanged, tr("Not Changed"));
|
||||||
|
insert(SearchComparison::UnknownValue, tr("Unknown Initial Value"));
|
||||||
insert(SearchComparison::Invalid, "");
|
insert(SearchComparison::Invalid, "");
|
||||||
}
|
}
|
||||||
SearchComparison labelToEnum(QString comparisonLabel)
|
SearchComparison labelToEnum(QString comparisonLabel)
|
||||||
|
@ -120,6 +122,7 @@ public slots:
|
||||||
void onSearchButtonClicked();
|
void onSearchButtonClicked();
|
||||||
void onSearchResultsListScroll(u32 value);
|
void onSearchResultsListScroll(u32 value);
|
||||||
void onSearchTypeChanged(int newIndex);
|
void onSearchTypeChanged(int newIndex);
|
||||||
|
void onSearchComparisonChanged(int newIndex);
|
||||||
void loadSearchResults();
|
void loadSearchResults();
|
||||||
void contextSearchResultGoToDisassembly();
|
void contextSearchResultGoToDisassembly();
|
||||||
void contextRemoveSearchResult();
|
void contextRemoveSearchResult();
|
||||||
|
|
|
@ -148,6 +148,11 @@
|
||||||
<string>Less Than Or Equal</string>
|
<string>Less Than Or Equal</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Unknown Initial Value</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
|
|
Loading…
Reference in New Issue