summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/Debugger/CodeWindow.h
blob: bbb501fec40313ce92e91cc18be36e6f40000e6e (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.

#pragma once

#include <wx/bitmap.h>
#include <wx/defs.h>
#include <wx/event.h>
#include <wx/gdicmn.h>
#include <wx/panel.h>
#include <wx/string.h>
#include <wx/translation.h>
#include <wx/windowid.h>

#include "Common/CommonTypes.h"
#include "Common/Event.h"
#include "DolphinWX/Globals.h"

class CFrame;
class CRegisterWindow;
class CWatchWindow;
class CBreakPointWindow;
class CMemoryWindow;
class CJitWindow;
class CCodeView;
class DSPDebuggerLLE;
class GFXDebuggerPanel;
struct SCoreStartupParameter;

class wxToolBar;
class wxListBox;
class wxMenu;
class wxMenuBar;

class CCodeWindow : public wxPanel
{
public:
	CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter,
	            CFrame * parent,
	            wxWindowID id = wxID_ANY,
	            const wxPoint& pos = wxDefaultPosition,
	            const wxSize& size = wxDefaultSize,
	            long style = wxTAB_TRAVERSAL | wxBORDER_NONE,
	            const wxString& name = _("Code"));

	void Load();
	void Save();

	// Parent interaction
	CFrame *Parent;
	wxMenuBar * GetMenuBar();
	wxToolBar * GetToolBar();
	wxBitmap m_Bitmaps[Toolbar_Debug_Bitmap_Max];

	bool UseInterpreter();
	bool BootToPause();
	bool AutomaticStart();
	bool JITNoBlockCache();
	bool JITNoBlockLinking();
	bool JumpToAddress(u32 address);

	void Update() override;
	void NotifyMapLoaded();
	void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar);
	void CreateMenuOptions(wxMenu *pMenu);
	void CreateMenuSymbols(wxMenuBar *pMenuBar);
	void RecreateToolbar(wxToolBar*);
	void PopulateToolbar(wxToolBar* toolBar);
	void UpdateButtonStates();
	void OpenPages();
	void UpdateManager();

	// Menu bar
	// -------------------
	void OnCPUMode(wxCommandEvent& event); // CPU Mode menu
	void OnJITOff(wxCommandEvent& event);

	void ToggleCodeWindow(bool bShow);
	void ToggleRegisterWindow(bool bShow);
	void ToggleWatchWindow(bool bShow);
	void ToggleBreakPointWindow(bool bShow);
	void ToggleMemoryWindow(bool bShow);
	void ToggleJitWindow(bool bShow);
	void ToggleSoundWindow(bool bShow);
	void ToggleVideoWindow(bool bShow);

	void OnChangeFont(wxCommandEvent& event);

	void OnCodeStep(wxCommandEvent& event);
	void OnAddrBoxChange(wxCommandEvent& event);
	void OnSymbolsMenu(wxCommandEvent& event);
	void OnJitMenu(wxCommandEvent& event);
	void OnProfilerMenu(wxCommandEvent& event);

	// Sub dialogs
	CRegisterWindow* m_RegisterWindow;
	CWatchWindow* m_WatchWindow;
	CBreakPointWindow* m_BreakpointWindow;
	CMemoryWindow* m_MemoryWindow;
	CJitWindow* m_JitWindow;
	DSPDebuggerLLE* m_SoundWindow;
	GFXDebuggerPanel* m_VideoWindow;

	// Settings
	bool bAutomaticStart; bool bBootToPause;
	bool bShowOnStart[IDM_VIDEO_WINDOW - IDM_LOG_WINDOW + 1];
	int iNbAffiliation[IDM_CODE_WINDOW - IDM_LOG_WINDOW + 1];

private:
	void OnSymbolListChange(wxCommandEvent& event);
	void OnSymbolListContextMenu(wxContextMenuEvent& event);
	void OnCallstackListChange(wxCommandEvent& event);
	void OnCallersListChange(wxCommandEvent& event);
	void OnCallsListChange(wxCommandEvent& event);
	void OnCodeViewChange(wxCommandEvent &event);
	void OnHostMessage(wxCommandEvent& event);

	// Debugger functions
	void SingleStep();
	void StepOver();
	void StepOut();
	void ToggleBreakpoint();

	void UpdateLists();
	void UpdateCallstack();

	void InitBitmaps();

	CCodeView* codeview;
	wxListBox* callstack;
	wxListBox* symbols;
	wxListBox* callers;
	wxListBox* calls;
	Common::Event sync_event;
};