-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDisasmView.cpp
99 lines (85 loc) · 3.21 KB
/
DisasmView.cpp
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
#include <QKeyEvent>
#include "DisasmView.h"
#include "MainWindow.h"
//extern CMainFrame *g_pMainFrame;
CDisasmView::CDisasmView(QWidget *parent) : QDockWidget(parent)
{
m_pDisasmDlg = new CDisasmDlg(this);
setWidget(m_pDisasmDlg);
QObject::connect(this, &CDisasmView::DebugBreak, (CMainFrame *)parent, &CMainFrame::OnDebugBreak);
QObject::connect(this, &CDisasmView::DebugStepinto, (CMainFrame *)parent, &CMainFrame::OnDebugStepinto);
QObject::connect(this, &CDisasmView::DebugStepover, (CMainFrame *)parent, &CMainFrame::OnDebugStepover);
QObject::connect(this, &CDisasmView::DebugStepout, (CMainFrame *)parent, &CMainFrame::OnDebugStepout);
#ifdef ENABLE_BACKTRACE
QObject::connect(this, &CDisasmView::DebugStepback, (CMainFrame *)parent, &CMainFrame::OnDebugStepBack);
QObject::connect(this, &CDisasmView::DebugStepbackOver, (CMainFrame *)parent, &CMainFrame::OnDebugStepBackOver);
QObject::connect(this, &CDisasmView::DebugBTReset, (CMainFrame *)parent, &CMainFrame::OnDebugBTReset);
QObject::connect(this, &CDisasmView::DebugBTRewindToTail, (CMainFrame *)parent, &CMainFrame::OnDebugBTRewindToTail);
#endif
QObject::connect(m_pDisasmDlg, &CDisasmDlg::UpdateBreakPointView, (CMainFrame *)parent, &CMainFrame::OnUpdateBreakPointView);
QObject::connect(m_pDisasmDlg, &CDisasmDlg::UpdateSymbolTableView, (CMainFrame *)parent, &CMainFrame::OnUpdateSymbolTableView);
}
CDisasmView::~CDisasmView() = default;
void CDisasmView::AttachDebugger(CDebugger *pDebugger)
{
m_pDebugger = pDebugger;
m_pDisasmDlg->AttachDebugger(pDebugger);
}
void CDisasmView::keyPressEvent(QKeyEvent *event)
{
switch(event->key()) {
case Qt::Key::Key_F5:
event->ignore();
emit DebugBreak();
break;
#ifdef ENABLE_BACKTRACE
case Qt::Key::Key_F7:
event->ignore();
emit DebugStepbackOver();
break;
case Qt::Key::Key_F8:
event->ignore();
emit DebugStepback();
break;
case Qt::Key::Key_F9:
event->ignore();
{
Qt::KeyboardModifiers mod = QGuiApplication::queryKeyboardModifiers();
if(mod & Qt::KeyboardModifier::ShiftModifier) {
emit DebugBTReset();
} else {
emit DebugBTRewindToTail();
}
}
break;
#endif
case Qt::Key::Key_F10:
event->ignore();
emit DebugStepover();
break;
case Qt::Key::Key_F11:
event->ignore();
emit DebugStepinto();
break;
case Qt::Key::Key_F12:
event->ignore();
emit DebugStepout();
break;
case Qt::Key::Key_PageUp:
event->ignore();
m_pDisasmDlg->OnDisasmPgUp();
break;
case Qt::Key::Key_PageDown:
event->ignore();
m_pDisasmDlg->OnDisasmPgDn();
break;
case Qt::Key::Key_Up:
event->ignore();
m_pDisasmDlg->OnDisasmStepUp();
break;
case Qt::Key::Key_Down:
event->ignore();
m_pDisasmDlg->OnDisasmStepDn();
break;
}
};