mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #8732 from dreamsyntax/debugger-function-differencing
Qt/Debugger CodeWidget: Record and find specific functions by differencing
This commit is contained in:
@@ -208,6 +208,8 @@ add_executable(dolphin-emu
|
||||
Config/WiimoteControllersWidget.h
|
||||
Debugger/BreakpointWidget.cpp
|
||||
Debugger/BreakpointWidget.h
|
||||
Debugger/CodeDiffDialog.cpp
|
||||
Debugger/CodeDiffDialog.h
|
||||
Debugger/CodeViewWidget.cpp
|
||||
Debugger/CodeViewWidget.h
|
||||
Debugger/CodeWidget.cpp
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,71 @@
|
||||
// Copyright 2022 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
class CodeWidget;
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
class QTableWidget;
|
||||
|
||||
struct Diff
|
||||
{
|
||||
u32 addr;
|
||||
std::string symbol;
|
||||
u32 hits;
|
||||
u32 total_hits;
|
||||
|
||||
bool operator<(const std::string& val) const { return symbol < val; }
|
||||
};
|
||||
|
||||
class CodeDiffDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CodeDiffDialog(CodeWidget* parent);
|
||||
void reject() override;
|
||||
|
||||
private:
|
||||
void CreateWidgets();
|
||||
void ConnectWidgets();
|
||||
void ClearData();
|
||||
void ClearBlockCache();
|
||||
void OnClickItem();
|
||||
void OnRecord(bool enabled);
|
||||
std::vector<Diff> CalculateSymbolsFromProfile();
|
||||
void OnInclude();
|
||||
void OnExclude();
|
||||
void RemoveMissingSymbolsFromIncludes(const std::vector<Diff>& symbol_diff);
|
||||
void RemoveMatchingSymbolsFromIncludes(const std::vector<Diff>& symbol_list);
|
||||
void Update(bool include);
|
||||
void InfoDisp();
|
||||
|
||||
void OnContextMenu();
|
||||
|
||||
void OnGoTop();
|
||||
void OnDelete();
|
||||
void OnSetBLR();
|
||||
|
||||
void UpdateItem();
|
||||
|
||||
QTableWidget* m_matching_results_table;
|
||||
QLabel* m_exclude_size_label;
|
||||
QLabel* m_include_size_label;
|
||||
QPushButton* m_exclude_btn;
|
||||
QPushButton* m_include_btn;
|
||||
QPushButton* m_record_btn;
|
||||
QPushButton* m_reset_btn;
|
||||
QPushButton* m_help_btn;
|
||||
CodeWidget* m_code_widget;
|
||||
|
||||
std::vector<Diff> m_exclude;
|
||||
std::vector<Diff> m_include;
|
||||
bool m_failed_requirements = false;
|
||||
bool m_include_active = false;
|
||||
};
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <QGroupBox>
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
#include <QPushButton>
|
||||
#include <QSplitter>
|
||||
#include <QTableWidget>
|
||||
#include <QWidget>
|
||||
@@ -95,6 +96,7 @@ void CodeWidget::CreateWidgets()
|
||||
|
||||
m_search_address = new QLineEdit;
|
||||
m_search_symbols = new QLineEdit;
|
||||
m_code_diff = new QPushButton(tr("Diff"));
|
||||
m_code_view = new CodeViewWidget;
|
||||
|
||||
m_search_address->setPlaceholderText(tr("Search Address"));
|
||||
@@ -146,6 +148,7 @@ void CodeWidget::CreateWidgets()
|
||||
|
||||
layout->addWidget(m_search_address, 0, 0);
|
||||
layout->addWidget(m_search_symbols, 0, 1);
|
||||
layout->addWidget(m_code_diff, 0, 2);
|
||||
layout->addWidget(m_code_splitter, 1, 0, -1, -1);
|
||||
|
||||
QWidget* widget = new QWidget(this);
|
||||
@@ -158,6 +161,7 @@ void CodeWidget::ConnectWidgets()
|
||||
connect(m_search_address, &QLineEdit::textChanged, this, &CodeWidget::OnSearchAddress);
|
||||
connect(m_search_address, &QLineEdit::returnPressed, this, &CodeWidget::OnSearchAddress);
|
||||
connect(m_search_symbols, &QLineEdit::textChanged, this, &CodeWidget::OnSearchSymbols);
|
||||
connect(m_code_diff, &QPushButton::pressed, this, &CodeWidget::OnDiff);
|
||||
|
||||
connect(m_symbols_list, &QListWidget::itemPressed, this, &CodeWidget::OnSelectSymbol);
|
||||
connect(m_callstack_list, &QListWidget::itemPressed, this, &CodeWidget::OnSelectCallstack);
|
||||
@@ -176,6 +180,16 @@ void CodeWidget::ConnectWidgets()
|
||||
connect(m_code_view, &CodeViewWidget::ShowMemory, this, &CodeWidget::ShowMemory);
|
||||
}
|
||||
|
||||
void CodeWidget::OnDiff()
|
||||
{
|
||||
if (!m_diff_dialog)
|
||||
m_diff_dialog = new CodeDiffDialog(this);
|
||||
m_diff_dialog->setWindowFlag(Qt::WindowMinimizeButtonHint);
|
||||
m_diff_dialog->show();
|
||||
m_diff_dialog->raise();
|
||||
m_diff_dialog->activateWindow();
|
||||
}
|
||||
|
||||
void CodeWidget::OnSearchAddress()
|
||||
{
|
||||
bool good = true;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <QString>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "DolphinQt/Debugger/CodeDiffDialog.h"
|
||||
#include "DolphinQt/Debugger/CodeViewWidget.h"
|
||||
|
||||
class QCloseEvent;
|
||||
@@ -14,6 +15,7 @@ class QLineEdit;
|
||||
class QShowEvent;
|
||||
class QSplitter;
|
||||
class QListWidget;
|
||||
class QPushButton;
|
||||
class QTableWidget;
|
||||
|
||||
namespace Common
|
||||
@@ -35,6 +37,7 @@ public:
|
||||
void ShowPC();
|
||||
void SetPC();
|
||||
|
||||
void OnDiff();
|
||||
void ToggleBreakpoint();
|
||||
void AddBreakpoint();
|
||||
void SetAddress(u32 address, CodeViewWidget::SetAddressUpdate update);
|
||||
@@ -63,8 +66,10 @@ private:
|
||||
void closeEvent(QCloseEvent*) override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
CodeDiffDialog* m_diff_dialog = nullptr;
|
||||
QLineEdit* m_search_address;
|
||||
QLineEdit* m_search_symbols;
|
||||
QPushButton* m_code_diff;
|
||||
|
||||
QListWidget* m_callstack_list;
|
||||
QListWidget* m_symbols_list;
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
<ClCompile Include="Config\WiimoteControllersWidget.cpp" />
|
||||
<ClCompile Include="ConvertDialog.cpp" />
|
||||
<ClCompile Include="Debugger\BreakpointWidget.cpp" />
|
||||
<ClCompile Include="Debugger\CodeDiffDialog.cpp" />
|
||||
<ClCompile Include="Debugger\CodeViewWidget.cpp" />
|
||||
<ClCompile Include="Debugger\CodeWidget.cpp" />
|
||||
<ClCompile Include="Debugger\JITWidget.cpp" />
|
||||
@@ -305,6 +306,7 @@
|
||||
<QtMoc Include="Config\WiimoteControllersWidget.h" />
|
||||
<QtMoc Include="ConvertDialog.h" />
|
||||
<QtMoc Include="Debugger\BreakpointWidget.h" />
|
||||
<QtMoc Include="Debugger\CodeDiffDialog.h" />
|
||||
<QtMoc Include="Debugger\CodeViewWidget.h" />
|
||||
<QtMoc Include="Debugger\CodeWidget.h" />
|
||||
<QtMoc Include="Debugger\JITWidget.h" />
|
||||
|
||||
Reference in New Issue
Block a user