mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-11 00:29:11 +01:00
7cecb28bdf
This fixes a problem I was having where using frame advance with the debugger open would frequently cause panic alerts about invalid addresses due to the CPU thread changing MSR.DR while the host thread was trying to access memory. To aid in tracking down all the places where we weren't properly locking the CPU, I've created a new type (in Core.h) that you have to pass as a reference or pointer to functions that require running as the CPU thread.
83 lines
1.8 KiB
C++
83 lines
1.8 KiB
C++
// Copyright 2017 Dolphin Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <QDockWidget>
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
class QAction;
|
|
class QCloseEvent;
|
|
class QShowEvent;
|
|
class QTableWidget;
|
|
class QTableWidgetItem;
|
|
class QToolBar;
|
|
|
|
namespace Core
|
|
{
|
|
class CPUThreadGuard;
|
|
};
|
|
|
|
class WatchWidget : public QDockWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit WatchWidget(QWidget* parent = nullptr);
|
|
~WatchWidget();
|
|
|
|
void AddWatch(QString name, u32 addr);
|
|
signals:
|
|
void RequestMemoryBreakpoint(u32 addr);
|
|
void ShowMemory(u32 addr);
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent*) override;
|
|
void showEvent(QShowEvent* event) override;
|
|
|
|
private:
|
|
void CreateWidgets();
|
|
void ConnectWidgets();
|
|
|
|
void OnDelete();
|
|
void OnClear();
|
|
void OnNewWatch();
|
|
|
|
void OnLoad();
|
|
void OnSave();
|
|
|
|
void UpdateButtonsEnabled();
|
|
void Update();
|
|
|
|
void ShowContextMenu();
|
|
void OnItemChanged(QTableWidgetItem* item);
|
|
void LockWatchAddress(const Core::CPUThreadGuard& guard, u32 address);
|
|
void DeleteSelectedWatches();
|
|
void DeleteWatch(const Core::CPUThreadGuard& guard, int row);
|
|
void DeleteWatchAndUpdate(int row);
|
|
void AddWatchBreakpoint(int row);
|
|
void ShowInMemory(int row);
|
|
void UpdateIcons();
|
|
void LockSelectedWatches();
|
|
void UnlockSelectedWatches();
|
|
|
|
QAction* m_new;
|
|
QAction* m_delete;
|
|
QAction* m_clear;
|
|
QAction* m_load;
|
|
QAction* m_save;
|
|
QToolBar* m_toolbar;
|
|
QTableWidget* m_table;
|
|
|
|
bool m_updating = false;
|
|
|
|
static constexpr int NUM_COLUMNS = 7;
|
|
static constexpr int COLUMN_INDEX_LABEL = 0;
|
|
static constexpr int COLUMN_INDEX_ADDRESS = 1;
|
|
static constexpr int COLUMN_INDEX_HEX = 2;
|
|
static constexpr int COLUMN_INDEX_DECIMAL = 3;
|
|
static constexpr int COLUMN_INDEX_STRING = 4;
|
|
static constexpr int COLUMN_INDEX_FLOAT = 5;
|
|
static constexpr int COLUMN_INDEX_LOCK = 6;
|
|
};
|