blob: d1eeef49efa6e2b54758b4b45d50c132592e9b38 (
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
// Copyright 2018 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <vector>
#include <QTableWidget>
#include "Common/CommonTypes.h"
#include "Core/Debugger/CodeTrace.h"
class QFont;
class QKeyEvent;
class QMouseEvent;
class QResizeEvent;
class QShowEvent;
namespace Core
{
class CPUThreadGuard;
class System;
} // namespace Core
struct CodeViewBranch;
class BranchDisplayDelegate;
class PPCSymbolDB;
class CodeViewWidget : public QTableWidget
{
Q_OBJECT
public:
enum class SetAddressUpdate
{
WithUpdate,
WithoutUpdate,
WithDetailedUpdate
};
explicit CodeViewWidget();
~CodeViewWidget() override;
u32 GetAddress() const;
void OnLockAddress(bool lock);
u32 GetContextAddress() const;
void SetAddress(u32 address, SetAddressUpdate update);
// Set tighter row height. Set BP column sizing. This needs to run when font type changes.
void FontBasedSizing();
void Update();
void Update(const Core::CPUThreadGuard* guard);
void ToggleBreakpoint();
void AddBreakpoint();
u32 AddressForRow(int row) const;
signals:
void RequestPPCComparison(u32 address, bool translate_address);
void ShowMemory(u32 address);
void UpdateCodeWidget();
void ActivateSearch();
private:
enum class ReplaceWith
{
BLR,
NOP
};
void ReplaceAddress(u32 address, ReplaceWith replace);
void resizeEvent(QResizeEvent*) override;
void keyPressEvent(QKeyEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
void wheelEvent(QWheelEvent* event) override;
void showEvent(QShowEvent* event) override;
void OnContextMenu();
void AutoStep(CodeTrace::AutoStop option = CodeTrace::AutoStop::Always);
void OnDebugFontChanged(const QFont& font);
void OnFollowBranch();
void OnCopyAddress();
void OnCopyTargetAddress();
void OnShowInMemory();
void OnShowTargetInMemory();
void OnCopyFunction();
void OnCopyCode();
void OnCopyHex();
void OnSelectionChanged();
void OnRunToHere();
void OnAddFunction();
void OnEditSymbol();
void OnDeleteSymbol();
void OnAddNote();
void OnPPCComparison();
void OnEditNote();
void OnDeleteNote();
void OnInsertBLR();
void OnInsertNOP();
void OnReplaceInstruction();
void OnAssembleInstruction();
void DoPatchInstruction(bool assemble);
void OnRestoreInstruction();
void CalculateBranchIndentation();
Core::System& m_system;
PPCSymbolDB& m_ppc_symbol_db;
bool m_updating = false;
u32 m_address = 0;
bool m_lock_address = false;
u32 m_context_address = 0;
std::vector<CodeViewBranch> m_branches;
friend class BranchDisplayDelegate;
};
|