openMSX
ImGuiDebugger.hh
Go to the documentation of this file.
1#ifndef IMGUI_DEBUGGER_HH
2#define IMGUI_DEBUGGER_HH
3
4#include "DebuggableEditor.hh"
5#include "ImGuiPart.hh"
6
7#include "EmuTime.hh"
8
9#include <memory>
10#include <optional>
11#include <string>
12
13namespace openmsx {
14
15class CPURegs;
16class Debuggable;
17class Debugger;
18class MSXCPUInterface;
19class SymbolManager;
20
21class ImGuiDebugger final : public ImGuiPart
22{
23public:
26
27 static void loadIcons();
28
29 void signalBreak();
30
31 [[nodiscard]] zstring_view iniName() const override { return "debugger"; }
32 void save(ImGuiTextBuffer& buf) override;
33 void loadStart() override;
34 void loadLine(std::string_view name, zstring_view value) override;
35 void loadEnd() override;
36 void showMenu(MSXMotherBoard* motherBoard) override;
37 void paint(MSXMotherBoard* motherBoard) override;
38
39private:
40 void drawControl(MSXCPUInterface& cpuInterface);
41 void drawDisassembly(CPURegs& regs, MSXCPUInterface& cpuInterface, Debugger& debugger, EmuTime::param time);
42 void drawSlots(MSXCPUInterface& cpuInterface, Debugger& debugger);
43 void drawStack(const CPURegs& regs, const MSXCPUInterface& cpuInterface, EmuTime::param time);
44 void drawRegisters(CPURegs& regs);
45 void drawFlags(CPURegs& regs);
46
47 void checkShortcuts(MSXCPUInterface& cpuInterface);
48 void actionBreakContinue(MSXCPUInterface& cpuInterface);
49 void actionStepIn(MSXCPUInterface& cpuInterface);
50 void actionStepOver();
51 void actionStepOut();
52 void actionStepBack();
53
54private:
55 SymbolManager& symbolManager;
56 size_t cycleLabelsCounter = 0;
57
58 std::vector<std::unique_ptr<DebuggableEditor>> hexEditors; // sorted on 'getDebuggableName()'
59
60 std::string gotoAddr;
61 std::string runToAddr;
62 std::optional<unsigned> gotoTarget;
63 std::optional<float> setDisassemblyScrollY;
64 bool followPC = false;
65
66 bool showControl = false;
67 bool showDisassembly = false;
68 bool showSlots = false;
69 bool showStack = false;
70 bool showRegisters = false;
71 bool showFlags = false;
72 bool showXYFlags = false;
73 int flagsLayout = 1;
74
75 bool syncDisassemblyWithPC = false;
76 float disassemblyScrollY = 0.0f;
77
78 static constexpr auto persistentElements = std::tuple{
79 PersistentElement{"showControl", &ImGuiDebugger::showControl},
80 PersistentElement{"showDisassembly", &ImGuiDebugger::showDisassembly},
81 PersistentElement{"followPC", &ImGuiDebugger::followPC},
82 PersistentElement{"showRegisters", &ImGuiDebugger::showRegisters},
83 PersistentElement{"showSlots", &ImGuiDebugger::showSlots},
84 PersistentElement{"showStack", &ImGuiDebugger::showStack},
85 PersistentElement{"showFlags", &ImGuiDebugger::showFlags},
86 PersistentElement{"showXYFlags", &ImGuiDebugger::showXYFlags},
87 PersistentElement{"disassemblyY", &ImGuiDebugger::disassemblyScrollY},
88 PersistentElementMax{"flagsLayout", &ImGuiDebugger::flagsLayout, 2}
89 // manually handle "showDebuggable.xxx"
90 };
91};
92
93} // namespace openmsx
94
95#endif
void loadEnd() override
void loadStart() override
void showMenu(MSXMotherBoard *motherBoard) override
void loadLine(std::string_view name, zstring_view value) override
void paint(MSXMotherBoard *motherBoard) override
void save(ImGuiTextBuffer &buf) override
zstring_view iniName() const override
ImGuiManager & manager
Definition ImGuiPart.hh:30
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
This file implemented 3 utility functions:
Definition Autofire.cc:11
PersistentElement(zstring_view, T C::*) -> PersistentElement< C, T >