Replaced project configuration format from JSON to YAML
This commit is contained in:
@@ -43,7 +43,7 @@ namespace Bloom::DebugServer
|
||||
EventListenerPointer eventListener = std::make_shared<EventListener>("DebugServerEventListener");
|
||||
|
||||
/**
|
||||
* Project configuration for the debug server (extracted from the user project's bloom.json).
|
||||
* Project configuration for the debug server (extracted from the user project's bloom.yaml).
|
||||
*/
|
||||
DebugServerConfig debugServerConfig;
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Bloom::DebugServer
|
||||
/**
|
||||
* Returns a mapping of server configuration names to lambdas/std::functions.
|
||||
*
|
||||
* The server configuration name is what the user will use in their project configuration (bloom.json), when
|
||||
* The server configuration name is what the user will use in their project configuration (bloom.yaml), when
|
||||
* selecting a debug server. It *must* be lower-case.
|
||||
*
|
||||
* The lambda should return an instance of the server implementation.
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
#include "GdbDebugServerConfig.hpp"
|
||||
|
||||
#include "src/Helpers/YamlUtilities.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom::DebugServer::Gdb
|
||||
{
|
||||
GdbDebugServerConfig::GdbDebugServerConfig(const DebugServerConfig& debugServerConfig)
|
||||
: DebugServerConfig(debugServerConfig)
|
||||
{
|
||||
if (debugServerConfig.jsonObject.contains("ipAddress")) {
|
||||
this->listeningAddress = debugServerConfig.jsonObject.value("ipAddress").toString().toStdString();
|
||||
if (debugServerConfig.debugServerNode["ipAddress"]) {
|
||||
if (!YamlUtilities::isType<std::string>(debugServerConfig.debugServerNode["ipAddress"])) {
|
||||
Logger::error(
|
||||
"Invalid GDB debug server config parameter ('ipAddress') provided - must be a string. The "
|
||||
"parameter will be ignored."
|
||||
);
|
||||
}
|
||||
|
||||
this->listeningAddress = debugServerConfig.debugServerNode["ipAddress"].as<std::string>();
|
||||
}
|
||||
|
||||
if (debugServerConfig.jsonObject.contains("port")) {
|
||||
const auto portValue = debugServerConfig.jsonObject.value("port");
|
||||
if (debugServerConfig.debugServerNode["port"]) {
|
||||
this->listeningPortNumber = static_cast<std::uint16_t>(
|
||||
portValue.isString() ? portValue.toString().toInt(nullptr, 10) : portValue.toInt()
|
||||
debugServerConfig.debugServerNode["port"].as<int>()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ connected AVR target, by implementing the
|
||||
Each server must implement the interface defined in the [`ServerInterface` class](./ServerInterface.hpp).
|
||||
|
||||
At startup, the DebugServer will select the appropriate server implementation, based on the user's project
|
||||
configuration (bloom.json - see [`DebugServerConfig`](../ProjectConfig.hpp)). Each server implementation is mapped to a
|
||||
configuration (bloom.yaml - see [`DebugServerConfig`](../ProjectConfig.hpp)). Each server implementation is mapped to a
|
||||
config name, which is to be used in the project configuration file. For the mapping, see
|
||||
`DebugServerComponent::getAvailableServersByName()`. After initialising the server (via `ServerInterface::init()`),
|
||||
control of the DebugServer thread will then be handed over to the server implementation (via `ServerInterface::run()`).
|
||||
|
||||
Reference in New Issue
Block a user