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 ImGuiBitmapViewer;
19class ImGuiCharacter;
20class ImGuiSpriteViewer;
21class MSXCPUInterface;
22class SymbolManager;
23
24class ImGuiDebugger final : public ImGuiPart
25{
26public:
29
30 static void loadIcons();
31
32 void signalBreak();
33
34 [[nodiscard]] zstring_view iniName() const override { return "debugger"; }
35 void save(ImGuiTextBuffer& buf) override;
36 void loadStart() override;
37 void loadLine(std::string_view name, zstring_view value) override;
38 void loadEnd() override;
39 void showMenu(MSXMotherBoard* motherBoard) override;
40 void paint(MSXMotherBoard* motherBoard) override;
41 void setGotoTarget(uint16_t target);
42
43private:
44 void drawControl(MSXCPUInterface& cpuInterface, MSXMotherBoard& motherBoard);
45 void drawDisassembly(CPURegs& regs, MSXCPUInterface& cpuInterface, Debugger& debugger,
46 MSXMotherBoard& motherBoard, EmuTime::param time);
47 void drawSlots(MSXCPUInterface& cpuInterface, Debugger& debugger);
48 void drawStack(const CPURegs& regs, const MSXCPUInterface& cpuInterface, EmuTime::param time);
49 void drawRegisters(CPURegs& regs);
50 void drawFlags(CPURegs& regs);
51
52 void checkShortcuts(MSXCPUInterface& cpuInterface, MSXMotherBoard& motherBoard);
53 void actionBreakContinue(MSXCPUInterface& cpuInterface);
54 void actionStepIn(MSXCPUInterface& cpuInterface);
55 void actionStepOver();
56 void actionStepOut();
57 void actionStepBack();
58 void actionToggleBp(MSXMotherBoard& motherBoard);
59
60private:
61 SymbolManager& symbolManager;
62 size_t cycleLabelsCounter = 0;
63
64 std::vector<std::unique_ptr<ImGuiBitmapViewer>> bitmapViewers;
65 std::vector<std::unique_ptr<ImGuiCharacter>> tileViewers;
66 std::vector<std::unique_ptr<ImGuiSpriteViewer>> spriteViewers;
67 std::vector<std::unique_ptr<DebuggableEditor>> hexEditors; // sorted on 'getDebuggableName()'
68
69 std::string gotoAddr;
70 std::string runToAddr;
71 std::optional<unsigned> gotoTarget;
72 std::optional<float> setDisassemblyScrollY;
73 bool followPC = false;
74
75 bool showControl = false;
76 bool showDisassembly = false;
77 bool showSlots = false;
78 bool showStack = false;
79 bool showRegisters = false;
80 bool showFlags = false;
81 bool showXYFlags = false;
82 int flagsLayout = 1;
83
84 bool syncDisassemblyWithPC = false;
85 float disassemblyScrollY = 0.0f;
86
87 static constexpr auto persistentElements = std::tuple{
88 PersistentElement{"showControl", &ImGuiDebugger::showControl},
89 PersistentElement{"showDisassembly", &ImGuiDebugger::showDisassembly},
90 PersistentElement{"followPC", &ImGuiDebugger::followPC},
91 PersistentElement{"showRegisters", &ImGuiDebugger::showRegisters},
92 PersistentElement{"showSlots", &ImGuiDebugger::showSlots},
93 PersistentElement{"showStack", &ImGuiDebugger::showStack},
94 PersistentElement{"showFlags", &ImGuiDebugger::showFlags},
95 PersistentElement{"showXYFlags", &ImGuiDebugger::showXYFlags},
96 PersistentElement{"disassemblyY", &ImGuiDebugger::disassemblyScrollY},
97 PersistentElementMax{"flagsLayout", &ImGuiDebugger::flagsLayout, 2}
98 // manually handle "showDebuggable.xxx"
99 };
100};
101
102} // namespace openmsx
103
104#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 >