2023-12-22 11:57:49 +00:00
|
|
|
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0+
|
2022-12-24 06:51:44 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ui_CpuWidget.h"
|
|
|
|
|
|
|
|
#include "DebugTools/DebugInterface.h"
|
|
|
|
#include "DebugTools/Breakpoints.h"
|
|
|
|
#include "DebugTools/BiosDebugData.h"
|
|
|
|
#include "DebugTools/MipsStackWalk.h"
|
|
|
|
|
2023-01-03 05:27:05 +00:00
|
|
|
#include "Models/BreakpointModel.h"
|
2023-01-04 07:11:28 +00:00
|
|
|
#include "Models/ThreadModel.h"
|
2023-01-07 02:35:57 +00:00
|
|
|
#include "Models/StackModel.h"
|
2023-12-31 02:05:16 +00:00
|
|
|
#include "Models/SavedAddressesModel.h"
|
2023-01-03 05:27:05 +00:00
|
|
|
|
2022-12-24 06:51:44 +00:00
|
|
|
#include "QtHost.h"
|
|
|
|
#include <QtWidgets/QWidget>
|
|
|
|
#include <QtWidgets/QTableWidget>
|
2023-10-09 22:11:28 +00:00
|
|
|
#include <QtCore/QSortFilterProxyModel>
|
2023-11-19 14:41:27 +00:00
|
|
|
#include <QtCore/QTimer>
|
2022-12-24 06:51:44 +00:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
using namespace MipsStackWalk;
|
|
|
|
|
|
|
|
class CpuWidget final : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
CpuWidget(QWidget* parent, DebugInterface& cpu);
|
|
|
|
~CpuWidget();
|
|
|
|
|
2023-12-23 09:02:48 +00:00
|
|
|
enum class SearchType
|
|
|
|
{
|
|
|
|
ByteType,
|
|
|
|
Int16Type,
|
|
|
|
Int32Type,
|
|
|
|
Int64Type,
|
|
|
|
FloatType,
|
|
|
|
DoubleType,
|
|
|
|
StringType,
|
|
|
|
ArrayType
|
|
|
|
};
|
|
|
|
|
|
|
|
// Note: The order of these enum values must reflect the order in thee Search Comparison combobox.
|
|
|
|
enum class SearchComparison
|
|
|
|
{
|
|
|
|
Equals,
|
|
|
|
NotEquals,
|
|
|
|
GreaterThan,
|
|
|
|
GreaterThanOrEqual,
|
|
|
|
LessThan,
|
|
|
|
LessThanOrEqual
|
|
|
|
};
|
|
|
|
|
2022-12-24 06:51:44 +00:00
|
|
|
public slots:
|
|
|
|
void paintEvent(QPaintEvent* event);
|
|
|
|
|
|
|
|
void onStepInto();
|
|
|
|
void onStepOver();
|
|
|
|
void onStepOut();
|
|
|
|
|
|
|
|
void onVMPaused();
|
|
|
|
|
|
|
|
void updateBreakpoints();
|
2023-01-03 05:27:05 +00:00
|
|
|
void onBPListDoubleClicked(const QModelIndex& index);
|
2022-12-24 06:51:44 +00:00
|
|
|
void onBPListContextMenu(QPoint pos);
|
|
|
|
|
|
|
|
void contextBPListCopy();
|
|
|
|
void contextBPListDelete();
|
|
|
|
void contextBPListNew();
|
|
|
|
void contextBPListEdit();
|
2023-10-09 22:27:24 +00:00
|
|
|
void contextBPListPasteCSV();
|
2022-12-24 06:51:44 +00:00
|
|
|
|
2023-12-31 02:05:16 +00:00
|
|
|
void onSavedAddressesListContextMenu(QPoint pos);
|
|
|
|
void contextSavedAddressesListPasteCSV();
|
|
|
|
void contextSavedAddressesListNew();
|
|
|
|
void addAddressToSavedAddressesList(u32 address);
|
|
|
|
|
2022-12-24 06:51:44 +00:00
|
|
|
void updateThreads();
|
2023-01-04 07:11:28 +00:00
|
|
|
void onThreadListDoubleClick(const QModelIndex& index);
|
2022-12-24 06:51:44 +00:00
|
|
|
void onThreadListContextMenu(QPoint pos);
|
|
|
|
|
|
|
|
void updateStackFrames();
|
|
|
|
void onStackListContextMenu(QPoint pos);
|
2023-01-07 02:35:57 +00:00
|
|
|
void onStackListDoubleClick(const QModelIndex& index);
|
2022-12-24 06:51:44 +00:00
|
|
|
|
|
|
|
void updateFunctionList(bool whenEmpty = false);
|
|
|
|
void onFuncListContextMenu(QPoint pos);
|
|
|
|
void onFuncListDoubleClick(QListWidgetItem* item);
|
2023-10-10 01:52:12 +00:00
|
|
|
bool getDemangleFunctions() const { return m_demangleFunctions; }
|
2023-10-26 22:26:16 +00:00
|
|
|
void onModuleTreeContextMenu(QPoint pos);
|
|
|
|
void onModuleTreeDoubleClick(QTreeWidgetItem* item);
|
2022-12-24 06:51:44 +00:00
|
|
|
void reloadCPUWidgets()
|
|
|
|
{
|
|
|
|
if (!QtHost::IsOnUIThread())
|
|
|
|
{
|
|
|
|
QtHost::RunOnUIThread(CBreakPoints::GetUpdateHandler());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
updateBreakpoints();
|
|
|
|
updateThreads();
|
|
|
|
updateStackFrames();
|
|
|
|
|
|
|
|
m_ui.registerWidget->update();
|
|
|
|
m_ui.disassemblyWidget->update();
|
|
|
|
m_ui.memoryviewWidget->update();
|
|
|
|
};
|
|
|
|
|
|
|
|
void onSearchButtonClicked();
|
2023-11-19 14:41:27 +00:00
|
|
|
void onSearchResultsListScroll(u32 value);
|
|
|
|
void loadSearchResults();
|
2023-12-08 05:24:09 +00:00
|
|
|
void contextSearchResultGoToDisassembly();
|
2023-12-08 22:46:41 +00:00
|
|
|
void contextRemoveSearchResult();
|
2023-12-08 05:24:09 +00:00
|
|
|
void onListSearchResultsContextMenu(QPoint pos);
|
2022-12-24 06:51:44 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<QTableWidget*> m_registerTableViews;
|
2023-11-19 14:41:27 +00:00
|
|
|
std::vector<u32> m_searchResults;
|
2022-12-24 06:51:44 +00:00
|
|
|
|
|
|
|
QMenu* m_stacklistContextMenu = 0;
|
|
|
|
QMenu* m_funclistContextMenu = 0;
|
2023-10-26 22:26:16 +00:00
|
|
|
QMenu* m_moduleTreeContextMenu = 0;
|
2022-12-24 06:51:44 +00:00
|
|
|
|
|
|
|
Ui::CpuWidget m_ui;
|
|
|
|
|
|
|
|
DebugInterface& m_cpu;
|
|
|
|
|
2023-01-03 05:27:05 +00:00
|
|
|
BreakpointModel m_bpModel;
|
2023-01-04 07:11:28 +00:00
|
|
|
ThreadModel m_threadModel;
|
2023-10-09 22:11:28 +00:00
|
|
|
QSortFilterProxyModel m_threadProxyModel;
|
2023-01-07 02:35:57 +00:00
|
|
|
StackModel m_stackModel;
|
2023-12-31 02:05:16 +00:00
|
|
|
SavedAddressesModel m_savedAddressesModel;
|
2023-11-19 14:41:27 +00:00
|
|
|
QTimer m_resultsLoadTimer;
|
2022-12-24 06:51:44 +00:00
|
|
|
|
|
|
|
bool m_demangleFunctions = true;
|
2023-10-26 22:26:16 +00:00
|
|
|
bool m_moduleView = true;
|
2023-11-19 14:41:27 +00:00
|
|
|
u32 m_initialResultsLoadLimit = 20000;
|
|
|
|
u32 m_numResultsAddedPerLoad = 10000;
|
2022-12-24 06:51:44 +00:00
|
|
|
};
|