Corrected bad rebase
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
|
||||
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Services/StringService.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
@@ -148,7 +148,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
memoryBuffer.insert(memoryBuffer.end(), (this->bytes - bytesToRead), 0x00);
|
||||
}
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(memoryBuffer)));
|
||||
debugSession.connection.writePacket(ResponsePacket(Services::StringService::toHex(memoryBuffer)));
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
Logger::error("Failed to read memory from target - " + exception.getMessage());
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "src/Application.hpp"
|
||||
|
||||
#include "src/Services/PathService.hpp"
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Services/StringService.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
@@ -29,7 +29,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
void BloomVersion::handle(DebugSession& debugSession, TargetControllerService&) {
|
||||
Logger::debug("Handling BloomVersion packet");
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(
|
||||
debugSession.connection.writePacket(ResponsePacket(Services::StringService::toHex(
|
||||
std::string(
|
||||
"Bloom v" + Application::VERSION.toString() + "\n"
|
||||
+ Services::PathService::homeDomainName() + "\n"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "src/Application.hpp"
|
||||
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Services/StringService.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
@@ -28,7 +28,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
void BloomVersionMachine::handle(DebugSession& debugSession, TargetControllerService&) {
|
||||
Logger::debug("Handling BloomVersionMachine packet");
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(
|
||||
debugSession.connection.writePacket(ResponsePacket(Services::StringService::toHex(
|
||||
QJsonDocument(QJsonObject({
|
||||
{"version", QString::fromStdString(Application::VERSION.toString())},
|
||||
{"components", QJsonObject({
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
|
||||
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Services/StringService.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/DebugServer/Gdb/Exceptions/InvalidCommandOption.hpp"
|
||||
@@ -87,7 +87,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
);
|
||||
}
|
||||
|
||||
const auto hexValues = String::toHex(data);
|
||||
const auto hexValues = Services::StringService::toHex(data);
|
||||
Logger::debug("Filling EEPROM with values: " + hexValues);
|
||||
|
||||
targetControllerService.writeMemory(
|
||||
@@ -96,13 +96,15 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
std::move(data)
|
||||
);
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(
|
||||
debugSession.connection.writePacket(ResponsePacket(Services::StringService::toHex(
|
||||
"Filled " + std::to_string(eepromSize) + " bytes of EEPROM, with values: " + hexValues + "\n"
|
||||
)));
|
||||
|
||||
} catch (const InvalidCommandOption& exception) {
|
||||
Logger::error(exception.getMessage());
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(exception.getMessage() + "\n")));
|
||||
debugSession.connection.writePacket(
|
||||
ResponsePacket(Services::StringService::toHex(exception.getMessage() + "\n"))
|
||||
);
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
Logger::error("Failed to fill EEPROM - " + exception.getMessage());
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "src/Application.hpp"
|
||||
|
||||
#include "src/Services/PathService.hpp"
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Services/StringService.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
@@ -42,7 +42,9 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
);
|
||||
|
||||
if (this->sendOutput) {
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(svdXml.toString().toStdString())));
|
||||
debugSession.connection.writePacket(
|
||||
ResponsePacket(Services::StringService::toHex(svdXml.toString().toStdString()))
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,7 +60,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
outputFile.write(svdXml.toByteArray());
|
||||
outputFile.close();
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(
|
||||
debugSession.connection.writePacket(ResponsePacket(Services::StringService::toHex(
|
||||
"SVD output saved to " + svdOutputFilePath + "\n"
|
||||
)));
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
|
||||
|
||||
#include "src/Services/PathService.hpp"
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Services/StringService.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
@@ -41,13 +41,15 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
if (!helpFile.open(QIODevice::ReadOnly)) {
|
||||
throw Exception(
|
||||
"Failed to open GDB monitor info help file - please report this issue at " + Services::PathService::homeDomainName()
|
||||
+ "/report-issue"
|
||||
"Failed to open GDB monitor info help file - please report this issue at "
|
||||
+ Services::PathService::homeDomainName() + "/report-issue"
|
||||
);
|
||||
}
|
||||
|
||||
debugSession.connection.writePacket(
|
||||
ResponsePacket(String::toHex("\n" + QTextStream(&helpFile).readAll().toUtf8().toStdString() + "\n"))
|
||||
ResponsePacket(Services::StringService::toHex(
|
||||
"\n" + QTextStream(&helpFile).readAll().toUtf8().toStdString() + "\n"
|
||||
))
|
||||
);
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "src/Targets/TargetRegister.hpp"
|
||||
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Services/StringService.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
@@ -89,7 +89,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
}
|
||||
|
||||
debugSession.connection.writePacket(
|
||||
ResponsePacket(String::toHex(registers))
|
||||
ResponsePacket(Services::StringService::toHex(registers))
|
||||
);
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
|
||||
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Services/StringService.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
@@ -29,7 +29,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
targetControllerService.resetTarget();
|
||||
Logger::info("Target reset complete");
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(
|
||||
debugSession.connection.writePacket(ResponsePacket(Services::StringService::toHex(
|
||||
"Target reset complete - use the 'continue' command to begin execution.\n"
|
||||
)));
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "src/DebugServer/Gdb/Signal.hpp"
|
||||
#include "src/DebugServer/Gdb/StopReason.hpp"
|
||||
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Services/StringService.hpp"
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::ResponsePackets
|
||||
{
|
||||
@@ -25,7 +25,7 @@ namespace Bloom::DebugServer::Gdb::ResponsePackets
|
||||
: signal(signal)
|
||||
, stopReason(stopReason)
|
||||
{
|
||||
std::string packetData = "T" + String::toHex(std::vector({static_cast<unsigned char>(this->signal)}));
|
||||
std::string packetData = "T" + Services::StringService::toHex(static_cast<unsigned char>(this->signal));
|
||||
|
||||
if (this->stopReason.has_value()) {
|
||||
static const auto stopReasonMapping = getStopReasonToNameMapping();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <cmath>
|
||||
|
||||
#include "src/Services/PathService.hpp"
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Services/StringService.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/InvalidConfig.hpp"
|
||||
@@ -984,13 +984,15 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
}
|
||||
|
||||
void EdbgAvr8Interface::setParameter(const Avr8EdbgParameter& parameter, const std::vector<unsigned char>& value) {
|
||||
using Services::StringService;
|
||||
|
||||
const auto responseFrame = this->edbgInterface->sendAvrCommandFrameAndWaitForResponseFrame(
|
||||
SetParameter(parameter, value)
|
||||
);
|
||||
|
||||
Logger::debug(
|
||||
"Setting AVR8 EDBG parameter (context: 0x" + String::toHex(parameter.context) + ", id: 0x"
|
||||
+ String::toHex(parameter.id) + ", value: 0x" + String::toHex(value) + ")"
|
||||
"Setting AVR8 EDBG parameter (context: 0x" + StringService::toHex(parameter.context) + ", id: 0x"
|
||||
+ StringService::toHex(parameter.id) + ", value: 0x" + StringService::toHex(value) + ")"
|
||||
);
|
||||
|
||||
if (responseFrame.id == Avr8ResponseId::FAILED) {
|
||||
|
||||
@@ -39,11 +39,7 @@ namespace Bloom
|
||||
(
|
||||
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true),
|
||||
#ifndef BLOOM_DEBUG_BUILD
|
||||
<<<<<<< HEAD
|
||||
QCoreApplication::addLibraryPath(QString::fromStdString(Paths::applicationDirPath() + "/../plugins")),
|
||||
=======
|
||||
QCoreApplication::addLibraryPath(QString::fromStdString(Services::PathService::applicationDirPath() + "/plugins")),
|
||||
>>>>>>> 0fea8bc1 (Moved Paths helper functions to service class)
|
||||
#endif
|
||||
QApplication(this->qtApplicationArgc, this->qtApplicationArgv.data())
|
||||
)
|
||||
|
||||
@@ -29,13 +29,13 @@ namespace Bloom::Services
|
||||
});
|
||||
}
|
||||
|
||||
std::string String::toHex(unsigned char value) {
|
||||
std::string StringService::toHex(unsigned char value) {
|
||||
auto stream = std::stringstream();
|
||||
stream << std::hex << std::setfill('0') << std::setw(2) << static_cast<unsigned int>(value);
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
std::string String::toHex(const std::vector<unsigned char>& data) {
|
||||
std::string StringService::toHex(const std::vector<unsigned char>& data) {
|
||||
auto stream = std::stringstream();
|
||||
stream << std::hex << std::setfill('0');
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Bloom::Services
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
std::string String::toHex(const std::string& data) {
|
||||
std::string StringService::toHex(const std::string& data) {
|
||||
std::stringstream stream;
|
||||
stream << std::hex << std::setfill('0');
|
||||
|
||||
|
||||
@@ -439,40 +439,6 @@ namespace Bloom::TargetController
|
||||
TargetControllerComponent::responsesByCommandIdCv.notify_all();
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
void TargetControllerComponent::checkUdevRules() {
|
||||
auto bloomRulesPath = std::string("/etc/udev/rules.d/99-bloom.rules");
|
||||
auto latestBloomRulesPath = Services::PathService::resourcesDirPath() + "/UDevRules/99-bloom.rules";
|
||||
|
||||
if (!std::filesystem::exists(bloomRulesPath)) {
|
||||
Logger::warning("Bloom udev rules missing - attempting installation");
|
||||
|
||||
// We can only install them if we're running as root
|
||||
if (!Services::ProcessService::isRunningAsRoot()) {
|
||||
Logger::error("Bloom udev rules missing - cannot install udev rules without root privileges.\n"
|
||||
"Running Bloom once with root privileges will allow it to automatically install the udev rules. "
|
||||
"Alternatively, instructions on manually installing the udev rules can be found "
|
||||
"here: " + Services::PathService::homeDomainName() + "/docs/getting-started\nBloom may fail to connect to some "
|
||||
"debug tools until this is resolved.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!std::filesystem::exists(latestBloomRulesPath)) {
|
||||
// This shouldn't happen, but it can if someone has been messing with the installation files
|
||||
Logger::error(
|
||||
"Unable to install Bloom udev rules - \"" + latestBloomRulesPath + "\" does not exist."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
std::filesystem::copy(latestBloomRulesPath, bloomRulesPath);
|
||||
Logger::warning("Bloom udev rules installed - a reconnect of the debug tool may be required "
|
||||
"before the new udev rules come into effect.");
|
||||
}
|
||||
}
|
||||
|
||||
>>>>>>> b5402709 (Moved Process helper functions to service class)
|
||||
void TargetControllerComponent::shutdown() {
|
||||
if (this->getThreadState() == ThreadState::STOPPED) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user