This commit is contained in:
Nav
2021-05-25 21:50:17 +01:00
parent c755094cd5
commit 77bcf07d6c
43 changed files with 103 additions and 49 deletions

View File

@@ -156,8 +156,8 @@ int Application::presentHelpText() {
throw Exception("Failed to open help file - please report this issue at https://bloom.oscillate.io/report-issue");
}
std::cout << "Bloom v" << Application::VERSION_STR << std::endl;
std::cout << QTextStream(&helpFile).readAll().toUtf8().constData() << std::endl;
std::cout << "Bloom v" << Application::VERSION_STR << "\n";
std::cout << QTextStream(&helpFile).readAll().toUtf8().constData() << "\n";
return EXIT_SUCCESS;
}
@@ -170,8 +170,8 @@ int Application::presentVersionText() {
std::cout << "DEBUG BUILD - Compilation timestamp: " << __DATE__ << " " << __TIME__ << "\n";
#endif
std::cout << "https://bloom.oscillate.io/" << "\n";
std::cout << "Nav Mohammed" << std::endl;
std::cout << "https://bloom.oscillate.io/\n";
std::cout << "Nav Mohammed\n";
return EXIT_SUCCESS;
}

View File

@@ -63,10 +63,11 @@ namespace Bloom
/**
* A mapping of event type names to a vector of callback functions. Events will be dispatched to these
* callback functions, during a call to EventListener::waiteAndDispatch().
* callback functions, during a call to EventListener::dispatchEvent().
*
* Each callback will be passed an std::shared_ptr<const EventType> of the event (we downcast the events in
* EventListener::waiteAndDispatch() before dispatching them).
* Each callback will be passed an std::shared_ptr<const EventType> of the event (we wrap all registered
* callbacks in a lambda, where we perform a downcast before invoking the callback.
* See EventListener::registerCallbackForEventType() for more)
*/
SyncSafe<std::map<std::string, std::vector<std::function<void(Events::GenericEventPointer)>>>> eventTypeToCallbacksMapping;
SyncSafe<std::set<std::string>> registeredEventTypes;

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
namespace Bloom::Events

View File

@@ -1,6 +1,7 @@
#pragma once
#include <set>
#include <string>
#include "Event.hpp"
namespace Bloom::Events

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
#include "src/Helpers/Thread.hpp"

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
namespace Bloom::Events

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
namespace Bloom::Events

View File

@@ -9,7 +9,6 @@
#include "DebugSessionStarted.hpp"
#include "DebugSessionFinished.hpp"
#include "TargetControllerThreadStateChanged.hpp"
#include "TargetControllerStopped.hpp"
#include "ShutdownTargetController.hpp"
#include "TargetControllerErrorOccurred.hpp"
#include "ShutdownApplication.hpp"

View File

@@ -1,6 +1,6 @@
#pragma once
#include <cstdint>
#include <string>
#include "Event.hpp"

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
#include "src/Helpers/Thread.hpp"

View File

@@ -1,6 +1,6 @@
#pragma once
#include <vector>
#include <string>
#include "Event.hpp"
#include "src/Targets/TargetMemory.hpp"

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
#include "src/Targets/TargetMemory.hpp"

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
namespace Bloom::Events

View File

@@ -1,6 +1,6 @@
#pragma once
#include <vector>
#include <string>
#include "Event.hpp"
#include "src/Targets/TargetRegister.hpp"

View File

@@ -1,6 +1,6 @@
#pragma once
#include <set>
#include <string>
#include "Event.hpp"

View File

@@ -1,6 +1,7 @@
#pragma once
#include <cstdint>
#include <string>
#include "Event.hpp"
#include "src/Targets/TargetBreakpoint.hpp"

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
namespace Bloom::Events

View File

@@ -1,6 +1,7 @@
#pragma once
#include <cstdint>
#include <string>
#include "Event.hpp"

View File

@@ -1,6 +1,7 @@
#pragma once
#include <cstdint>
#include <string>
#include "Event.hpp"
#include "src/Targets/TargetMemory.hpp"

View File

@@ -1,6 +1,6 @@
#pragma once
#include <set>
#include <string>
#include "Event.hpp"
#include "src/Targets/TargetRegister.hpp"

