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