| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <vector> |
| 7 |
|
| 8 |
#include <QTableWidget> |
| 9 |
|
| 10 |
#include "Common/CommonTypes.h" |
| 11 |
#include "Core/Debugger/CodeTrace.h" |
| 12 |
|
| 13 |
class QFont; |
| 14 |
class QKeyEvent; |
| 15 |
class QMouseEvent; |
| 16 |
class QResizeEvent; |
| 17 |
class QShowEvent; |
| 18 |
|
| 19 |
namespace Core |
| 20 |
{ |
| 21 |
class CPUThreadGuard; |
| 22 |
class System; |
| 23 |
} |
| 24 |
|
| 25 |
struct CodeViewBranch; |
| 26 |
class BranchDisplayDelegate; |
| 27 |
class PPCSymbolDB; |
| 28 |
|
| 29 |
class CodeViewWidget : public QTableWidget |
| 30 |
{ |
| 31 |
Q_OBJECT |
| 32 |
public: |
| 33 |
enum class SetAddressUpdate |
| 34 |
{ |
| 35 |
WithUpdate, |
| 36 |
WithoutUpdate, |
| 37 |
WithDetailedUpdate |
| 38 |
}; |
| 39 |
|
| 40 |
explicit CodeViewWidget(); |
| 41 |
~CodeViewWidget() override; |
| 42 |
|
| 43 |
u32 GetAddress() const; |
| 44 |
void OnLockAddress(bool lock); |
| 45 |
u32 GetContextAddress() const; |
| 46 |
void SetAddress(u32 address, SetAddressUpdate update); |
| 47 |
|
| 48 |
|
| 49 |
void FontBasedSizing(); |
| 50 |
void Update(); |
| 51 |
void Update(const Core::CPUThreadGuard* guard); |
| 52 |
|
| 53 |
void ToggleBreakpoint(); |
| 54 |
void AddBreakpoint(); |
| 55 |
|
| 56 |
u32 AddressForRow(int row) const; |
| 57 |
|
| 58 |
signals: |
| 59 |
void RequestPPCComparison(u32 address, bool translate_address); |
| 60 |
void ShowMemory(u32 address); |
| 61 |
void UpdateCodeWidget(); |
| 62 |
void ActivateSearch(); |
| 63 |
|
| 64 |
private: |
| 65 |
enum class ReplaceWith |
| 66 |
{ |
| 67 |
BLR, |
| 68 |
NOP |
| 69 |
}; |
| 70 |
|
| 71 |
void ReplaceAddress(u32 address, ReplaceWith replace); |
| 72 |
|
| 73 |
void resizeEvent(QResizeEvent*) override; |
| 74 |
void keyPressEvent(QKeyEvent* event) override; |
| 75 |
void mousePressEvent(QMouseEvent* event) override; |
| 76 |
void wheelEvent(QWheelEvent* event) override; |
| 77 |
void showEvent(QShowEvent* event) override; |
| 78 |
|
| 79 |
void OnContextMenu(); |
| 80 |
|
| 81 |
void AutoStep(CodeTrace::AutoStop option = CodeTrace::AutoStop::Always); |
| 82 |
void OnDebugFontChanged(const QFont& font); |
| 83 |
void OnFollowBranch(); |
| 84 |
void OnCopyAddress(); |
| 85 |
void OnCopyTargetAddress(); |
| 86 |
void OnShowInMemory(); |
| 87 |
void OnShowTargetInMemory(); |
| 88 |
void OnCopyFunction(); |
| 89 |
void OnCopyCode(); |
| 90 |
void OnCopyHex(); |
| 91 |
void OnSelectionChanged(); |
| 92 |
void OnRunToHere(); |
| 93 |
void OnAddFunction(); |
| 94 |
void OnEditSymbol(); |
| 95 |
void OnDeleteSymbol(); |
| 96 |
void OnAddNote(); |
| 97 |
void OnPPCComparison(); |
| 98 |
void OnEditNote(); |
| 99 |
void OnDeleteNote(); |
| 100 |
void OnInsertBLR(); |
| 101 |
void OnInsertNOP(); |
| 102 |
void OnReplaceInstruction(); |
| 103 |
void OnAssembleInstruction(); |
| 104 |
void DoPatchInstruction(bool assemble); |
| 105 |
void OnRestoreInstruction(); |
| 106 |
|
| 107 |
void CalculateBranchIndentation(); |
| 108 |
|
| 109 |
Core::System& m_system; |
| 110 |
PPCSymbolDB& m_ppc_symbol_db; |
| 111 |
|
| 112 |
bool m_updating = false; |
| 113 |
|
| 114 |
u32 m_address = 0; |
| 115 |
bool m_lock_address = false; |
| 116 |
u32 m_context_address = 0; |
| 117 |
|
| 118 |
std::vector<CodeViewBranch> m_branches; |
| 119 |
|
| 120 |
friend class BranchDisplayDelegate; |
| 121 |
}; |