summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Debugger/BreakpointWidget.h
blob: 0341fdd50b8c88deb5c090cac600597b9297825b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright 2017 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <optional>

#include <QDockWidget>
#include <QString>

#include "Common/CommonTypes.h"

class QAction;
class QCloseEvent;
class QPoint;
class QShowEvent;
class QTableWidget;
class QTableWidgetItem;
class QToolBar;
class QWidget;

namespace Core
{
class System;
}

class CustomDelegate;

class BreakpointWidget : public QDockWidget
{
  Q_OBJECT
public:
  explicit BreakpointWidget(QWidget* parent = nullptr);
  ~BreakpointWidget() override;

  void AddBP(u32 addr);
  void AddBP(u32 addr, bool break_on_hit, bool log_on_hit, const QString& condition);
  void AddAddressMBP(u32 addr, bool on_read = true, bool on_write = true, bool do_log = true,
                     bool do_break = true, const QString& condition = {});
  void AddRangedMBP(u32 from, u32 to, bool do_read = true, bool do_write = true, bool do_log = true,
                    bool do_break = true, const QString& condition = {});
  void UpdateButtonsEnabled();
  void Update();

signals:
  void ShowCode(u32 address);
  void ShowMemory(u32 address);

protected:
  void closeEvent(QCloseEvent*) override;
  void showEvent(QShowEvent* event) override;

private:
  void CreateWidgets();

  void EditBreakpoint(u32 address, int edit, std::optional<QString> = std::nullopt);
  void EditMBP(u32 address, int edit, std::optional<QString> = std::nullopt);

  void OnClear();
  void OnClicked(QTableWidgetItem* item);
  void OnToggleBreaking();
  void OnNewBreakpoint();
  void OnEditBreakpoint(u32 address, bool is_instruction_bp);
  void OnLoad();
  void OnSave();
  void OnContextMenu(const QPoint& pos);
  void OnItemChanged(QTableWidgetItem* item);
  void OnDebugFontChanged(const QFont& font);

  void UpdateIcons();

  Core::System& m_system;

  QToolBar* m_toolbar;
  QTableWidget* m_table;
  QAction* m_enabled;
  QAction* m_new;
  QAction* m_clear;
  QAction* m_load;
  QAction* m_save;
};