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(CPURegs& regs, MSXCPUInterface& cpuInterface, EmuTime::param time);
43 void drawRegisters(CPURegs& regs);
44 void drawFlags(CPURegs& regs);
45
46private:
47 SymbolManager& symbolManager;
48 size_t cycleLabelsCounter = 0;
49
50 std::vector<std::unique_ptr<DebuggableEditor>> hexEditors; // sorted on 'getDebuggableName()'
51
52 std::string gotoAddr;
53 std::string runToAddr;
54 std::optional<unsigned> gotoTarget;
55 bool followPC = false;
56
57 bool showControl = false;
58 bool showDisassembly = false;
59 bool showSlots = false;
60 bool showStack = false;
61 bool showRegisters = false;
62 bool showFlags = false;
63 bool showXYFlags = false;
64 int flagsLayout = 1;
65
66 bool syncDisassemblyWithPC = false;
67
68 static constexpr auto persistentElements = std::tuple{
69 PersistentElement{"showControl", &ImGuiDebugger::showControl},
70 PersistentElement{"showDisassembly", &ImGuiDebugger::showDisassembly},
71 PersistentElement{"followPC", &ImGuiDebugger::followPC},
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 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:9
PersistentElement(zstring_view, T C::*) -> PersistentElement< C, T >