2022-03-24 19:06:09 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
|
|
#include "TargetDescriptor.hpp"
|
2023-09-10 22:27:10 +01:00
|
|
|
#include "DebugSession.hpp"
|
2022-03-24 19:06:09 +00:00
|
|
|
|
2022-03-31 21:52:46 +01:00
|
|
|
#include "src/DebugServer/Gdb/GdbRspDebugServer.hpp"
|
2022-03-24 19:06:09 +00:00
|
|
|
|
2023-08-13 15:47:51 +01:00
|
|
|
namespace DebugServer::Gdb::AvrGdb
|
2022-03-24 19:06:09 +00:00
|
|
|
{
|
|
|
|
|
class AvrGdbRsp: public GdbRspDebugServer
|
|
|
|
|
{
|
|
|
|
|
public:
|
2022-03-27 18:32:13 +01:00
|
|
|
AvrGdbRsp(
|
|
|
|
|
const DebugServerConfig& debugServerConfig,
|
2023-11-22 00:37:29 +00:00
|
|
|
const Targets::TargetDescriptor& targetDescriptor,
|
2022-04-15 22:05:50 +01:00
|
|
|
EventListener& eventListener,
|
|
|
|
|
EventFdNotifier& eventNotifier
|
2022-03-27 18:32:13 +01:00
|
|
|
);
|
2022-03-24 19:06:09 +00:00
|
|
|
|
|
|
|
|
std::string getName() const override {
|
|
|
|
|
return "AVR GDB Remote Serial Protocol Debug Server";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected:
|
2023-09-10 22:27:10 +01:00
|
|
|
DebugSession* startDebugSession(Connection&& connection) override;
|
2022-03-24 19:06:09 +00:00
|
|
|
|
2023-09-10 22:27:10 +01:00
|
|
|
void endDebugSession() override;
|
|
|
|
|
|
|
|
|
|
const Gdb::TargetDescriptor& getGdbTargetDescriptor() override;
|
|
|
|
|
|
|
|
|
|
DebugSession* getActiveDebugSession() override;
|
2022-03-24 19:06:09 +00:00
|
|
|
|
2022-03-27 19:44:02 +01:00
|
|
|
std::unique_ptr<Gdb::CommandPackets::CommandPacket> resolveCommandPacket(
|
2022-10-01 21:01:37 +01:00
|
|
|
const RawPacket& rawPacket
|
2022-03-27 19:44:02 +01:00
|
|
|
) override;
|
|
|
|
|
|
2023-09-10 22:27:10 +01:00
|
|
|
/**
|
|
|
|
|
* Should return a set of GDB features supported by the AVR GDB server. Each supported feature may come with an
|
|
|
|
|
* optional value.
|
|
|
|
|
*
|
|
|
|
|
* The set of features returned by this function will be stored against the active debug session object.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
std::set<std::pair<Feature, std::optional<std::string>>> getSupportedFeatures();
|
|
|
|
|
|
2023-09-21 00:40:30 +01:00
|
|
|
void handleTargetStoppedGdbResponse(Targets::TargetMemoryAddress programAddress) override;
|
2022-05-14 22:43:08 +01:00
|
|
|
|
2022-03-24 19:06:09 +00:00
|
|
|
private:
|
2023-09-10 22:27:10 +01:00
|
|
|
TargetDescriptor gdbTargetDescriptor;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* When a connection with a GDB client is established, a new instance of the DebugSession class is created and
|
|
|
|
|
* held here. A value of std::nullopt means there is no active debug session present.
|
|
|
|
|
*/
|
|
|
|
|
std::optional<DebugSession> activeDebugSession;
|
2022-03-24 19:06:09 +00:00
|
|
|
};
|
|
|
|
|
}
|