2022-05-05 20:14:59 +01:00
|
|
|
#include "HelpMonitorInfo.hpp"
|
|
|
|
|
|
2024-08-26 21:33:51 +01:00
|
|
|
#include <string>
|
2022-05-05 20:14:59 +01:00
|
|
|
|
|
|
|
|
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
|
|
|
|
|
|
2023-01-21 14:27:45 +00:00
|
|
|
#include "src/Services/StringService.hpp"
|
2022-05-05 20:14:59 +01:00
|
|
|
#include "src/Logger/Logger.hpp"
|
2023-01-21 13:37:56 +00:00
|
|
|
|
2024-08-26 21:33:51 +01:00
|
|
|
#include "src/Targets/TargetFamily.hpp"
|
2022-05-05 20:14:59 +01:00
|
|
|
|
2023-08-13 15:47:51 +01:00
|
|
|
namespace DebugServer::Gdb::CommandPackets
|
2022-05-05 20:14:59 +01:00
|
|
|
{
|
2022-12-26 21:27:19 +00:00
|
|
|
using Services::TargetControllerService;
|
2024-08-26 21:33:51 +01:00
|
|
|
using Services::StringService;
|
2022-05-05 20:14:59 +01:00
|
|
|
|
|
|
|
|
using ResponsePackets::ResponsePacket;
|
|
|
|
|
|
|
|
|
|
HelpMonitorInfo::HelpMonitorInfo(Monitor&& monitorPacket)
|
|
|
|
|
: Monitor(std::move(monitorPacket))
|
|
|
|
|
{}
|
|
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
void HelpMonitorInfo::handle(
|
|
|
|
|
DebugSession& debugSession,
|
|
|
|
|
const TargetDescriptor& gdbTargetDescriptor,
|
2024-08-26 21:33:51 +01:00
|
|
|
const Targets::TargetDescriptor& targetDescriptor,
|
2024-07-23 21:14:22 +01:00
|
|
|
TargetControllerService&
|
|
|
|
|
) {
|
2023-05-07 20:17:33 +01:00
|
|
|
Logger::info("Handling HelpMonitorInfo packet");
|
2022-05-05 20:14:59 +01:00
|
|
|
|
2024-08-26 21:33:51 +01:00
|
|
|
static constexpr auto LEFT_PADDING = std::string::size_type{3};
|
|
|
|
|
static constexpr auto RIGHT_PADDING = std::string::size_type{26};
|
|
|
|
|
|
|
|
|
|
static const auto leftPadding = std::string{LEFT_PADDING, ' ', std::string::allocator_type{}};
|
|
|
|
|
static const auto leftRightPadding = std::string{
|
|
|
|
|
LEFT_PADDING + RIGHT_PADDING,
|
|
|
|
|
' ',
|
|
|
|
|
std::string::allocator_type{}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
auto output = std::string{"\nSupported Bloom commands:\n\n"};
|
|
|
|
|
output += leftPadding + StringService::padRight("help", ' ', RIGHT_PADDING);
|
|
|
|
|
output += "Displays this help text.\n";
|
|
|
|
|
output += leftPadding + StringService::padRight("version", ' ', RIGHT_PADDING);
|
|
|
|
|
output += "Outputs Bloom's version information.\n";
|
|
|
|
|
output += leftPadding + StringService::padRight("version machine", ' ', RIGHT_PADDING);
|
|
|
|
|
output += "Outputs Bloom's version information in JSON format.\n";
|
|
|
|
|
|
|
|
|
|
#ifndef EXCLUDE_INSIGHT
|
|
|
|
|
output += leftPadding + StringService::padRight("insight", ' ', RIGHT_PADDING);
|
|
|
|
|
output += "Activates the Insight GUI.\n";
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
output += "\n\n";
|
|
|
|
|
output += leftPadding + StringService::padRight("reset", ' ', RIGHT_PADDING);
|
|
|
|
|
output += "Resets the target and holds it in a stopped state.\n\n";
|
|
|
|
|
|
|
|
|
|
if (targetDescriptor.family == Targets::TargetFamily::AVR_8) {
|
|
|
|
|
output += leftPadding + StringService::padRight("eeprom fill [VALUE]", ' ', RIGHT_PADDING);
|
|
|
|
|
output += "Fills the target's EEPROM with the specified value. The value should be in hexadecimal\n";
|
|
|
|
|
output += leftRightPadding + "format: \"monitor eeprom fill AABBCC\". If the specified value is smaller than the EEPROM\n";
|
|
|
|
|
output += leftRightPadding + "memory segment size, it will be repeated across the entire segment address range. If the\n";
|
|
|
|
|
output += leftRightPadding + "value size is not a multiple of the segment size, the value will be truncated in the final\n";
|
|
|
|
|
output += leftRightPadding + "repetition. The value size must not exceed the segment size.\n";
|
2022-05-05 20:14:59 +01:00
|
|
|
}
|
2024-08-26 21:33:51 +01:00
|
|
|
|
|
|
|
|
debugSession.connection.writePacket(ResponsePacket{Services::StringService::toHex(output)});
|
2022-05-05 20:14:59 +01:00
|
|
|
}
|
|
|
|
|
}
|