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 void setGotoTarget(uint16_t target);
39
40private:
41 void drawControl(MSXCPUInterface& cpuInterface, MSXMotherBoard& motherBoard);
42 void drawDisassembly(CPURegs& regs, MSXCPUInterface& cpuInterface, Debugger& debugger,
43 MSXMotherBoard& motherBoard, EmuTime::param time);
44 void drawSlots(MSXCPUInterface& cpuInterface, Debugger& debugger);
45 void drawStack(const CPURegs& regs, const MSXCPUInterface& cpuInterface, EmuTime::param time);
46 void drawRegisters(CPURegs& regs);
47 void drawFlags(CPURegs& regs);
48
49 void checkShortcuts(MSXCPUInterface& cpuInterface, MSXMotherBoard& motherBoard);
50 void actionBreakContinue(MSXCPUInterface& cpuInterface);
51 void actionStepIn(MSXCPUInterface& cpuInterface);
52 void actionStepOver();
53 void actionStepOut();
54 void actionStepBack();
55 void actionToggleBp(MSXMotherBoard& motherBoard);
56
57private:
58 SymbolManager& symbolManager;
59 size_t cycleLabelsCounter = 0;
60
61 std::vector<std::unique_ptr<DebuggableEditor>> hexEditors; // sorted on 'getDebuggableName()'
62
63 std::string gotoAddr;
64 std::string runToAddr;
65 std::optional<unsigned> gotoTarget;
66 std::optional<float> setDisassemblyScrollY;
67 bool followPC = false;
68
69 bool showControl = false;
70 bool showDisassembly = false;
71 bool showSlots = false;
72 bool showStack = false;
73 bool showRegisters = false;
74 bool showFlags = false;
75 bool showXYFlags = false;
76 int flagsLayout = 1;
77
78 bool syncDisassemblyWithPC = false;
79 float disassemblyScrollY = 0.0f;
80
81 static constexpr auto persistentElements = std::tuple{
82 PersistentElement{"showControl", &ImGuiDebugger::showControl},
83 PersistentElement{"showDisassembly", &ImGuiDebugger::showDisassembly},
84 PersistentElement{"followPC", &ImGuiDebugger::followPC},
85 PersistentElement{"showRegisters", &ImGuiDebugger::showRegisters},
86 PersistentElement{"showSlots", &ImGuiDebugger::showSlots},
87 PersistentElement{"showStack", &ImGuiDebugger::showStack},
88 PersistentElement{"showFlags", &ImGuiDebugger::showFlags},
89 PersistentElement{"showXYFlags", &ImGuiDebugger::showXYFlags},
90 PersistentElement{"disassemblyY", &ImGuiDebugger::disassemblyScrollY},
91 PersistentElementMax{"flagsLayout", &ImGuiDebugger::flagsLayout, 2}
92 // manually handle "showDebuggable.xxx"
93 };
94};
95
96} // namespace openmsx
97
98#endif
void loadEnd() override
void loadStart() override
void showMenu(MSXMotherBoard *motherBoard) override
void loadLine(std::string_view name, zstring_view value) override
void setGotoTarget(uint16_t target)
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 >