Files
BloomPatched/src/DebugServer/Gdb/CommandPackets/Detach.cpp
Nav 6cdbfbe950 Massive refactor to accommodate RISC-V targets
- Refactored entire codebase (excluding the Insight component) to accommodate multiple target architectures (no longer specific to AVR)
- Deleted 'generate SVD' GDB monitor command - I will eventually move this functionality to the Bloom website
- Added unit size property to address spaces
- Many other changes which I couldn't be bothered to describe here
2024-07-23 21:14:22 +01:00

44 lines
1.2 KiB
C++

#include "Detach.hpp"
#include "src/DebugServer/Gdb/ResponsePackets/OkResponsePacket.hpp"
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
#include "src/Services/ProcessService.hpp"
#include "src/Logger/Logger.hpp"
namespace DebugServer::Gdb::CommandPackets
{
using Services::TargetControllerService;
using ResponsePackets::OkResponsePacket;
using ResponsePackets::ErrorResponsePacket;
using ::Exceptions::Exception;
Detach::Detach(const RawPacket& rawPacket)
: CommandPacket(rawPacket)
{}
void Detach::handle(
DebugSession& debugSession,
const TargetDescriptor&,
const Targets::TargetDescriptor&,
TargetControllerService& targetControllerService
) {
Logger::info("Handling Detach packet");
try {
if (Services::ProcessService::isManagedByClion()) {
targetControllerService.shutdown();
}
debugSession.connection.writePacket(OkResponsePacket{});
} catch (const Exception& exception) {
Logger::error("Failed to shut down TargetController - " + exception.getMessage());
debugSession.connection.writePacket(ErrorResponsePacket{});
}
}
}