View File

@@ -1,6 +1,6 @@
#pragma once
#include <cstdint>
#include <string>
#include "Event.hpp"

View File

@@ -1,6 +1,7 @@
#pragma once
#include <cstdint>
#include <string>
#include "Event.hpp"
#include "src/Targets/TargetBreakpoint.hpp"

View File

@@ -1,5 +1,8 @@
#pragma once
#include <cstdint>
#include <string>
#include "Event.hpp"
namespace Bloom::Events

View File

@@ -1,6 +1,6 @@
#pragma once
#include <cstdint>
#include <string>
#include "Event.hpp"
#include "src/Targets/TargetPinDescriptor.hpp"

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
namespace Bloom::Events

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
namespace Bloom::Events

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
namespace Bloom::Events

View File

@@ -1,6 +1,7 @@
#pragma once
#include <cstdint>
#include <string>
#include "Event.hpp"

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
namespace Bloom::Events

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
namespace Bloom::Events

View File

@@ -1,21 +0,0 @@
#pragma once
#include "Event.hpp"
#include "src/Exceptions/Exception.hpp"
namespace Bloom::Events
{
class TargetControllerStopped: public Event
{
private:
bool stoppedAbruptly = false;
std::optional<Exceptions::Exception> caughtException;
public:
static inline const std::string name = "TargetControllerStoppedEvent";
std::string getName() const override {
return TargetControllerStopped::name;
}
};
}

View File

@@ -1,6 +1,6 @@
#pragma once
#include <cstdint>
#include <string>
#include "Event.hpp"
#include "src/Targets/TargetDescriptor.hpp"

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string>
#include "Event.hpp"
namespace Bloom::Events

View File

@@ -1,6 +1,7 @@
#pragma once
#include <cstdint>
#include <string>
#include "Event.hpp"
#include "src/Targets/Target.hpp"

View File

@@ -1,7 +1,7 @@
#pragma once
#include <cstdint>
#include <map>
#include <string>
#include "Event.hpp"
#include "src/Targets/TargetPinDescriptor.hpp"

View File

@@ -1,6 +1,7 @@
#pragma once
#include <cstdint>
#include <string>
#include "Event.hpp"
#include "src/Targets/TargetMemory.hpp"

View File

@@ -1,6 +1,6 @@
#pragma once
#include <set>
#include <string>
#include "Event.hpp"
#include "src/Targets/TargetRegister.hpp"

View File

