Introduced debugTool configuration object (as a replacement for the single debugToolName parameter)
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
{
|
{
|
||||||
"environments": {
|
"environments": {
|
||||||
"default": {
|
"default": {
|
||||||
"debugToolName": "atmel-ice",
|
"debugTool": {
|
||||||
|
"name": "atmel-ice",
|
||||||
|
"releasePostDebugSession": true
|
||||||
|
},
|
||||||
|
|
||||||
"target": {
|
"target": {
|
||||||
"name": "avr8",
|
"name": "avr8",
|
||||||
@@ -19,4 +22,4 @@
|
|||||||
"insight": {
|
"insight": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,15 +49,16 @@ void InsightConfig::init(QJsonObject jsonObject) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EnvironmentConfig::init(std::string name, QJsonObject jsonObject) {
|
void EnvironmentConfig::init(std::string name, QJsonObject jsonObject) {
|
||||||
this->name = name;
|
if (!jsonObject.contains("debugTool")) {
|
||||||
this->debugToolName = jsonObject.find("debugToolName")->toString().toLower().toStdString();
|
throw Exceptions::InvalidConfig("No debug tool configuration provided.");
|
||||||
|
|
||||||
// Extract target data
|
|
||||||
if (!jsonObject.contains("target")) {
|
|
||||||
// Environment has no target data - ignore
|
|
||||||
throw Exceptions::InvalidConfig("No target configuration provided");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!jsonObject.contains("target")) {
|
||||||
|
throw Exceptions::InvalidConfig("No target configuration provided.");
|
||||||
|
}
|
||||||
|
|
||||||
|
this->name = name;
|
||||||
|
this->debugToolConfig.init(jsonObject.find("debugTool")->toObject());
|
||||||
this->targetConfig.init(jsonObject.find("target")->toObject());
|
this->targetConfig.init(jsonObject.find("target")->toObject());
|
||||||
|
|
||||||
if (jsonObject.contains("debugServer")) {
|
if (jsonObject.contains("debugServer")) {
|
||||||
@@ -87,6 +88,20 @@ void TargetConfig::init(QJsonObject jsonObject) {
|
|||||||
this->jsonObject = jsonObject;
|
this->jsonObject = jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebugToolConfig::init(QJsonObject jsonObject) {
|
||||||
|
if (!jsonObject.contains("name")) {
|
||||||
|
throw Exceptions::InvalidConfig("No debug tool name found.");
|
||||||
|
}
|
||||||
|
|
||||||
|
this->name = jsonObject.find("name")->toString().toLower().toStdString();
|
||||||
|
|
||||||
|
if (jsonObject.contains("releasePostDebugSession")) {
|
||||||
|
this->releasePostDebugSession = jsonObject.find("releasePostDebugSession").value().toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->jsonObject = jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
void DebugServerConfig::init(QJsonObject jsonObject) {
|
void DebugServerConfig::init(QJsonObject jsonObject) {
|
||||||
this->name = jsonObject.find("name")->toString().toLower().toStdString();
|
this->name = jsonObject.find("name")->toString().toLower().toStdString();
|
||||||
this->jsonObject = jsonObject;
|
this->jsonObject = jsonObject;
|
||||||
|
|||||||
@@ -49,9 +49,50 @@ namespace Bloom
|
|||||||
*/
|
*/
|
||||||
void init(QJsonObject jsonObject);
|
void init(QJsonObject jsonObject);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the selected target.
|
||||||
|
*/
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
std::string variantName;
|
/**
|
||||||
|
* The name of the selected target variant.
|
||||||
|
*
|
||||||
|
* Insight uses this to determine which variant to select on startup.
|
||||||
|
*/
|
||||||
|
std::optional<std::string> variantName;
|
||||||
|
|
||||||
|
QJsonObject jsonObject;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration relating to a specific debug tool.
|
||||||
|
*
|
||||||
|
* As with the TargetConfig struct, please don't add any manufacture/model specific configuration here. This
|
||||||
|
* configuration should apply to all supported debug tools. Specific configuration can be extracted from the
|
||||||
|
* jsonObject member, as described in the TargetConfig comment above.
|
||||||
|
*/
|
||||||
|
struct DebugToolConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Obtains config parameters from JSON object.
|
||||||
|
*
|
||||||
|
* @param jsonObject
|
||||||
|
*/
|
||||||
|
void init(QJsonObject jsonObject);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the selected debug tool.
|
||||||
|
*/
|
||||||
|
std::string name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if the TargetController will release the debug tool at the end of a debug session.
|
||||||
|
*
|
||||||
|
* If this is enabled, the TargetController will automatically suspend once the current debug session has
|
||||||
|
* ended. If not enabled, the TargetController will remain active and in control of the debug tool, preventing
|
||||||
|
* the user from running any other application that needs access to the debug tool.
|
||||||
|
*/
|
||||||
|
bool releasePostDebugSession = true;
|
||||||
|
|
||||||
QJsonObject jsonObject;
|
QJsonObject jsonObject;
|
||||||
};
|
};
|
||||||
@@ -107,14 +148,16 @@ namespace Bloom
|
|||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the selected debug tool for this environment.
|
* Configuration for the environment's selected debug tool.
|
||||||
|
*
|
||||||
|
* Each environment can select only one debug tool.
|
||||||
*/
|
*/
|
||||||
std::string debugToolName;
|
DebugToolConfig debugToolConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration for the environment's selected target.
|
* Configuration for the environment's selected target.
|
||||||
*
|
*
|
||||||
* Each environment can consist of only one target.
|
* Each environment can select only one target.
|
||||||
*/
|
*/
|
||||||
TargetConfig targetConfig;
|
TargetConfig targetConfig;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user