DolphinQt: Don't update debug widgets when hidden
Saves on CPU usage when pausing/unpausing with the debugger disabled. This is especially important when using frame advance rapidly.
This commit is contained in:
parent
0a7395bfba
commit
92a655c8b9
|
@ -41,14 +41,8 @@ BreakpointWidget::BreakpointWidget(QWidget* parent) : QDockWidget(parent)
|
||||||
CreateWidgets();
|
CreateWidgets();
|
||||||
|
|
||||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, [this](Core::State state) {
|
connect(&Settings::Instance(), &Settings::EmulationStateChanged, [this](Core::State state) {
|
||||||
if (!Settings::Instance().IsDebugModeEnabled())
|
UpdateButtonsEnabled();
|
||||||
return;
|
if (state == Core::State::Uninitialized)
|
||||||
|
|
||||||
bool is_initialised = state != Core::State::Uninitialized;
|
|
||||||
m_new->setEnabled(is_initialised);
|
|
||||||
m_load->setEnabled(is_initialised);
|
|
||||||
m_save->setEnabled(is_initialised);
|
|
||||||
if (!is_initialised)
|
|
||||||
{
|
{
|
||||||
PowerPC::breakpoints.Clear();
|
PowerPC::breakpoints.Clear();
|
||||||
PowerPC::memchecks.Clear();
|
PowerPC::memchecks.Clear();
|
||||||
|
@ -65,8 +59,6 @@ BreakpointWidget::BreakpointWidget(QWidget* parent) : QDockWidget(parent)
|
||||||
|
|
||||||
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &BreakpointWidget::UpdateIcons);
|
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &BreakpointWidget::UpdateIcons);
|
||||||
UpdateIcons();
|
UpdateIcons();
|
||||||
|
|
||||||
Update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BreakpointWidget::~BreakpointWidget()
|
BreakpointWidget::~BreakpointWidget()
|
||||||
|
@ -138,8 +130,28 @@ void BreakpointWidget::closeEvent(QCloseEvent*)
|
||||||
Settings::Instance().SetBreakpointsVisible(false);
|
Settings::Instance().SetBreakpointsVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BreakpointWidget::showEvent(QShowEvent* event)
|
||||||
|
{
|
||||||
|
UpdateButtonsEnabled();
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BreakpointWidget::UpdateButtonsEnabled()
|
||||||
|
{
|
||||||
|
if (!isVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const bool is_initialised = Core::GetState() != Core::State::Uninitialized;
|
||||||
|
m_new->setEnabled(is_initialised);
|
||||||
|
m_load->setEnabled(is_initialised);
|
||||||
|
m_save->setEnabled(is_initialised);
|
||||||
|
}
|
||||||
|
|
||||||
void BreakpointWidget::Update()
|
void BreakpointWidget::Update()
|
||||||
{
|
{
|
||||||
|
if (!isVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
m_table->clear();
|
m_table->clear();
|
||||||
|
|
||||||
m_table->setHorizontalHeaderLabels(
|
m_table->setHorizontalHeaderLabels(
|
||||||
|
|
|
@ -9,9 +9,10 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
class QAction;
|
class QAction;
|
||||||
|
class QCloseEvent;
|
||||||
|
class QShowEvent;
|
||||||
class QTableWidget;
|
class QTableWidget;
|
||||||
class QToolBar;
|
class QToolBar;
|
||||||
class QCloseEvent;
|
|
||||||
|
|
||||||
class BreakpointWidget : public QDockWidget
|
class BreakpointWidget : public QDockWidget
|
||||||
{
|
{
|
||||||
|
@ -25,6 +26,7 @@ public:
|
||||||
bool do_break = true);
|
bool do_break = true);
|
||||||
void AddRangedMBP(u32 from, u32 to, bool do_read = true, bool do_write = true, bool do_log = true,
|
void AddRangedMBP(u32 from, u32 to, bool do_read = true, bool do_write = true, bool do_log = true,
|
||||||
bool do_break = true);
|
bool do_break = true);
|
||||||
|
void UpdateButtonsEnabled();
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -33,6 +35,7 @@ signals:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent*) override;
|
void closeEvent(QCloseEvent*) override;
|
||||||
|
void showEvent(QShowEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateWidgets();
|
void CreateWidgets();
|
||||||
|
|
|
@ -92,6 +92,9 @@ void CodeViewWidget::FontBasedSizing()
|
||||||
|
|
||||||
void CodeViewWidget::Update()
|
void CodeViewWidget::Update()
|
||||||
{
|
{
|
||||||
|
if (!isVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_updating)
|
if (m_updating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -568,6 +571,11 @@ void CodeViewWidget::mousePressEvent(QMouseEvent* event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeViewWidget::showEvent(QShowEvent* event)
|
||||||
|
{
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
void CodeViewWidget::ToggleBreakpoint()
|
void CodeViewWidget::ToggleBreakpoint()
|
||||||
{
|
{
|
||||||
if (PowerPC::debug_interface.IsBreakpoint(GetContextAddress()))
|
if (PowerPC::debug_interface.IsBreakpoint(GetContextAddress()))
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
class QMouseEvent;
|
class QMouseEvent;
|
||||||
class QResizeEvent;
|
class QResizeEvent;
|
||||||
|
class QShowEvent;
|
||||||
|
|
||||||
class CodeViewWidget : public QTableWidget
|
class CodeViewWidget : public QTableWidget
|
||||||
{
|
{
|
||||||
|
@ -56,6 +57,7 @@ private:
|
||||||
void keyPressEvent(QKeyEvent* event) override;
|
void keyPressEvent(QKeyEvent* event) override;
|
||||||
void mousePressEvent(QMouseEvent* event) override;
|
void mousePressEvent(QMouseEvent* event) override;
|
||||||
void wheelEvent(QWheelEvent* event) override;
|
void wheelEvent(QWheelEvent* event) override;
|
||||||
|
void showEvent(QShowEvent* event) override;
|
||||||
|
|
||||||
void OnContextMenu();
|
void OnContextMenu();
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,6 @@ CodeWidget::CodeWidget(QWidget* parent) : QDockWidget(parent)
|
||||||
settings.value(QStringLiteral("codewidget/codesplitter")).toByteArray());
|
settings.value(QStringLiteral("codewidget/codesplitter")).toByteArray());
|
||||||
m_box_splitter->restoreState(
|
m_box_splitter->restoreState(
|
||||||
settings.value(QStringLiteral("codewidget/boxsplitter")).toByteArray());
|
settings.value(QStringLiteral("codewidget/boxsplitter")).toByteArray());
|
||||||
|
|
||||||
Update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeWidget::~CodeWidget()
|
CodeWidget::~CodeWidget()
|
||||||
|
@ -83,6 +81,11 @@ void CodeWidget::closeEvent(QCloseEvent*)
|
||||||
Settings::Instance().SetCodeVisible(false);
|
Settings::Instance().SetCodeVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeWidget::showEvent(QShowEvent* event)
|
||||||
|
{
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
void CodeWidget::CreateWidgets()
|
void CodeWidget::CreateWidgets()
|
||||||
{
|
{
|
||||||
auto* layout = new QGridLayout;
|
auto* layout = new QGridLayout;
|
||||||
|
@ -265,6 +268,9 @@ void CodeWidget::SetAddress(u32 address, CodeViewWidget::SetAddressUpdate update
|
||||||
|
|
||||||
void CodeWidget::Update()
|
void CodeWidget::Update()
|
||||||
{
|
{
|
||||||
|
if (!isVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
const Common::Symbol* symbol = g_symbolDB.GetSymbolFromAddr(m_code_view->GetAddress());
|
const Common::Symbol* symbol = g_symbolDB.GetSymbolFromAddr(m_code_view->GetAddress());
|
||||||
|
|
||||||
UpdateCallstack();
|
UpdateCallstack();
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
class QCloseEvent;
|
class QCloseEvent;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
class QShowEvent;
|
||||||
class QSplitter;
|
class QSplitter;
|
||||||
class QListWidget;
|
class QListWidget;
|
||||||
class QTableWidget;
|
class QTableWidget;
|
||||||
|
@ -61,6 +62,7 @@ private:
|
||||||
void OnSelectFunctionCalls();
|
void OnSelectFunctionCalls();
|
||||||
|
|
||||||
void closeEvent(QCloseEvent*) override;
|
void closeEvent(QCloseEvent*) override;
|
||||||
|
void showEvent(QShowEvent* event) override;
|
||||||
|
|
||||||
QLineEdit* m_search_address;
|
QLineEdit* m_search_address;
|
||||||
QLineEdit* m_search_symbols;
|
QLineEdit* m_search_symbols;
|
||||||
|
|
|
@ -57,8 +57,6 @@ JITWidget::JITWidget(QWidget* parent) : QDockWidget(parent)
|
||||||
#else
|
#else
|
||||||
m_disassembler = GetNewDisassembler("UNK");
|
m_disassembler = GetNewDisassembler("UNK");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JITWidget::~JITWidget()
|
JITWidget::~JITWidget()
|
||||||
|
@ -126,6 +124,9 @@ void JITWidget::Compare(u32 address)
|
||||||
|
|
||||||
void JITWidget::Update()
|
void JITWidget::Update()
|
||||||
{
|
{
|
||||||
|
if (!isVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!m_address)
|
if (!m_address)
|
||||||
{
|
{
|
||||||
m_ppc_asm_widget->setHtml(QStringLiteral("<i>%1</i>").arg(tr("(ppc)")));
|
m_ppc_asm_widget->setHtml(QStringLiteral("<i>%1</i>").arg(tr("(ppc)")));
|
||||||
|
@ -208,3 +209,8 @@ void JITWidget::closeEvent(QCloseEvent*)
|
||||||
{
|
{
|
||||||
Settings::Instance().SetJITVisible(false);
|
Settings::Instance().SetJITVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JITWidget::showEvent(QShowEvent* event)
|
||||||
|
{
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
class QCloseEvent;
|
class QCloseEvent;
|
||||||
|
class QShowEvent;
|
||||||
class QSplitter;
|
class QSplitter;
|
||||||
class QTextBrowser;
|
class QTextBrowser;
|
||||||
class QTableWidget;
|
class QTableWidget;
|
||||||
|
@ -31,6 +32,7 @@ private:
|
||||||
void ConnectWidgets();
|
void ConnectWidgets();
|
||||||
|
|
||||||
void closeEvent(QCloseEvent*) override;
|
void closeEvent(QCloseEvent*) override;
|
||||||
|
void showEvent(QShowEvent* event) override;
|
||||||
|
|
||||||
QTableWidget* m_table_widget;
|
QTableWidget* m_table_widget;
|
||||||
QTextBrowser* m_ppc_asm_widget;
|
QTextBrowser* m_ppc_asm_widget;
|
||||||
|
|
|
@ -57,7 +57,6 @@ MemoryWidget::MemoryWidget(QWidget* parent) : QDockWidget(parent)
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
|
||||||
ConnectWidgets();
|
ConnectWidgets();
|
||||||
Update();
|
|
||||||
OnAddressSpaceChanged();
|
OnAddressSpaceChanged();
|
||||||
OnTypeChanged();
|
OnTypeChanged();
|
||||||
}
|
}
|
||||||
|
@ -258,8 +257,16 @@ void MemoryWidget::closeEvent(QCloseEvent*)
|
||||||
Settings::Instance().SetMemoryVisible(false);
|
Settings::Instance().SetMemoryVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MemoryWidget::showEvent(QShowEvent* event)
|
||||||
|
{
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
void MemoryWidget::Update()
|
void MemoryWidget::Update()
|
||||||
{
|
{
|
||||||
|
if (!isVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
m_memory_view->Update();
|
m_memory_view->Update();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ class QLabel;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QRadioButton;
|
class QRadioButton;
|
||||||
|
class QShowEvent;
|
||||||
class QSplitter;
|
class QSplitter;
|
||||||
|
|
||||||
class MemoryWidget : public QDockWidget
|
class MemoryWidget : public QDockWidget
|
||||||
|
@ -61,6 +62,7 @@ private:
|
||||||
void FindValue(bool next);
|
void FindValue(bool next);
|
||||||
|
|
||||||
void closeEvent(QCloseEvent*) override;
|
void closeEvent(QCloseEvent*) override;
|
||||||
|
void showEvent(QShowEvent* event) override;
|
||||||
|
|
||||||
MemoryViewWidget* m_memory_view;
|
MemoryViewWidget* m_memory_view;
|
||||||
QSplitter* m_splitter;
|
QSplitter* m_splitter;
|
||||||
|
|
|
@ -38,14 +38,7 @@ RegisterWidget::RegisterWidget(QWidget* parent) : QDockWidget(parent)
|
||||||
PopulateTable();
|
PopulateTable();
|
||||||
ConnectWidgets();
|
ConnectWidgets();
|
||||||
|
|
||||||
connect(Host::GetInstance(), &Host::UpdateDisasmDialog, this, [this] {
|
connect(Host::GetInstance(), &Host::UpdateDisasmDialog, this, &RegisterWidget::Update);
|
||||||
if (Settings::Instance().IsDebugModeEnabled() && Core::GetState() == Core::State::Paused)
|
|
||||||
{
|
|
||||||
m_updating = true;
|
|
||||||
emit UpdateTable();
|
|
||||||
m_updating = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(&Settings::Instance(), &Settings::RegistersVisibilityChanged,
|
connect(&Settings::Instance(), &Settings::RegistersVisibilityChanged,
|
||||||
[this](bool visible) { setHidden(!visible); });
|
[this](bool visible) { setHidden(!visible); });
|
||||||
|
@ -68,6 +61,11 @@ void RegisterWidget::closeEvent(QCloseEvent*)
|
||||||
Settings::Instance().SetRegistersVisible(false);
|
Settings::Instance().SetRegistersVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RegisterWidget::showEvent(QShowEvent* event)
|
||||||
|
{
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
void RegisterWidget::CreateWidgets()
|
void RegisterWidget::CreateWidgets()
|
||||||
{
|
{
|
||||||
m_table = new QTableWidget;
|
m_table = new QTableWidget;
|
||||||
|
@ -375,3 +373,13 @@ void RegisterWidget::AddRegister(int row, int column, RegisterType type, std::st
|
||||||
|
|
||||||
connect(this, &RegisterWidget::UpdateTable, [value] { value->RefreshValue(); });
|
connect(this, &RegisterWidget::UpdateTable, [value] { value->RefreshValue(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RegisterWidget::Update()
|
||||||
|
{
|
||||||
|
if (isVisible() && Core::GetState() == Core::State::Paused)
|
||||||
|
{
|
||||||
|
m_updating = true;
|
||||||
|
emit UpdateTable();
|
||||||
|
m_updating = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
class QTableWidget;
|
class QTableWidget;
|
||||||
class QCloseEvent;
|
class QCloseEvent;
|
||||||
|
class QShowEvent;
|
||||||
|
|
||||||
class RegisterWidget : public QDockWidget
|
class RegisterWidget : public QDockWidget
|
||||||
{
|
{
|
||||||
|
@ -30,6 +31,7 @@ signals:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent*) override;
|
void closeEvent(QCloseEvent*) override;
|
||||||
|
void showEvent(QShowEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateWidgets();
|
void CreateWidgets();
|
||||||
|
@ -42,6 +44,8 @@ private:
|
||||||
void AddRegister(int row, int column, RegisterType type, std::string register_name,
|
void AddRegister(int row, int column, RegisterType type, std::string register_name,
|
||||||
std::function<u64()> get_reg, std::function<void(u64)> set_reg);
|
std::function<u64()> get_reg, std::function<void(u64)> set_reg);
|
||||||
|
|
||||||
|
void Update();
|
||||||
|
|
||||||
QTableWidget* m_table;
|
QTableWidget* m_table;
|
||||||
bool m_updating = false;
|
bool m_updating = false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,12 +43,7 @@ WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent)
|
||||||
ConnectWidgets();
|
ConnectWidgets();
|
||||||
|
|
||||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, [this](Core::State state) {
|
connect(&Settings::Instance(), &Settings::EmulationStateChanged, [this](Core::State state) {
|
||||||
if (!Settings::Instance().IsDebugModeEnabled())
|
UpdateButtonsEnabled();
|
||||||
return;
|
|
||||||
|
|
||||||
m_load->setEnabled(Core::IsRunning());
|
|
||||||
m_save->setEnabled(Core::IsRunning());
|
|
||||||
|
|
||||||
if (state != Core::State::Starting)
|
if (state != Core::State::Starting)
|
||||||
Update();
|
Update();
|
||||||
});
|
});
|
||||||
|
@ -61,8 +56,6 @@ WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent)
|
||||||
|
|
||||||
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &WatchWidget::UpdateIcons);
|
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &WatchWidget::UpdateIcons);
|
||||||
UpdateIcons();
|
UpdateIcons();
|
||||||
|
|
||||||
Update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WatchWidget::~WatchWidget()
|
WatchWidget::~WatchWidget()
|
||||||
|
@ -117,8 +110,20 @@ void WatchWidget::UpdateIcons()
|
||||||
m_save->setIcon(Resources::GetScaledThemeIcon("debugger_save"));
|
m_save->setIcon(Resources::GetScaledThemeIcon("debugger_save"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WatchWidget::UpdateButtonsEnabled()
|
||||||
|
{
|
||||||
|
if (!isVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_load->setEnabled(Core::IsRunning());
|
||||||
|
m_save->setEnabled(Core::IsRunning());
|
||||||
|
}
|
||||||
|
|
||||||
void WatchWidget::Update()
|
void WatchWidget::Update()
|
||||||
{
|
{
|
||||||
|
if (!isVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
m_updating = true;
|
m_updating = true;
|
||||||
|
|
||||||
m_table->clear();
|
m_table->clear();
|
||||||
|
@ -200,6 +205,12 @@ void WatchWidget::closeEvent(QCloseEvent*)
|
||||||
Settings::Instance().SetWatchVisible(false);
|
Settings::Instance().SetWatchVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WatchWidget::showEvent(QShowEvent* event)
|
||||||
|
{
|
||||||
|
UpdateButtonsEnabled();
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
void WatchWidget::OnLoad()
|
void WatchWidget::OnLoad()
|
||||||
{
|
{
|
||||||
IniFile ini;
|
IniFile ini;
|
||||||
|
|
|
@ -13,6 +13,7 @@ class QTableWidget;
|
||||||
class QTableWidgetItem;
|
class QTableWidgetItem;
|
||||||
class QToolBar;
|
class QToolBar;
|
||||||
class QCloseEvent;
|
class QCloseEvent;
|
||||||
|
class QShowEvent;
|
||||||
|
|
||||||
class WatchWidget : public QDockWidget
|
class WatchWidget : public QDockWidget
|
||||||
{
|
{
|
||||||
|
@ -27,6 +28,7 @@ signals:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent*) override;
|
void closeEvent(QCloseEvent*) override;
|
||||||
|
void showEvent(QShowEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateWidgets();
|
void CreateWidgets();
|
||||||
|
@ -35,6 +37,7 @@ private:
|
||||||
void OnLoad();
|
void OnLoad();
|
||||||
void OnSave();
|
void OnSave();
|
||||||
|
|
||||||
|
void UpdateButtonsEnabled();
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
void ShowContextMenu();
|
void ShowContextMenu();
|
||||||
|
|
Loading…
Reference in New Issue