@@ -4,7 +4,6 @@
#include <QObject>
#include <QTimer>
#include "src/Application.hpp"
#include "InsightWorker.hpp"
#include "src/Logger/Logger.hpp"
#include "src/Helpers/Thread.hpp"
@@ -58,7 +57,30 @@ void InsightWorker::requestPinStateUpdate(
}
void InsightWorker::onTargetStoppedEvent(EventPointer<TargetExecutionStopped> event) {
auto resumedEvent = this->eventListener->waitForEvent<TargetExecutionResumed>(std::chrono::milliseconds(650));
/*
* When we report a target halt to Insight, Insight will immediately seek more data from the target (such as GPIO
* pin states). This can be problematic for cases where the target had halted due to a conditional breakpoint.
*
* For conditional breakpoints, a software breakpoint is employed to halt target execution and give the debug
* client an opportunity to check the condition. In cases where the condition is not met, the client will
* immediately request for execution to be resumed. It's important that Insight does not get in the way of this
* process, as it could end up slowing things down significantly.
*
* For the above reason, we don't want to report any target halts to Insight, unless we can be sure that the client
* isn't going to immediately resume execution upon checking the condition.
*
* We do this by providing a time window for the TargetExecutionResumed event. If the event is triggered within
* that time window, we won't report the target halt to Insight, thus preventing Insight from needlessly seeking
* data from the target and slowing things down.
*
* This isn't the best approach, TBH, as it introduces a delay to Insight's response to the target halting. The
* problem is, we cannot differentiate a conditional breakpoint with a software breakpoint, so this seems to be the
* only way. It would be nice if the debug client gave us some form of indication of whether the breakpoint is a
* conditional one.
*/
auto resumedEvent = this->eventListener->waitForEvent<TargetExecutionResumed>(
std::chrono::milliseconds(650)
);
if (!resumedEvent.has_value()) {
emit this->targetStateUpdated(TargetState::STOPPED);

View File

@@ -20,7 +20,8 @@ namespace Bloom
DEBUG = 4,
};
struct LogEntry {
struct LogEntry
{
std::string threadName;
std::string message;
LogLevel logLevel;

View File

@@ -17,9 +17,9 @@ void SignalHandler::run() {
while(Thread::getState() == ThreadState::READY) {
if (sigwait(&signalSet, &signalNumber) == 0) {
Logger::debug("SIGNAL " + std::to_string(signalNumber) + " received");
if (this->handlersMappedBySignalNum.find(signalNumber) != this->handlersMappedBySignalNum.end()) {
if (this->handlersMappedBySignalNum.contains(signalNumber)) {
// We have a registered handler for this signal.
this->handlersMappedBySignalNum.find(signalNumber)->second();
this->handlersMappedBySignalNum.at(signalNumber)();
}
}
}

View File

@@ -8,7 +8,8 @@
namespace Bloom::Targets
{
enum class TargetPinType: int {
enum class TargetPinType: int
{
UNKNOWN,
GPIO,
GND,
@@ -28,12 +29,14 @@ namespace Bloom::Targets
struct TargetPinState
{
enum class IoState: int {
enum class IoState: int
{
HIGH,
LOW,
};
enum class IoDirection: int {
enum class IoDirection: int
{
INPUT,
OUTPUT,
};

View File

@@ -8,7 +8,8 @@
namespace Bloom::Targets
{
enum class TargetPackage: int {
enum class TargetPackage: int
{
UNKNOWN,
/**

View File

@@ -1,14 +1,23 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource>
<!-- The contents of help.txt is presented to the user in response to the invocation of the help command-->
<file alias="/compiled/resources/help.txt">../resources/help.txt</file>
<!-- The bloom.template.json is a template configuration file that is used to initiate a new project, via the init command-->
<file alias="/compiled/resources/bloom.template.json">../resources/bloom.template.json</file>
<!-- QT UI templates for Insight-->
<file alias="/compiled/Insight/UserInterfaces/InsightWindow/UiFiles/InsightWindow.ui">./Insight/UserInterfaces/InsightWindow/UiFiles/InsightWindow.ui</file>
<file alias="/compiled/Insight/UserInterfaces/InsightWindow/UiFiles/AboutWindow.ui">./Insight/UserInterfaces/InsightWindow/UiFiles/AboutWindow.ui</file>
<!-- QT UI stylesheets for Insight-->
<file alias="/compiled/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss">./Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss</file>
<file alias="/compiled/Insight/UserInterfaces/InsightWindow/Stylesheets/AboutWindow.qss">./Insight/UserInterfaces/InsightWindow/Stylesheets/AboutWindow.qss</file>
<file alias="/compiled/Insight/UserInterfaces/InsightWindow/TargetWidgets/DIP/Stylesheets/DualInlinePackage.qss">./Insight/UserInterfaces/InsightWindow/TargetWidgets/DIP/Stylesheets/DualInlinePackage.qss</file>
<file alias="/compiled/Insight/UserInterfaces/InsightWindow/TargetWidgets/QFP/Stylesheets/QuadFlatPackage.qss">./Insight/UserInterfaces/InsightWindow/TargetWidgets/QFP/Stylesheets/QuadFlatPackage.qss</file>
<!-- Icons for Insight-->
<file alias="/compiled/Insight/UserInterfaces/InsightWindow/Images/BloomIcon.svg">./Insight/UserInterfaces/InsightWindow/Images/BloomIcon.svg</file>
<file alias="/compiled/Insight/UserInterfaces/InsightWindow/Images/RAM.svg">./Insight/UserInterfaces/InsightWindow/Images/RAM.svg</file>
<file alias="/compiled/Insight/UserInterfaces/InsightWindow/Images/refresh.svg">./Insight/UserInterfaces/InsightWindow/Images/refresh.svg</file>