Present register width as opposed to register byte size in new register access GDB monitor commands

This commit is contained in:
Nav
2024-10-20 00:23:00 +01:00
parent a65be393be
commit 4e28d3c488
3 changed files with 5 additions and 5 deletions

View File

@@ -122,7 +122,7 @@ namespace DebugServer::Gdb::CommandPackets
"0x" + StringService::asciiToUpper(StringService::toHex(registerDescriptor.startAddress)), "0x" + StringService::asciiToUpper(StringService::toHex(registerDescriptor.startAddress)),
StringService::TerminalColor::BLUE StringService::TerminalColor::BLUE
) + ", "; ) + ", ";
output += std::to_string(registerDescriptor.size) + " byte(s)"; output += std::to_string(registerDescriptor.size * 8) + "-bit";
if (registerDescriptor.description.has_value()) { if (registerDescriptor.description.has_value()) {
output += ", \"" + *(registerDescriptor.description) + "\""; output += ", \"" + *(registerDescriptor.description) + "\"";

View File

@@ -115,7 +115,7 @@ namespace DebugServer::Gdb::CommandPackets
"0x" + StringService::asciiToUpper(StringService::toHex(registerDescriptor.startAddress)), "0x" + StringService::asciiToUpper(StringService::toHex(registerDescriptor.startAddress)),
StringService::TerminalColor::BLUE StringService::TerminalColor::BLUE
) + "\n"; ) + "\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"; output += "----------- Value -----------\n";
@@ -183,7 +183,7 @@ namespace DebugServer::Gdb::CommandPackets
"0x" + StringService::asciiToUpper(StringService::toHex(registerDescriptor.startAddress)), "0x" + StringService::asciiToUpper(StringService::toHex(registerDescriptor.startAddress)),
StringService::TerminalColor::BLUE StringService::TerminalColor::BLUE
) + ", "; ) + ", ";
output += std::to_string(registerDescriptor.size) + " byte(s) | "; output += std::to_string(registerDescriptor.size * 8) + "-bit | ";
if (registerDescriptor.access.readable) { if (registerDescriptor.access.readable) {
const auto value = IntegerService::toUint64( const auto value = IntegerService::toUint64(

View File

@@ -105,7 +105,7 @@ namespace DebugServer::Gdb::CommandPackets
if (value > static_cast<std::uint64_t>(std::pow(2, (registerDescriptor.size * 8)))) { if (value > static_cast<std::uint64_t>(std::pow(2, (registerDescriptor.size * 8)))) {
throw Exception{ throw Exception{
"The given value (0x" + StringService::toHex(value) + ") exceeds the size of the register (" "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( "Writing value " + StringService::applyTerminalColor(
"0x" + StringService::toHex(value).substr(16 - (registerDescriptor.size * 2)), "0x" + StringService::toHex(value).substr(16 - (registerDescriptor.size * 2)),
StringService::TerminalColor::DARK_YELLOW 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( + " register, at address " + StringService::applyTerminalColor(
"0x" + StringService::toHex(registerDescriptor.startAddress), "0x" + StringService::toHex(registerDescriptor.startAddress),
StringService::TerminalColor::BLUE StringService::TerminalColor::BLUE