This commit is contained in:
Nav
2024-12-15 17:34:11 +00:00
parent 40859201e4
commit 6873b2f53a
4 changed files with 16 additions and 9 deletions

View File

@@ -27,6 +27,8 @@ namespace DebugServer::Gdb::CommandPackets
const Targets::TargetDescriptor&,
TargetControllerService& targetControllerService
) {
using Services::StringService;
Logger::info("Handling ResetTarget packet");
try {
@@ -36,7 +38,12 @@ namespace DebugServer::Gdb::CommandPackets
debugSession.connection.writePacket(ResponsePacket{Services::StringService::toHex(
"Target reset complete\n"
"Current PC: 0x" + Services::StringService::toHex(targetControllerService.getProgramCounter()) + "\n"
"Current PC: " + StringService::applyTerminalColor(
"0x" + StringService::asciiToUpper(
StringService::toHex(targetControllerService.getProgramCounter())
),
StringService::TerminalColor::BLUE
) + "\n"
"Use the 'continue' command to begin execution\n"
)});

View File

@@ -57,7 +57,7 @@ namespace DebugToolDrivers::Wch
this->targetConfig
}
)
, programSegmentDescriptor(
, mainProgramSegmentDescriptor(
this->targetDescriptionFile.getSystemAddressSpaceDescriptor().getMemorySegmentDescriptor("main_program")
)
, flashProgramOpcodes(
@@ -80,7 +80,7 @@ namespace DebugToolDrivers::Wch
auto response = this->wchLinkInterface.sendCommandAndWaitForResponse(Commands::Control::AttachTarget{});
if (response.payload.size() != 5) {
throw Exceptions::DeviceCommunicationFailure{"Unexpected response payload size for AttachTarget command"};
throw DeviceCommunicationFailure{"Unexpected response payload size for AttachTarget command"};
}
this->cachedTargetId = response.payload[0];
@@ -112,7 +112,7 @@ namespace DebugToolDrivers::Wch
response = this->wchLinkInterface.sendCommandAndWaitForResponse(Commands::Control::AttachTarget{});
if (response.payload.size() != 5) {
throw Exceptions::DeviceCommunicationFailure{
throw DeviceCommunicationFailure{
"Unexpected response payload size for subsequent AttachTarget command"
};
}
@@ -132,7 +132,7 @@ namespace DebugToolDrivers::Wch
const auto response = this->wchLinkInterface.sendCommandAndWaitForResponse(Commands::Control::DetachTarget{});
if (response.payload.size() != 1) {
throw Exceptions::DeviceCommunicationFailure{"Unexpected response payload size for DetachTarget command"};
throw DeviceCommunicationFailure{"Unexpected response payload size for DetachTarget command"};
}
}
@@ -272,7 +272,7 @@ namespace DebugToolDrivers::Wch
const auto commandError = this->riscVTranslator.readAndClearAbstractCommandError();
if (commandError != DebugModule::AbstractCommandError::NONE) {
throw Exceptions::Exception{
throw Exception{
"Partial block write failed - abstract command error: 0x"
+ Services::StringService::toHex(commandError)
};
@@ -359,7 +359,7 @@ namespace DebugToolDrivers::Wch
const TargetAddressSpaceDescriptor& addressSpaceDescriptor,
const TargetMemorySegmentDescriptor& memorySegmentDescriptor
) {
if (memorySegmentDescriptor == this->programSegmentDescriptor) {
if (memorySegmentDescriptor == this->mainProgramSegmentDescriptor) {
return this->wchLinkInterface.eraseProgramMemory();
}

View File

@@ -89,7 +89,7 @@ namespace DebugToolDrivers::Wch
Protocols::WchLink::WchLinkInterface& wchLinkInterface;
DebugToolDrivers::Protocols::RiscVDebugSpec::DebugTranslator riscVTranslator;
const Targets::TargetMemorySegmentDescriptor& programSegmentDescriptor;
const Targets::TargetMemorySegmentDescriptor& mainProgramSegmentDescriptor;
/**
* The 'target activation' command returns a payload of 5 bytes.

View File

@@ -81,7 +81,7 @@ namespace TargetController
while (this->getThreadState() == ThreadState::READY) {
this->refreshExecutionState();
TargetControllerComponent::notifier.waitForNotification(std::chrono::milliseconds(60 ));
TargetControllerComponent::notifier.waitForNotification(std::chrono::milliseconds{60});
this->processQueuedCommands();
this->eventListener->dispatchCurrentEvents();