| e8555c89 Andy McCall |
1 |
#ifndef IMGUI_BREAKPOINT_HH |
| 2 |
#define IMGUI_BREAKPOINT_HH |
| 3 |
|
| 4 |
#include "ImGuiPart.hh" |
| 5 |
|
| 6 |
#include "TclObject.hh" |
| 7 |
#include "TemporaryString.hh" |
| 8 |
|
| 9 |
#include <cstdint> |
| 10 |
#include <optional> |
| 11 |
#include <string> |
| 12 |
#include <string_view> |
| 13 |
|
| 14 |
namespace openmsx { |
| 15 |
|
| 16 |
class BreakPoint; |
| 17 |
class DebugCondition; |
| 18 |
class Debugger; |
| 19 |
class MSXCPUInterface; |
| 20 |
class SymbolManager; |
| 21 |
class WatchPoint; |
| 22 |
|
| 23 |
struct ParsedSlotCond { |
| 24 |
ParsedSlotCond(std::string_view checkCmd, std::string_view cond); |
| 25 |
[[nodiscard]] TemporaryString toTclExpression(std::string_view checkCmd) const; |
| 26 |
[[nodiscard]] TemporaryString toDisplayString() const; |
| 27 |
|
| 28 |
std::string rest; |
| 29 |
|
| 30 |
int ps = 0; |
| 31 |
int ss = 0; |
| 32 |
uint8_t seg = 0; |
| 33 |
bool hasPs = false; |
| 34 |
bool hasSs = false; |
| 35 |
bool hasSeg = false; |
| 36 |
}; |
| 37 |
|
| 38 |
class ImGuiBreakPoints final : public ImGuiPart |
| 39 |
{ |
| 40 |
public: |
| 41 |
explicit ImGuiBreakPoints(ImGuiManager& manager); |
| 42 |
|
| 43 |
[[nodiscard]] zstring_view iniName() const override { return "breakpoints"; } |
| 44 |
void save(ImGuiTextBuffer& buf) override; |
| 45 |
void loadLine(std::string_view name, zstring_view value) override; |
| 46 |
void paint(MSXMotherBoard* motherBoard) override; |
| 47 |
|
| 48 |
void refreshSymbols(); |
| 49 |
|
| 50 |
void paintBpTab(MSXCPUInterface& cpuInterface, uint16_t addr); |
| 51 |
|
| 52 |
private: |
| 53 |
template<typename Type> void paintTab(MSXCPUInterface& cpuInterface, std::optional<uint16_t> addr = {}); |
| 54 |
template<typename Item> void drawRow(MSXCPUInterface& cpuInterface, int row, Item& item); |
| 55 |
[[nodiscard]] std::string displayAddr(const TclObject& addr) const; |
| 56 |
[[nodiscard]] std::string parseDisplayAddress(std::string_view str) const; |
| 57 |
void editRange(MSXCPUInterface& cpuInterface, std::shared_ptr<WatchPoint>& wp, std::string& begin, std::string& end); |
| 58 |
bool editCondition(ParsedSlotCond& slot); |
| 59 |
|
| 60 |
public: |
| 61 |
bool show = false; |
| 62 |
|
| 63 |
private: |
| 64 |
SymbolManager& symbolManager; |
| 65 |
|
| 66 |
int selectedRow = -1; |
| 67 |
|
| 68 |
static constexpr auto persistentElements = std::tuple{ |
| 69 |
PersistentElement{"show", &ImGuiBreakPoints::show} |
| 70 |
}; |
| 71 |
}; |
| 72 |
|
| 73 |
} |
| 74 |
|
| 75 |
#endif |