fix(furdb): improve printing
This commit is contained in:
@@ -116,11 +116,11 @@ static void print_thing(const furvm::thing<>& thing) {
|
|||||||
print_type(thing.type());
|
print_type(thing.type());
|
||||||
std::cout << ") ";
|
std::cout << ") ";
|
||||||
switch (thing.type().type) {
|
switch (thing.type().type) {
|
||||||
case furvm::thing_type::S8: std::cout << thing.get<furvm::thing_type::s8>(); break;
|
case furvm::thing_type::S8: std::cout << std::to_string(thing.get<furvm::thing_type::s8>()); break;
|
||||||
case furvm::thing_type::S16: std::cout << thing.get<furvm::thing_type::s16>(); break;
|
case furvm::thing_type::S16: std::cout << thing.get<furvm::thing_type::s16>(); break;
|
||||||
case furvm::thing_type::S32: std::cout << thing.get<furvm::thing_type::s32>(); break;
|
case furvm::thing_type::S32: std::cout << thing.get<furvm::thing_type::s32>(); break;
|
||||||
case furvm::thing_type::S64: std::cout << thing.get<furvm::thing_type::s64>(); break;
|
case furvm::thing_type::S64: std::cout << thing.get<furvm::thing_type::s64>(); break;
|
||||||
case furvm::thing_type::U8: std::cout << thing.get<furvm::thing_type::u8>(); break;
|
case furvm::thing_type::U8: std::cout << std::to_string(thing.get<furvm::thing_type::u8>()); break;
|
||||||
case furvm::thing_type::U16: std::cout << thing.get<furvm::thing_type::u16>(); break;
|
case furvm::thing_type::U16: std::cout << thing.get<furvm::thing_type::u16>(); break;
|
||||||
case furvm::thing_type::U32: std::cout << thing.get<furvm::thing_type::u32>(); break;
|
case furvm::thing_type::U32: std::cout << thing.get<furvm::thing_type::u32>(); break;
|
||||||
case furvm::thing_type::U64: std::cout << thing.get<furvm::thing_type::u64>(); break;
|
case furvm::thing_type::U64: std::cout << thing.get<furvm::thing_type::u64>(); break;
|
||||||
@@ -137,7 +137,6 @@ static void print_thing(const furvm::thing<>& thing) {
|
|||||||
case furvm::thing_type::Ref:
|
case furvm::thing_type::Ref:
|
||||||
case furvm::thing_type::Count: break;
|
case furvm::thing_type::Count: break;
|
||||||
}
|
}
|
||||||
std::cout << '\n';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void breakpoint_hit(furvm::executor& executor, void* data) {
|
static void breakpoint_hit(furvm::executor& executor, void* data) {
|
||||||
@@ -184,6 +183,7 @@ void info_command::execute(context& ctx, const command_info& info) {
|
|||||||
// TODO: Add debug information to modules
|
// TODO: Add debug information to modules
|
||||||
std::cout << "- %" << i << " = ";
|
std::cout << "- %" << i << " = ";
|
||||||
print_thing(frame.variables[i]);
|
print_thing(frame.variables[i]);
|
||||||
|
std::cout << '\n';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Unexpected argument \"" << info.args[0] << "\"\n";
|
std::cerr << "Unexpected argument \"" << info.args[0] << "\"\n";
|
||||||
|
|||||||
@@ -115,12 +115,12 @@ void context::print_instruction() const {
|
|||||||
if (instr.arg.type != furvm::instruction_argument_t::None) {
|
if (instr.arg.type != furvm::instruction_argument_t::None) {
|
||||||
std::cout << ' ';
|
std::cout << ' ';
|
||||||
switch (instr.arg.type) {
|
switch (instr.arg.type) {
|
||||||
case furvm::instruction_argument::S8:
|
case furvm::instruction_argument::S8: std::cout << std::to_string(instr.arg.s8); break;
|
||||||
case furvm::instruction_argument::U8:
|
case furvm::instruction_argument::U8: std::cout << std::to_string(instr.arg.u8); break;
|
||||||
case furvm::instruction_argument::S16:
|
case furvm::instruction_argument::S16: std::cout << instr.arg.s16; break;
|
||||||
case furvm::instruction_argument::U16:
|
case furvm::instruction_argument::U16: std::cout << instr.arg.u16; break;
|
||||||
case furvm::instruction_argument::S32:
|
case furvm::instruction_argument::S32: std::cout << instr.arg.s32; break;
|
||||||
case furvm::instruction_argument::U32:
|
case furvm::instruction_argument::U32: std::cout << instr.arg.u32; break;
|
||||||
case furvm::instruction_argument::None:
|
case furvm::instruction_argument::None:
|
||||||
case furvm::instruction_argument::Count: break;
|
case furvm::instruction_argument::Count: break;
|
||||||
case furvm::instruction_argument::Constant: throw std::runtime_error("unimplemented");
|
case furvm::instruction_argument::Constant: throw std::runtime_error("unimplemented");
|
||||||
@@ -128,7 +128,7 @@ void context::print_instruction() const {
|
|||||||
case furvm::instruction_argument::Variable: std::cout << "%" << instr.arg.u16; break;
|
case furvm::instruction_argument::Variable: std::cout << "%" << instr.arg.u16; break;
|
||||||
case furvm::instruction_argument::GlobalVariable: std::cout << "%__g" << instr.arg.u16; break;
|
case furvm::instruction_argument::GlobalVariable: std::cout << "%__g" << instr.arg.u16; break;
|
||||||
case furvm::instruction_argument::Function: std::cout << "<a function>"; break;
|
case furvm::instruction_argument::Function: std::cout << "<a function>"; break;
|
||||||
case furvm::instruction_argument::Offset: std::cout << instr.arg.s8; break;
|
case furvm::instruction_argument::Offset: std::cout << std::to_string(instr.arg.s8); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::cout << '\n';
|
std::cout << '\n';
|
||||||
|
|||||||
Reference in New Issue
Block a user