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