Files
dbgui/src/data.h
2023-06-03 21:58:56 +02:00

92 lines
1.3 KiB
C++

#pragma once
#include <cstddef>
#include <cstdint>
#include <variant>
#include <vector>
namespace dbgui::data
{
struct TypeInfo
{
enum class Type
{
custom,
u8,
u16,
u32,
u64,
i8,
i16,
i32,
i64,
f32,
f64,
// ptr,
// arr,
// complex,
};
Type type;
// std::variant<std::monostate, PtrInfo, ComplexInfo> add;
bool operator==(const TypeInfo &rhs) const
{
return this->type == rhs.type;
}
};
struct DataSource
{
enum class Type : uint8_t
{
reg,
// TODO: special IP/SP source? so that scope selection can apply to that?
// variable,
// const,
};
struct Reg
{
// TODO: identify through names?
uint16_t set;
uint16_t idx;
};
Type type;
std::variant<std::monostate, Reg> data;
};
struct Disassemble
{
// Node that provides the address to disassemble
// type must be integer
size_t src_id;
};
struct DataNode
{
enum class Type : uint8_t
{
data_source,
disassemble,
};
size_t id;
Type type;
std::variant<DataSource, Disassemble> data;
};
// TODO: this should allow only updating part of arrays
// and moving in it
struct DataResult
{
// TODO: needs indicator that data was failed to be retrieved
size_t id;
bool success;
TypeInfo type;
std::vector<uint8_t> data;
};
} // namespace dbgui::data