openMSX
ImGuiDebugger.hh
Go to the documentation of this file.
1#ifndef IMGUI_DEBUGGER_HH
2#define IMGUI_DEBUGGER_HH
3
4#include "ImGuiPart.hh"
5
6#include "EmuTime.hh"
7
8#include <cstdint>
9#include <memory>
10#include <vector>
11
12namespace openmsx {
13
14class CPURegs;
15class DebuggableEditor;
16class Debugger;
17class ImGuiBitmapViewer;
18class ImGuiCharacter;
19class ImGuiDisassembly;
20class ImGuiSpriteViewer;
21class MSXCPUInterface;
22
23class ImGuiDebugger final : public ImGuiPart
24{
25public:
28
29 static void loadIcons();
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
38 void signalBreak();
39 void setGotoTarget(uint16_t target);
40 void checkShortcuts(MSXCPUInterface& cpuInterface, MSXMotherBoard& motherBoard);
41
42private:
43 void drawControl(MSXCPUInterface& cpuInterface, MSXMotherBoard& motherBoard);
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 actionBreakContinue(MSXCPUInterface& cpuInterface);
50 void actionStepIn(MSXCPUInterface& cpuInterface);
51 void actionStepOver();
52 void actionStepOut();
53 void actionStepBack();
54
55private:
56 std::vector<std::unique_ptr<ImGuiDisassembly>> disassemblyViewers;
57 std::vector<std::unique_ptr<ImGuiBitmapViewer>> bitmapViewers;
58 std::vector<std::unique_ptr<ImGuiCharacter>> tileViewers;
59 std::vector<std::unique_ptr<ImGuiSpriteViewer>> spriteViewers;
60 std::vector<std::unique_ptr<DebuggableEditor>> hexEditors; // sorted on 'getDebuggableName()'
61
62 bool showControl = false;
63 bool showSlots = false;
64 bool showStack = false;
65 bool showRegisters = false;
66 bool showFlags = false;
67 bool showXYFlags = false;
68 int flagsLayout = 1;
69
70 static constexpr auto persistentElements = std::tuple{
71 PersistentElement{"showControl", &ImGuiDebugger::showControl},
72 PersistentElement{"showRegisters", &ImGuiDebugger::showRegisters},
73 PersistentElement{"showSlots", &ImGuiDebugger::showSlots},
74 PersistentElement{"showStack", &ImGuiDebugger::showStack},
75 PersistentElement{"showFlags", &ImGuiDebugger::showFlags},
76 PersistentElement{"showXYFlags", &ImGuiDebugger::showXYFlags},
77 PersistentElementMax{"flagsLayout", &ImGuiDebugger::flagsLayout, 2}
78 // manually handle "showDebuggable.xxx"
79 };
80};
81
82} // namespace openmsx
83
84#endif
void loadStart() override
void showMenu(MSXMotherBoard *motherBoard) override
void checkShortcuts(MSXCPUInterface &cpuInterface, MSXMotherBoard &motherBoard)
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 >