Formatting keys in log output

This commit is contained in:
Nav
2025-02-02 14:54:17 +00:00
parent f3cd55e53f
commit b06e8cc9ad
17 changed files with 140 additions and 151 deletions

View File

@@ -48,7 +48,7 @@ namespace DebugServer::Gdb::CommandPackets
const auto peripheralDescriptorOpt = targetDescriptor.tryGetPeripheralDescriptor(peripheralKey);
if (!peripheralDescriptorOpt.has_value()) {
throw Exception{"Unknown peripheral key \"" + peripheralKey + "\""};
throw Exception{"Unknown peripheral key `" + peripheralKey + "`"};
}
const auto& peripheralDescriptor = peripheralDescriptorOpt->get();
@@ -62,7 +62,7 @@ namespace DebugServer::Gdb::CommandPackets
const auto& registerGroupKey = this->commandArguments[2];
registerGroupDescriptorOpt = peripheralDescriptor.tryGetRegisterGroupDescriptor(registerGroupKey);
if (!registerGroupDescriptorOpt.has_value()) {
throw Exception{"Unknown absolute register group key \"" + registerGroupKey + "\""};
throw Exception{"Unknown absolute register group key `" + registerGroupKey + "`"};
}
} else {
@@ -82,7 +82,7 @@ namespace DebugServer::Gdb::CommandPackets
const auto& registerKey = registerGroupKeyProvided ? this->commandArguments[3] : this->commandArguments[2];
const auto registerDescriptorOpt = registerGroupDescriptor.tryGetRegisterDescriptor(registerKey);
if (!registerDescriptorOpt.has_value()) {
throw Exception{"Unknown register key \"" + registerKey + "\""};
throw Exception{"Unknown register key `" + registerKey + "`"};
}
const auto& registerDescriptor = registerDescriptorOpt->get();
@@ -121,10 +121,8 @@ namespace DebugServer::Gdb::CommandPackets
"0x" + StringService::toHex(value).substr(16 - (registerDescriptor.size * 2)),
StringService::TerminalColor::DARK_YELLOW
) + " (" + std::to_string(buffer.size() * 8) + "-bit" + ") to \"" + registerDescriptor.name
+ "\" register, at address " + StringService::applyTerminalColor(
"0x" + StringService::toHex(registerDescriptor.startAddress),
StringService::TerminalColor::BLUE
) + ", via `" + registerDescriptor.addressSpaceKey + "` address space...\n"
+ "\" register, at address 0x" + StringService::toHex(registerDescriptor.startAddress) + ", via "
+ StringService::formatKey(registerDescriptor.addressSpaceKey) + " address space...\n"
)});
targetControllerService.writeRegister(registerDescriptor, buffer);