Added ResponsePacket constructor with string param
This commit is contained in:
@@ -64,9 +64,8 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
this->bytes
|
||||
);
|
||||
|
||||
auto hexMemoryBuffer = Packet::toHex(memoryBuffer);
|
||||
debugSession.connection.writePacket(
|
||||
ResponsePacket(std::vector<unsigned char>(hexMemoryBuffer.begin(), hexMemoryBuffer.end()))
|
||||
ResponsePacket(Packet::toHex(memoryBuffer))
|
||||
);
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
|
||||
@@ -42,13 +42,13 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
if (packetString.find("qAttached") == 0) {
|
||||
Logger::debug("Handling qAttached");
|
||||
debugSession.connection.writePacket(ResponsePacket({1}));
|
||||
debugSession.connection.writePacket(ResponsePacket(std::vector<unsigned char>({1})));
|
||||
return;
|
||||
}
|
||||
|
||||
Logger::debug("Unknown GDB RSP packet: " + packetString + " - returning empty response");
|
||||
|
||||
// Respond with an empty packet
|
||||
debugSession.connection.writePacket(ResponsePacket({0}));
|
||||
debugSession.connection.writePacket(ResponsePacket(std::vector<unsigned char>({0})));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,9 +84,8 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
registers.insert(registers.end(), reg.value.begin(), reg.value.end());
|
||||
}
|
||||
|
||||
auto responseRegisters = Packet::toHex(registers);
|
||||
debugSession.connection.writePacket(
|
||||
ResponsePacket(std::vector<unsigned char>(responseRegisters.begin(), responseRegisters.end()))
|
||||
ResponsePacket(Packet::toHex(registers))
|
||||
);
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
|
||||
@@ -18,5 +18,9 @@ namespace Bloom::DebugServer::Gdb::ResponsePackets
|
||||
explicit ResponsePacket(const std::vector<unsigned char>& data) {
|
||||
this->data = data;
|
||||
}
|
||||
|
||||
explicit ResponsePacket(const std::string& data) {
|
||||
this->data = std::vector<unsigned char>(data.begin(), data.end());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user