From 3b71c5fee4255098396d5114c93d27d06c8bd597 Mon Sep 17 00:00:00 2001 From: ValKmjolnir Date: Sat, 1 Jun 2024 00:41:05 +0800 Subject: [PATCH] :memo: change output info width from 6 -> 8 --- src/nasal_opcode.cpp | 2 +- src/nasal_vm.cpp | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/nasal_opcode.cpp b/src/nasal_opcode.cpp index d4ecd6c..80a3439 100644 --- a/src/nasal_opcode.cpp +++ b/src/nasal_opcode.cpp @@ -48,7 +48,7 @@ void codestream::dump(std::ostream& out) const { // dump operand index and bytecode(hex format) out << hex << "0x" - << setw(6) << setfill('0') << index << " " + << setw(8) << setfill('0') << index << " " << setw(2) << setfill('0') << static_cast(op) << ":" << dec; // dump immediate number(hex format) diff --git a/src/nasal_vm.cpp b/src/nasal_vm.cpp index 14e80ac..f5d205a 100644 --- a/src/nasal_vm.cpp +++ b/src/nasal_vm.cpp @@ -191,7 +191,7 @@ void vm::trace_back() { } if (same) { std::clog << " 0x" << std::hex - << std::setw(6) << std::setfill('0') + << std::setw(8) << std::setfill('0') << prev << std::dec << " " << same << " same call(s)\n"; same = 0; @@ -212,7 +212,7 @@ void vm::stack_info(const u64 limit = 16) { for(u32 i = 0; i=bottom; ++i, --top) { std::clog << " 0x" << std::hex - << std::setw(6) << std::setfill('0') + << std::setw(8) << std::setfill('0') << static_cast(top-bottom) << std::dec << " "; value_info(top[0]); @@ -220,22 +220,22 @@ void vm::stack_info(const u64 limit = 16) { } void vm::register_info() { - std::clog << "\nregisters (" << (ngc.cort? "coroutine":"main") - << ")\n" << std::hex - << " [pc ] | pc | 0x" << ctx.pc << "\n" - << " [global] | addr | 0x" + std::clog << "\nregisters (" << (ngc.cort? "coroutine":"main") << ")\n"; + std::clog << std::hex + << " [ pc ] | pc | 0x" << ctx.pc << "\n" + << " [ global ] | addr | 0x" << reinterpret_cast(global) << "\n" - << " [local ] | addr | 0x" + << " [ local ] | addr | 0x" << reinterpret_cast(ctx.localr) << "\n" - << " [memr ] | addr | 0x" + << " [ memr ] | addr | 0x" << reinterpret_cast(ctx.memr) << "\n" - << " [canary] | addr | 0x" + << " [ canary ] | addr | 0x" << reinterpret_cast(ctx.canary) << "\n" - << " [top ] | addr | 0x" + << " [ top ] | addr | 0x" << reinterpret_cast(ctx.top) << "\n" << std::dec; - std::clog << " [funcr ] "; value_info(ctx.funcr); - std::clog << " [upval ] "; value_info(ctx.upvalr); + std::clog << " [ funcr ] "; value_info(ctx.funcr); + std::clog << " [ upval ] "; value_info(ctx.upvalr); } void vm::global_state() { @@ -245,7 +245,7 @@ void vm::global_state() { std::clog << "\nglobal (0x" << std::hex << reinterpret_cast(global) << ")\n" << std::dec; for(usize i = 0; i(ctx.localr-ctx.stack) << ">)\n" << std::dec; for(u32 i = 0; i upval[" << i << "]:\n"; auto& uv = upval[i].upval(); for(u32 j = 0; j