From 4e28d3c488b1863f4e0763a7bbc541bd5b6cd69c Mon Sep 17 00:00:00 2001 From: Nav Date: Sun, 20 Oct 2024 00:23:00 +0100 Subject: [PATCH] Present register width as opposed to register byte size in new register access GDB monitor commands --- src/DebugServer/Gdb/CommandPackets/ListRegistersMonitor.cpp | 2 +- src/DebugServer/Gdb/CommandPackets/ReadRegistersMonitor.cpp | 4 ++-- src/DebugServer/Gdb/CommandPackets/WriteRegisterMonitor.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/DebugServer/Gdb/CommandPackets/ListRegistersMonitor.cpp b/src/DebugServer/Gdb/CommandPackets/ListRegistersMonitor.cpp index cab8e439..2c77dd56 100644 --- a/src/DebugServer/Gdb/CommandPackets/ListRegistersMonitor.cpp +++ b/src/DebugServer/Gdb/CommandPackets/ListRegistersMonitor.cpp @@ -122,7 +122,7 @@ namespace DebugServer::Gdb::CommandPackets "0x" + StringService::asciiToUpper(StringService::toHex(registerDescriptor.startAddress)), StringService::TerminalColor::BLUE ) + ", "; - output += std::to_string(registerDescriptor.size) + " byte(s)"; + output += std::to_string(registerDescriptor.size * 8) + "-bit"; if (registerDescriptor.description.has_value()) { output += ", \"" + *(registerDescriptor.description) + "\""; diff --git a/src/DebugServer/Gdb/CommandPackets/ReadRegistersMonitor.cpp b/src/DebugServer/Gdb/CommandPackets/ReadRegistersMonitor.cpp index e0472a9c..ff5ca429 100644 --- a/src/DebugServer/Gdb/CommandPackets/ReadRegistersMonitor.cpp +++ b/src/DebugServer/Gdb/CommandPackets/ReadRegistersMonitor.cpp @@ -115,7 +115,7 @@ namespace DebugServer::Gdb::CommandPackets "0x" + StringService::asciiToUpper(StringService::toHex(registerDescriptor.startAddress)), StringService::TerminalColor::BLUE ) + "\n"; - output += "Size: " + std::to_string(registerDescriptor.size) + " byte(s)\n\n"; + output += "Width: " + std::to_string(registerDescriptor.size * 8) + "-bit\n\n"; output += "----------- Value -----------\n"; @@ -183,7 +183,7 @@ namespace DebugServer::Gdb::CommandPackets "0x" + StringService::asciiToUpper(StringService::toHex(registerDescriptor.startAddress)), StringService::TerminalColor::BLUE ) + ", "; - output += std::to_string(registerDescriptor.size) + " byte(s) | "; + output += std::to_string(registerDescriptor.size * 8) + "-bit | "; if (registerDescriptor.access.readable) { const auto value = IntegerService::toUint64( diff --git a/src/DebugServer/Gdb/CommandPackets/WriteRegisterMonitor.cpp b/src/DebugServer/Gdb/CommandPackets/WriteRegisterMonitor.cpp index 41fda760..ba451cbd 100644 --- a/src/DebugServer/Gdb/CommandPackets/WriteRegisterMonitor.cpp +++ b/src/DebugServer/Gdb/CommandPackets/WriteRegisterMonitor.cpp @@ -105,7 +105,7 @@ namespace DebugServer::Gdb::CommandPackets if (value > static_cast(std::pow(2, (registerDescriptor.size * 8)))) { throw Exception{ "The given value (0x" + StringService::toHex(value) + ") exceeds the size of the register (" - + std::to_string(registerDescriptor.size) + " byte(s))" + + std::to_string(registerDescriptor.size * 8) + "-bit)" }; } @@ -120,7 +120,7 @@ namespace DebugServer::Gdb::CommandPackets "Writing value " + StringService::applyTerminalColor( "0x" + StringService::toHex(value).substr(16 - (registerDescriptor.size * 2)), StringService::TerminalColor::DARK_YELLOW - ) + " (" + std::to_string(buffer.size()) + " byte(s)" + ") to " + registerDescriptor.name + ) + " (" + std::to_string(buffer.size() * 8) + "-bit" + ") to " + registerDescriptor.name + " register, at address " + StringService::applyTerminalColor( "0x" + StringService::toHex(registerDescriptor.startAddress), StringService::TerminalColor::BLUE