Added "monitor version" command, to display the current Bloom version
This commit is contained in:
@@ -19,6 +19,7 @@ target_sources(
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/Gdb/CommandPackets/RemoveBreakpoint.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Gdb/CommandPackets/RemoveBreakpoint.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Gdb/CommandPackets/Monitor.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Gdb/CommandPackets/Monitor.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Gdb/CommandPackets/ResetTarget.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Gdb/CommandPackets/ResetTarget.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/Gdb/CommandPackets/BloomVersion.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Gdb/ResponsePackets/SupportedFeaturesResponse.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Gdb/ResponsePackets/SupportedFeaturesResponse.cpp
|
||||||
|
|
||||||
# AVR GDB RSP Server
|
# AVR GDB RSP Server
|
||||||
|
|||||||
37
src/DebugServer/Gdb/CommandPackets/BloomVersion.cpp
Normal file
37
src/DebugServer/Gdb/CommandPackets/BloomVersion.cpp
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#include "BloomVersion.hpp"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
|
||||||
|
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
|
||||||
|
|
||||||
|
#include "src/Application.hpp"
|
||||||
|
#include "src/Helpers/Paths.hpp"
|
||||||
|
#include "src/Logger/Logger.hpp"
|
||||||
|
#include "src/Exceptions/Exception.hpp"
|
||||||
|
|
||||||
|
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||||
|
{
|
||||||
|
using TargetController::TargetControllerConsole;
|
||||||
|
|
||||||
|
using ResponsePackets::ErrorResponsePacket;
|
||||||
|
using ResponsePackets::ResponsePacket;
|
||||||
|
|
||||||
|
using Exceptions::Exception;
|
||||||
|
|
||||||
|
BloomVersion::BloomVersion(Monitor&& monitorPacket)
|
||||||
|
: Monitor(std::move(monitorPacket))
|
||||||
|
{}
|
||||||
|
|
||||||
|
void BloomVersion::handle(DebugSession& debugSession, TargetControllerConsole&) {
|
||||||
|
Logger::debug("Handling BloomVersion packet");
|
||||||
|
|
||||||
|
debugSession.connection.writePacket(ResponsePacket(Packet::toHex(
|
||||||
|
std::string(
|
||||||
|
"Bloom v" + Application::VERSION.toString() + "\n"
|
||||||
|
+ Paths::homeDomainName() + "\n"
|
||||||
|
+ "Nav Mohammed\n"
|
||||||
|
)
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
}
|
||||||
24
src/DebugServer/Gdb/CommandPackets/BloomVersion.hpp
Normal file
24
src/DebugServer/Gdb/CommandPackets/BloomVersion.hpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "Monitor.hpp"
|
||||||
|
|
||||||
|
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The BloomVersion class implements a structure for the "monitor version" GDB command.
|
||||||
|
*
|
||||||
|
* We just output Bloom's current version number.
|
||||||
|
*/
|
||||||
|
class BloomVersion: public Monitor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit BloomVersion(Monitor&& monitorPacket);
|
||||||
|
|
||||||
|
void handle(
|
||||||
|
DebugSession& debugSession,
|
||||||
|
TargetController::TargetControllerConsole& targetControllerConsole
|
||||||
|
) override;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "CommandPackets/RemoveBreakpoint.hpp"
|
#include "CommandPackets/RemoveBreakpoint.hpp"
|
||||||
#include "CommandPackets/Monitor.hpp"
|
#include "CommandPackets/Monitor.hpp"
|
||||||
#include "CommandPackets/ResetTarget.hpp"
|
#include "CommandPackets/ResetTarget.hpp"
|
||||||
|
#include "CommandPackets/BloomVersion.hpp"
|
||||||
|
|
||||||
// Response packets
|
// Response packets
|
||||||
#include "ResponsePackets/TargetStopped.hpp"
|
#include "ResponsePackets/TargetStopped.hpp"
|
||||||
@@ -294,6 +295,9 @@ namespace Bloom::DebugServer::Gdb
|
|||||||
// This is a monitor packet
|
// This is a monitor packet
|
||||||
auto monitorCommand = std::make_unique<CommandPackets::Monitor>(rawPacket);
|
auto monitorCommand = std::make_unique<CommandPackets::Monitor>(rawPacket);
|
||||||
|
|
||||||
|
if (monitorCommand->command == "version") {
|
||||||
|
return std::make_unique<CommandPackets::BloomVersion>(std::move(*(monitorCommand.get())));
|
||||||
|
}
|
||||||
if (monitorCommand->command == "reset") {
|
if (monitorCommand->command == "reset") {
|
||||||
return std::make_unique<CommandPackets::ResetTarget>(std::move(*(monitorCommand.get())));
|
return std::make_unique<CommandPackets::ResetTarget>(std::move(*(monitorCommand.get())));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user