Compare commits
1 Commits
e6102ba433
...
optimized
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8f04856ed |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
Build/
|
Build/
|
||||||
|
Build_Coverage/
|
||||||
bin/
|
bin/
|
||||||
*.o
|
*.o
|
||||||
*.so
|
*.so
|
||||||
|
|||||||
68
CMakeLists.txt
Normal file
68
CMakeLists.txt
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
project(marte_dev)
|
||||||
|
|
||||||
|
if(NOT DEFINED ENV{MARTe2_DIR})
|
||||||
|
message(FATAL_ERROR "MARTe2_DIR not set. Please source env.sh")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(MARTe2_DIR $ENV{MARTe2_DIR})
|
||||||
|
set(MARTe2_Components_DIR $ENV{MARTe2_Components_DIR})
|
||||||
|
set(TARGET $ENV{TARGET})
|
||||||
|
|
||||||
|
# Define Architecture macros
|
||||||
|
add_definitions(-DARCHITECTURE=x86_gcc)
|
||||||
|
add_definitions(-DENVIRONMENT=Linux)
|
||||||
|
add_definitions(-DMARTe2_TEST_ENVIRONMENT=GTest) # Optional
|
||||||
|
add_definitions(-DUSE_PTHREAD)
|
||||||
|
|
||||||
|
# Add -pthread and coverage flags
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
option(ENABLE_COVERAGE "Enable coverage reporting" OFF)
|
||||||
|
if(ENABLE_COVERAGE)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L0Types
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L1Portability
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L2Objects
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L3Streams
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L4Configuration
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L4Events
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L4Logger
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L4Messages
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L5FILES
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L5GAMs
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L6App
|
||||||
|
${MARTe2_DIR}/Source/Core/Scheduler/L1Portability
|
||||||
|
${MARTe2_DIR}/Source/Core/Scheduler/L3Services
|
||||||
|
${MARTe2_DIR}/Source/Core/Scheduler/L4LoggerService
|
||||||
|
${MARTe2_DIR}/Source/Core/FileSystem/L1Portability
|
||||||
|
${MARTe2_DIR}/Source/Core/FileSystem/L3Streams
|
||||||
|
${MARTe2_DIR}/Source/Core/Scheduler/L5GAMs
|
||||||
|
${MARTe2_Components_DIR}/Source/Components/DataSources/EpicsDataSource
|
||||||
|
${MARTe2_Components_DIR}/Source/Components/DataSources/FileDataSource
|
||||||
|
${MARTe2_Components_DIR}/Source/Components/GAMs/IOGAM
|
||||||
|
Source
|
||||||
|
Headers
|
||||||
|
)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE SOURCES "Source/*.cpp")
|
||||||
|
|
||||||
|
add_library(${PROJECT_NAME} SHARED ${SOURCES})
|
||||||
|
|
||||||
|
# Target MARTe2 library
|
||||||
|
set(MARTe2_LIB ${MARTe2_DIR}/Build/${TARGET}/Core/libMARTe2.so)
|
||||||
|
set(IOGAM_LIB ${MARTe2_Components_DIR}/Build/${TARGET}/Components/GAMs/IOGAM/libIOGAM.so)
|
||||||
|
set(LinuxTimer_LIB ${MARTe2_Components_DIR}/Build/${TARGET}/Components/DataSources/LinuxTimer/libLinuxTimer.so)
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME}
|
||||||
|
${MARTe2_LIB}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_subdirectory(Test/UnitTests)
|
||||||
|
add_subdirectory(Test/Integration)
|
||||||
248
Headers/DebugBrokerWrapper.h
Normal file
248
Headers/DebugBrokerWrapper.h
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
#ifndef DEBUGBROKERWRAPPER_H
|
||||||
|
#define DEBUGBROKERWRAPPER_H
|
||||||
|
|
||||||
|
#include "DebugService.h"
|
||||||
|
#include "BrokerI.h"
|
||||||
|
#include "MemoryMapBroker.h"
|
||||||
|
#include "ObjectRegistryDatabase.h"
|
||||||
|
#include "ObjectBuilder.h"
|
||||||
|
#include "Vector.h"
|
||||||
|
#include "FastPollingMutexSem.h"
|
||||||
|
#include "HighResolutionTimer.h"
|
||||||
|
#include "Atomic.h"
|
||||||
|
|
||||||
|
// Original broker headers
|
||||||
|
#include "MemoryMapInputBroker.h"
|
||||||
|
#include "MemoryMapOutputBroker.h"
|
||||||
|
#include "MemoryMapSynchronisedInputBroker.h"
|
||||||
|
#include "MemoryMapSynchronisedOutputBroker.h"
|
||||||
|
#include "MemoryMapInterpolatedInputBroker.h"
|
||||||
|
#include "MemoryMapMultiBufferInputBroker.h"
|
||||||
|
#include "MemoryMapMultiBufferOutputBroker.h"
|
||||||
|
#include "MemoryMapSynchronisedMultiBufferInputBroker.h"
|
||||||
|
#include "MemoryMapSynchronisedMultiBufferOutputBroker.h"
|
||||||
|
#include "MemoryMapAsyncOutputBroker.h"
|
||||||
|
#include "MemoryMapAsyncTriggerOutputBroker.h"
|
||||||
|
|
||||||
|
namespace MARTe {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Helper for optimized signal processing within brokers.
|
||||||
|
*/
|
||||||
|
class DebugBrokerHelper {
|
||||||
|
public:
|
||||||
|
static void Process(DebugService* service, BrokerInfo& info) {
|
||||||
|
if (service == NULL_PTR(DebugService*)) return;
|
||||||
|
|
||||||
|
while (service->IsPaused()) {
|
||||||
|
Sleep::MSec(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*info.anyActiveFlag) {
|
||||||
|
uint32 idx = info.currentSetIdx;
|
||||||
|
BrokerActiveSet& set = info.sets[idx];
|
||||||
|
uint64 ts = (uint64)((float64)HighResolutionTimer::Counter() * HighResolutionTimer::Period() * 1000000.0);
|
||||||
|
|
||||||
|
for (uint32 i = 0; i < set.numForced; i++) {
|
||||||
|
SignalExecuteInfo& s = set.forcedSignals[i];
|
||||||
|
DebugService::CopySignal(s.memoryAddress, s.forcedValue, s.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32 i = 0; i < set.numTraced; i++) {
|
||||||
|
SignalExecuteInfo& s = set.tracedSignals[i];
|
||||||
|
(void)service->traceBuffer.Push(s.internalID, ts, s.memoryAddress, s.size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void InitSignals(BrokerI* broker, DataSourceI &dataSourceIn, DebugService* &service, DebugSignalInfo** &signalInfoPointers, uint32 numCopies, MemoryMapBrokerCopyTableEntry* copyTable, const char8* functionName, SignalDirection direction, volatile bool* anyActiveFlag) {
|
||||||
|
if (numCopies > 0) {
|
||||||
|
signalInfoPointers = new DebugSignalInfo*[numCopies];
|
||||||
|
for (uint32 i=0; i<numCopies; i++) signalInfoPointers[i] = NULL_PTR(DebugSignalInfo*);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (service == NULL_PTR(DebugService*)) service = DebugService::Instance();
|
||||||
|
|
||||||
|
if (service && (copyTable != NULL_PTR(MemoryMapBrokerCopyTableEntry*))) {
|
||||||
|
StreamString dsPath;
|
||||||
|
DebugService::GetFullObjectName(dataSourceIn, dsPath);
|
||||||
|
MemoryMapBroker* mmb = dynamic_cast<MemoryMapBroker*>(broker);
|
||||||
|
|
||||||
|
for (uint32 i = 0; i < numCopies; i++) {
|
||||||
|
void *addr = copyTable[i].dataSourcePointer;
|
||||||
|
TypeDescriptor type = copyTable[i].type;
|
||||||
|
uint32 dsIdx = i;
|
||||||
|
if (mmb != NULL_PTR(MemoryMapBroker*)) dsIdx = mmb->GetDSCopySignalIndex(i);
|
||||||
|
|
||||||
|
StreamString signalName;
|
||||||
|
if (!dataSourceIn.GetSignalName(dsIdx, signalName)) {
|
||||||
|
signalName.Printf("Signal_%u", dsIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamString dsFullName = dsPath;
|
||||||
|
if (dsFullName.Size() > 0) dsFullName += ".";
|
||||||
|
dsFullName += signalName;
|
||||||
|
service->RegisterSignal(addr, type, dsFullName.Buffer());
|
||||||
|
|
||||||
|
if (functionName != NULL_PTR(const char8*)) {
|
||||||
|
StreamString gamFullName;
|
||||||
|
const char8* dirStr = (direction == InputSignals) ? "In" : "Out";
|
||||||
|
Reference gamRef = ObjectRegistryDatabase::Instance()->Find(functionName);
|
||||||
|
if (gamRef.IsValid()) {
|
||||||
|
StreamString absGamPath;
|
||||||
|
DebugService::GetFullObjectName(*(gamRef.operator->()), absGamPath);
|
||||||
|
gamFullName = absGamPath;
|
||||||
|
} else {
|
||||||
|
gamFullName = functionName;
|
||||||
|
}
|
||||||
|
gamFullName += ".";
|
||||||
|
gamFullName += dirStr;
|
||||||
|
gamFullName += ".";
|
||||||
|
gamFullName += signalName;
|
||||||
|
signalInfoPointers[i] = service->RegisterSignal(addr, type, gamFullName.Buffer());
|
||||||
|
} else {
|
||||||
|
signalInfoPointers[i] = service->RegisterSignal(addr, type, dsFullName.Buffer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
service->RegisterBroker(signalInfoPointers, numCopies, mmb, anyActiveFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class DebugMemoryMapInputBroker : public MemoryMapInputBroker, public DebugBrokerI {
|
||||||
|
public:
|
||||||
|
DebugMemoryMapInputBroker() : MemoryMapInputBroker(), service(NULL), infoPtr(NULL), anyActive(false) {
|
||||||
|
(void)ObjectRegistryDatabase::Instance()->Insert(Reference(this));
|
||||||
|
}
|
||||||
|
virtual void SetService(DebugService* s) { service = s; }
|
||||||
|
virtual bool IsLinked() const { return infoPtr != NULL; }
|
||||||
|
virtual bool Execute() {
|
||||||
|
bool ret = MemoryMapInputBroker::Execute();
|
||||||
|
if (ret && infoPtr) DebugBrokerHelper::Process(service, *infoPtr);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
virtual bool Init(SignalDirection direction, DataSourceI &ds, const char8 *const name, void *gamMem) {
|
||||||
|
bool ret = MemoryMapInputBroker::Init(direction, ds, name, gamMem);
|
||||||
|
if (ret) {
|
||||||
|
DebugSignalInfo** sigPtrs = NULL;
|
||||||
|
DebugBrokerHelper::InitSignals(this, ds, service, sigPtrs, GetNumberOfCopies(), this->copyTable, name, direction, &anyActive);
|
||||||
|
if (service) infoPtr = service->GetBrokerInfo(service->numberOfBrokers - 1);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
DebugService* service;
|
||||||
|
BrokerInfo* infoPtr;
|
||||||
|
volatile bool anyActive;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class DebugGenericBroker : public T, public DebugBrokerI {
|
||||||
|
public:
|
||||||
|
DebugGenericBroker() : T(), service(NULL), infoPtr(NULL), anyActive(false) {
|
||||||
|
(void)ObjectRegistryDatabase::Instance()->Insert(Reference(this));
|
||||||
|
}
|
||||||
|
virtual void SetService(DebugService* s) { service = s; }
|
||||||
|
virtual bool IsLinked() const { return infoPtr != NULL; }
|
||||||
|
virtual bool Execute() {
|
||||||
|
bool ret = T::Execute();
|
||||||
|
if (ret && infoPtr) DebugBrokerHelper::Process(service, *infoPtr);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
virtual bool Init(SignalDirection direction, DataSourceI &ds, const char8 *const name, void *gamMem) {
|
||||||
|
bool ret = T::Init(direction, ds, name, gamMem);
|
||||||
|
if (ret) {
|
||||||
|
DebugSignalInfo** sigPtrs = NULL;
|
||||||
|
DebugBrokerHelper::InitSignals(this, ds, service, sigPtrs, this->GetNumberOfCopies(), this->copyTable, name, direction, &anyActive);
|
||||||
|
if (service) infoPtr = service->GetBrokerInfo(service->numberOfBrokers - 1);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
DebugService* service;
|
||||||
|
BrokerInfo* infoPtr;
|
||||||
|
volatile bool anyActive;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DebugMemoryMapAsyncOutputBroker : public MemoryMapAsyncOutputBroker, public DebugBrokerI {
|
||||||
|
public:
|
||||||
|
DebugMemoryMapAsyncOutputBroker() : MemoryMapAsyncOutputBroker(), service(NULL), infoPtr(NULL), anyActive(false) {
|
||||||
|
(void)ObjectRegistryDatabase::Instance()->Insert(Reference(this));
|
||||||
|
}
|
||||||
|
virtual void SetService(DebugService* s) { service = s; }
|
||||||
|
virtual bool IsLinked() const { return infoPtr != NULL; }
|
||||||
|
virtual bool Execute() {
|
||||||
|
bool ret = MemoryMapAsyncOutputBroker::Execute();
|
||||||
|
if (ret && infoPtr) DebugBrokerHelper::Process(service, *infoPtr);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
virtual bool InitWithBufferParameters(const SignalDirection d, DataSourceI &ds, const char8* n, void* m, const uint32 nb, const ProcessorType& c, const uint32 s) {
|
||||||
|
bool ret = MemoryMapAsyncOutputBroker::InitWithBufferParameters(d, ds, n, m, nb, c, s);
|
||||||
|
if (ret) {
|
||||||
|
DebugSignalInfo** sigPtrs = NULL;
|
||||||
|
DebugBrokerHelper::InitSignals(this, ds, service, sigPtrs, this->GetNumberOfCopies(), this->copyTable, n, d, &anyActive);
|
||||||
|
if (service) infoPtr = service->GetBrokerInfo(service->numberOfBrokers - 1);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
DebugService* service;
|
||||||
|
BrokerInfo* infoPtr;
|
||||||
|
volatile bool anyActive;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DebugMemoryMapAsyncTriggerOutputBroker : public MemoryMapAsyncTriggerOutputBroker, public DebugBrokerI {
|
||||||
|
public:
|
||||||
|
DebugMemoryMapAsyncTriggerOutputBroker() : MemoryMapAsyncTriggerOutputBroker(), service(NULL), infoPtr(NULL), anyActive(false) {
|
||||||
|
(void)ObjectRegistryDatabase::Instance()->Insert(Reference(this));
|
||||||
|
}
|
||||||
|
virtual void SetService(DebugService* s) { service = s; }
|
||||||
|
virtual bool IsLinked() const { return infoPtr != NULL; }
|
||||||
|
virtual bool Execute() {
|
||||||
|
bool ret = MemoryMapAsyncTriggerOutputBroker::Execute();
|
||||||
|
if (ret && infoPtr) DebugBrokerHelper::Process(service, *infoPtr);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
virtual bool InitWithTriggerParameters(const SignalDirection d, DataSourceI &ds, const char8* n, void* m, const uint32 nb, const uint32 pre, const uint32 post, const ProcessorType& c, const uint32 s) {
|
||||||
|
bool ret = MemoryMapAsyncTriggerOutputBroker::InitWithTriggerParameters(d, ds, n, m, nb, pre, post, c, s);
|
||||||
|
if (ret) {
|
||||||
|
DebugSignalInfo** sigPtrs = NULL;
|
||||||
|
DebugBrokerHelper::InitSignals(this, ds, service, sigPtrs, this->GetNumberOfCopies(), this->copyTable, n, d, &anyActive);
|
||||||
|
if (service) infoPtr = service->GetBrokerInfo(service->numberOfBrokers - 1);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
DebugService* service;
|
||||||
|
BrokerInfo* infoPtr;
|
||||||
|
volatile bool anyActive;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef DebugGenericBroker<MemoryMapOutputBroker> DebugMemoryMapOutputBroker;
|
||||||
|
typedef DebugGenericBroker<MemoryMapSynchronisedInputBroker> DebugMemoryMapSynchronisedInputBroker;
|
||||||
|
typedef DebugGenericBroker<MemoryMapSynchronisedOutputBroker> DebugMemoryMapSynchronisedOutputBroker;
|
||||||
|
typedef DebugGenericBroker<MemoryMapInterpolatedInputBroker> DebugMemoryMapInterpolatedInputBroker;
|
||||||
|
typedef DebugGenericBroker<MemoryMapMultiBufferInputBroker> DebugMemoryMapMultiBufferInputBroker;
|
||||||
|
typedef DebugGenericBroker<MemoryMapMultiBufferOutputBroker> DebugMemoryMapMultiBufferOutputBroker;
|
||||||
|
typedef DebugGenericBroker<MemoryMapSynchronisedMultiBufferInputBroker> DebugMemoryMapSynchronisedMultiBufferInputBroker;
|
||||||
|
typedef DebugGenericBroker<MemoryMapSynchronisedMultiBufferOutputBroker> DebugMemoryMapSynchronisedMultiBufferOutputBroker;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class DebugBrokerBuilder : public ObjectBuilder {
|
||||||
|
public:
|
||||||
|
virtual Object *Build(HeapI* const heap) const {
|
||||||
|
return new (heap) T();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapInputBroker> DebugMemoryMapInputBrokerBuilder;
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapOutputBroker> DebugMemoryMapOutputBrokerBuilder;
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapSynchronisedInputBroker> DebugMemoryMapSynchronisedInputBrokerBuilder;
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapSynchronisedOutputBroker> DebugMemoryMapSynchronisedOutputBrokerBuilder;
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapInterpolatedInputBroker> DebugMemoryMapInterpolatedInputBrokerBuilder;
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapMultiBufferInputBroker> DebugMemoryMapMultiBufferInputBrokerBuilder;
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapMultiBufferOutputBroker> DebugMemoryMapMultiBufferOutputBrokerBuilder;
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapSynchronisedMultiBufferInputBroker> DebugMemoryMapSynchronisedMultiBufferInputBrokerBuilder;
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapSynchronisedMultiBufferOutputBroker> DebugMemoryMapSynchronisedMultiBufferOutputBrokerBuilder;
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapAsyncOutputBroker> DebugMemoryMapAsyncOutputBrokerBuilder;
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapAsyncTriggerOutputBroker> DebugMemoryMapAsyncTriggerOutputBrokerBuilder;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "CompilerTypes.h"
|
#include "CompilerTypes.h"
|
||||||
#include "TypeDescriptor.h"
|
#include "TypeDescriptor.h"
|
||||||
#include "StreamString.h"
|
#include "StreamString.h"
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
namespace MARTe {
|
namespace MARTe {
|
||||||
|
|
||||||
@@ -124,12 +124,12 @@ private:
|
|||||||
uint32 current = *idx;
|
uint32 current = *idx;
|
||||||
uint32 spaceToEnd = bufferSize - current;
|
uint32 spaceToEnd = bufferSize - current;
|
||||||
if (count <= spaceToEnd) {
|
if (count <= spaceToEnd) {
|
||||||
memcpy(&buffer[current], src, count);
|
std::memcpy(&buffer[current], src, count);
|
||||||
*idx = (current + count) % bufferSize;
|
*idx = (current + count) % bufferSize;
|
||||||
} else {
|
} else {
|
||||||
memcpy(&buffer[current], src, spaceToEnd);
|
std::memcpy(&buffer[current], src, spaceToEnd);
|
||||||
uint32 remaining = count - spaceToEnd;
|
uint32 remaining = count - spaceToEnd;
|
||||||
memcpy(&buffer[0], (uint8*)src + spaceToEnd, remaining);
|
std::memcpy(&buffer[0], (uint8*)src + spaceToEnd, remaining);
|
||||||
*idx = remaining;
|
*idx = remaining;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,12 +138,12 @@ private:
|
|||||||
uint32 current = *idx;
|
uint32 current = *idx;
|
||||||
uint32 spaceToEnd = bufferSize - current;
|
uint32 spaceToEnd = bufferSize - current;
|
||||||
if (count <= spaceToEnd) {
|
if (count <= spaceToEnd) {
|
||||||
memcpy(dst, &buffer[current], count);
|
std::memcpy(dst, &buffer[current], count);
|
||||||
*idx = (current + count) % bufferSize;
|
*idx = (current + count) % bufferSize;
|
||||||
} else {
|
} else {
|
||||||
memcpy(dst, &buffer[current], spaceToEnd);
|
std::memcpy(dst, &buffer[current], spaceToEnd);
|
||||||
uint32 remaining = count - spaceToEnd;
|
uint32 remaining = count - spaceToEnd;
|
||||||
memcpy((uint8*)dst + spaceToEnd, &buffer[0], remaining);
|
std::memcpy((uint8*)dst + spaceToEnd, &buffer[0], remaining);
|
||||||
*idx = remaining;
|
*idx = remaining;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
169
Headers/DebugService.h
Normal file
169
Headers/DebugService.h
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
#ifndef DEBUGSERVICE_H
|
||||||
|
#define DEBUGSERVICE_H
|
||||||
|
|
||||||
|
#include "MessageI.h"
|
||||||
|
#include "StreamString.h"
|
||||||
|
#include "BasicUDPSocket.h"
|
||||||
|
#include "BasicTCPSocket.h"
|
||||||
|
#include "ReferenceContainer.h"
|
||||||
|
#include "SingleThreadService.h"
|
||||||
|
#include "EmbeddedServiceMethodBinderI.h"
|
||||||
|
#include "Object.h"
|
||||||
|
#include "DebugCore.h"
|
||||||
|
|
||||||
|
namespace MARTe {
|
||||||
|
|
||||||
|
class MemoryMapBroker;
|
||||||
|
class DebugService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Interface for instrumented brokers to allow service adoption.
|
||||||
|
*/
|
||||||
|
class DebugBrokerI {
|
||||||
|
public:
|
||||||
|
virtual ~DebugBrokerI() {}
|
||||||
|
virtual void SetService(DebugService* service) = 0;
|
||||||
|
virtual bool IsLinked() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SignalExecuteInfo {
|
||||||
|
void* memoryAddress;
|
||||||
|
void* forcedValue;
|
||||||
|
uint32 internalID;
|
||||||
|
uint32 size;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BrokerActiveSet {
|
||||||
|
SignalExecuteInfo* forcedSignals;
|
||||||
|
uint32 numForced;
|
||||||
|
SignalExecuteInfo* tracedSignals;
|
||||||
|
uint32 numTraced;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BrokerInfo {
|
||||||
|
DebugSignalInfo** signalPointers;
|
||||||
|
uint32 numSignals;
|
||||||
|
MemoryMapBroker* broker;
|
||||||
|
BrokerActiveSet sets[2];
|
||||||
|
volatile uint32 currentSetIdx;
|
||||||
|
volatile bool* anyActiveFlag;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SignalAlias {
|
||||||
|
StreamString name;
|
||||||
|
uint32 signalIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DebugService : public ReferenceContainer, public MessageI, public EmbeddedServiceMethodBinderI {
|
||||||
|
public:
|
||||||
|
friend class DebugServiceTest;
|
||||||
|
CLASS_REGISTER_DECLARATION()
|
||||||
|
|
||||||
|
DebugService();
|
||||||
|
virtual ~DebugService();
|
||||||
|
|
||||||
|
virtual bool Initialise(StructuredDataI & data);
|
||||||
|
|
||||||
|
DebugSignalInfo* RegisterSignal(void* memoryAddress, TypeDescriptor type, const char8* name);
|
||||||
|
|
||||||
|
static inline void CopySignal(void* dst, const void* src, const uint32 size) {
|
||||||
|
if (size == 4u) *static_cast<uint32*>(dst) = *static_cast<const uint32*>(src);
|
||||||
|
else if (size == 8u) *static_cast<uint64*>(dst) = *static_cast<const uint64*>(src);
|
||||||
|
else if (size == 1u) *static_cast<uint8*>(dst) = *static_cast<const uint8*>(src);
|
||||||
|
else if (size == 2u) *static_cast<uint16*>(dst) = *static_cast<const uint16*>(src);
|
||||||
|
else MemoryOperationsHelper::Copy(dst, src, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProcessSignal(DebugSignalInfo* signalInfo, uint32 size, uint64 timestamp);
|
||||||
|
|
||||||
|
void RegisterBroker(DebugSignalInfo** signalPointers, uint32 numSignals, MemoryMapBroker* broker, volatile bool* anyActiveFlag);
|
||||||
|
|
||||||
|
virtual ErrorManagement::ErrorType Execute(ExecutionInfo & info);
|
||||||
|
|
||||||
|
static DebugService* Instance();
|
||||||
|
|
||||||
|
bool IsPaused() const { return isPaused; }
|
||||||
|
void SetPaused(bool paused) { isPaused = paused; }
|
||||||
|
|
||||||
|
static bool GetFullObjectName(const Object &obj, StreamString &fullPath);
|
||||||
|
|
||||||
|
uint32 ForceSignal(const char8* name, const char8* valueStr);
|
||||||
|
uint32 UnforceSignal(const char8* name);
|
||||||
|
uint32 TraceSignal(const char8* name, bool enable, uint32 decimation = 1);
|
||||||
|
void Discover(BasicTCPSocket *client);
|
||||||
|
void ListNodes(const char8* path, BasicTCPSocket *client);
|
||||||
|
void InfoNode(const char8* path, BasicTCPSocket *client);
|
||||||
|
|
||||||
|
void UpdateBrokersActiveStatus();
|
||||||
|
|
||||||
|
BrokerInfo* GetBrokerInfo(uint32 index) {
|
||||||
|
if (index < numberOfBrokers) return &brokers[index];
|
||||||
|
return NULL_PTR(BrokerInfo*);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PERFORMANCE-CRITICAL MEMBERS
|
||||||
|
static const uint32 MAX_BROKERS = 256;
|
||||||
|
BrokerInfo brokers[MAX_BROKERS];
|
||||||
|
uint32 numberOfBrokers;
|
||||||
|
TraceRingBuffer traceBuffer;
|
||||||
|
|
||||||
|
static const uint32 MAX_SIGNALS = 512;
|
||||||
|
DebugSignalInfo signals[MAX_SIGNALS];
|
||||||
|
uint32 numberOfSignals;
|
||||||
|
|
||||||
|
static const uint32 MAX_ALIASES = 1024;
|
||||||
|
SignalAlias aliases[MAX_ALIASES];
|
||||||
|
uint32 numberOfAliases;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void HandleCommand(StreamString cmd, BasicTCPSocket *client);
|
||||||
|
uint32 ExportTree(ReferenceContainer *container, StreamString &json);
|
||||||
|
void PatchRegistry();
|
||||||
|
|
||||||
|
ErrorManagement::ErrorType Server(ExecutionInfo & info);
|
||||||
|
ErrorManagement::ErrorType Streamer(ExecutionInfo & info);
|
||||||
|
|
||||||
|
uint16 controlPort;
|
||||||
|
uint16 streamPort;
|
||||||
|
StreamString streamIP;
|
||||||
|
bool isServer;
|
||||||
|
bool suppressTimeoutLogs;
|
||||||
|
volatile bool isPaused;
|
||||||
|
|
||||||
|
BasicTCPSocket tcpServer;
|
||||||
|
BasicUDPSocket udpSocket;
|
||||||
|
|
||||||
|
class ServiceBinder : public EmbeddedServiceMethodBinderI {
|
||||||
|
public:
|
||||||
|
enum ServiceType { ServerType, StreamerType };
|
||||||
|
ServiceBinder(DebugService *parent, ServiceType type) : parent(parent), type(type) {}
|
||||||
|
virtual ErrorManagement::ErrorType Execute(ExecutionInfo & info) {
|
||||||
|
if (type == StreamerType) return parent->Streamer(info);
|
||||||
|
return parent->Server(info);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
DebugService *parent;
|
||||||
|
ServiceType type;
|
||||||
|
};
|
||||||
|
|
||||||
|
ServiceBinder binderServer;
|
||||||
|
ServiceBinder binderStreamer;
|
||||||
|
|
||||||
|
SingleThreadService threadService;
|
||||||
|
SingleThreadService streamerService;
|
||||||
|
|
||||||
|
ThreadIdentifier serverThreadId;
|
||||||
|
ThreadIdentifier streamerThreadId;
|
||||||
|
|
||||||
|
FastPollingMutexSem mutex;
|
||||||
|
|
||||||
|
static const uint32 MAX_CLIENTS = 16;
|
||||||
|
BasicTCPSocket* activeClients[MAX_CLIENTS];
|
||||||
|
FastPollingMutexSem clientsMutex;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern DebugService* GlobalDebugServiceInstance;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
10
Makefile
Normal file
10
Makefile
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
all: build
|
||||||
|
|
||||||
|
build:
|
||||||
|
mkdir -p Build && cd Build && . ../env.sh && cmake -DCMAKE_BUILD_TYPE=Debug .. && make
|
||||||
|
ln -sf libmarte_dev.so Build/DebugService.so
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf Build
|
||||||
|
|
||||||
|
.PHONY: all build clean
|
||||||
26
Makefile.gcc
26
Makefile.gcc
@@ -1,26 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# Copyright 2015 F4E | European Joint Undertaking for ITER
|
|
||||||
# and the Development of Fusion Energy ('Fusion for Energy')
|
|
||||||
#
|
|
||||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
|
||||||
# will be approved by the European Commission - subsequent
|
|
||||||
# versions of the EUPL (the "Licence");
|
|
||||||
# You may not use this work except in compliance with the
|
|
||||||
# Licence.
|
|
||||||
# You may obtain a copy of the Licence at:
|
|
||||||
#
|
|
||||||
# http://ec.europa.eu/idabc/eupl
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in
|
|
||||||
# writing, software distributed under the Licence is
|
|
||||||
# distributed on an "AS IS" basis,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
||||||
# express or implied.
|
|
||||||
# See the Licence for the specific language governing
|
|
||||||
# permissions and limitations under the Licence.
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
export TARGET=x86-linux
|
|
||||||
|
|
||||||
include Makefile.inc
|
|
||||||
76
Makefile.inc
76
Makefile.inc
@@ -1,76 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# Copyright 2015 F4E | European Joint Undertaking for ITER
|
|
||||||
# and the Development of Fusion Energy ('Fusion for Energy')
|
|
||||||
#
|
|
||||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
|
||||||
# will be approved by the European Commission - subsequent
|
|
||||||
# versions of the EUPL (the "Licence");
|
|
||||||
# You may not use this work except in compliance with the
|
|
||||||
# Licence.
|
|
||||||
# You may obtain a copy of the Licence at:
|
|
||||||
#
|
|
||||||
# http://ec.europa.eu/idabc/eupl
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in
|
|
||||||
# writing, software distributed under the Licence is
|
|
||||||
# distributed on an "AS IS" basis,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
||||||
# express or implied.
|
|
||||||
# See the Licence for the specific language governing
|
|
||||||
# permissions and limitations under the Licence.
|
|
||||||
#
|
|
||||||
# $Id: Makefile.inc 3 2012-01-15 16:26:07Z aneto $
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
#Subprojects w.r.t. the main directory only (important to allow setting SPBM as an export variable).
|
|
||||||
#If SPB is directly exported as an environment variable it will also be evaluated as part of the subprojects SPB, thus
|
|
||||||
#potentially overriding its value
|
|
||||||
#Main target subprojects. May be overridden by shell definition.
|
|
||||||
SPBM?=Source/Components/Interfaces.x
|
|
||||||
SPBMT?=Test.x
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#This really has to be defined locally.
|
|
||||||
SUBPROJMAIN=$(SPBM:%.x=%.spb)
|
|
||||||
SUBPROJMAINTEST=$(SPBMT:%.x=%.spb)
|
|
||||||
SUBPROJMAINCLEAN=$(SPBM:%.x=%.spc)
|
|
||||||
SUBPROJMAINTESTCLEAN=$(SPBMT:%.x=%.spc)
|
|
||||||
|
|
||||||
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
|
||||||
|
|
||||||
ROOT_DIR=.
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
|
||||||
|
|
||||||
all: $(OBJS) core test
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
compile_commands.json:
|
|
||||||
bear -- make -f Makefile.gcc
|
|
||||||
|
|
||||||
core: $(SUBPROJMAIN) check-env
|
|
||||||
echo $(SUBPROJMAIN)
|
|
||||||
|
|
||||||
test: $(SUBPROJMAINTEST)
|
|
||||||
echo $(SUBPROJMAINTEST)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
clean:: $(SUBPROJMAINCLEAN) $(SUBPROJMAINTESTCLEAN) clean_wipe_old
|
|
||||||
#clean:: $(SUBPROJMAINCLEAN) $(SUBPROJMAINTESTCLEAN) clean_wipe_old
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
check-marte:
|
|
||||||
ifndef MARTe2_DIR
|
|
||||||
$(error MARTe2_DIR is undefined)
|
|
||||||
endif
|
|
||||||
|
|
||||||
check-env:
|
|
||||||
ifndef MARTe2_DIR
|
|
||||||
$(error MARTe2_DIR is undefined)
|
|
||||||
endif
|
|
||||||
|
|
||||||
@@ -7,12 +7,15 @@ An interactive observability and debugging suite for the MARTe2 real-time framew
|
|||||||
### 1. Build the project
|
### 1. Build the project
|
||||||
```bash
|
```bash
|
||||||
. ./env.sh
|
. ./env.sh
|
||||||
make -f Makefile.gcc
|
cd Build
|
||||||
|
cmake ..
|
||||||
|
make -j$(nproc)
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Run Integration Tests
|
### 2. Run Integration Tests
|
||||||
```bash
|
```bash
|
||||||
./Build/x86-linux/Test/Integration/Integration/IntegrationTests.ex # Runs all tests
|
./Test/Integration/ValidationTest # Verifies 100Hz tracing
|
||||||
|
./Test/Integration/SchedulerTest # Verifies execution control
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Launch GUI
|
### 3. Launch GUI
|
||||||
|
|||||||
72
SPECS.md
72
SPECS.md
@@ -1,64 +1,50 @@
|
|||||||
# MARTe2 Debug Suite Specifications
|
# MARTe2 Debug Suite Specifications
|
||||||
|
|
||||||
**Version:** 1.2
|
## 1. Goal
|
||||||
**Status:** Active / Implemented
|
Implement a "Zero-Code-Change" observability layer for the MARTe2 real-time framework, providing live telemetry, signal forcing, and execution control without modifying existing application source code.
|
||||||
|
|
||||||
## 1. Executive Summary
|
## 2. Requirements
|
||||||
This project implements a "Zero-Code-Change" observability and debugging layer for the MARTe2 real-time framework. The system allows developers to Trace, Force, and Monitor any signal in a running MARTe2 application without modifying existing source code.
|
### 2.1 Functional Requirements (FR)
|
||||||
|
- **FR-01 (Discovery):** Discover the full MARTe2 object hierarchy at runtime.
|
||||||
## 2. System Architecture
|
- **FR-02 (Telemetry):** Stream high-frequency signal data (verified up to 100Hz) to a remote client.
|
||||||
- **The Universal Debug Service (C++ Core):** A singleton MARTe2 Object that patches the registry and manages communication.
|
|
||||||
- **The Broker Injection Layer (C++ Templates):** Templated wrappers that intercept `Execute()` and `Init()` calls for tracing, forcing, and execution control.
|
|
||||||
- **The Remote Analyser (Rust/egui):** A high-performance, multi-threaded GUI for visualization and control.
|
|
||||||
- **Network Stack:**
|
|
||||||
- **Port 8080 (TCP):** Commands and Metadata.
|
|
||||||
- **Port 8081 (UDP):** High-Speed Telemetry for Oscilloscope.
|
|
||||||
- **Port 8082 (TCP):** Independent Real-Time Log Stream via `TcpLogger`.
|
|
||||||
|
|
||||||
## 3. Requirements
|
|
||||||
|
|
||||||
### 3.1 Functional Requirements (FR)
|
|
||||||
- **FR-01 (Discovery):** Discover the full MARTe2 object hierarchy at runtime. The GUI client SHALL request the full application tree upon connection and display it in a hierarchical tree view.
|
|
||||||
- **FR-02 (Telemetry):** Stream high-frequency signal data (verified up to 100Hz+) to a remote client via UDP.
|
|
||||||
- **FR-03 (Forcing):** Allow manual override of signal values in memory during execution.
|
- **FR-03 (Forcing):** Allow manual override of signal values in memory during execution.
|
||||||
- **FR-04 (Logs):** Stream global framework logs to a dedicated terminal/client via a standalone `TcpLogger` service.
|
- **FR-04 (Logs):** Stream global framework logs to a dedicated terminal via a standalone `TcpLogger` service.
|
||||||
- **FR-05 (Log Filtering):** The client must support filtering logs by type (Debug, Information, Warning, FatalError) and by content using regular expressions.
|
- **FR-05 (Log Filtering):** The client must support filtering logs by type (Debug, Information, Warning, FatalError) and by content using regular expressions.
|
||||||
- **FR-06 (Execution Control):** Provide a mechanism to pause and resume the execution of all patched real-time threads (via Brokers), allowing for static inspection of the system state.
|
- **FR-06 (Execution & UI):**
|
||||||
- **FR-07 (Session Management):** Support runtime re-configuration and "Apply & Reconnect" logic. The GUI provides a "Disconnect" button to close active network streams.
|
- Provide a native GUI for visualization.
|
||||||
- **FR-08 (Decoupled Tracing):** Tracing activates telemetry; data is buffered and shown as a "Last Value" in the sidebar, but not plotted until manually assigned.
|
- Support Pause/Resume of real-time execution threads via scheduler injection.
|
||||||
- **FR-09 (Advanced Plotting):**
|
- **FR-07 (Session Management):**
|
||||||
|
- The top panel must provide a "Disconnect" button to close active network streams.
|
||||||
|
- Support runtime re-configuration and "Apply & Reconnect" logic.
|
||||||
|
- **FR-08 (Decoupled Tracing):**
|
||||||
|
Clicking `trace` activates telemetry; data is buffered and shown as a "Last Value" in the sidebar, but not plotted until manually assigned.
|
||||||
|
- **FR-08 (Advanced Plotting):**
|
||||||
- Support multiple plot panels with perfectly synchronized time (X) axes.
|
- Support multiple plot panels with perfectly synchronized time (X) axes.
|
||||||
- Drag-and-drop signals from the traced list into specific plots.
|
- Drag-and-drop signals from the traced list into specific plots.
|
||||||
|
- Automatic distinct color assignment for each signal added to a plot.
|
||||||
- Plot modes: Standard (Time Series) and Logic Analyzer (Stacked rows).
|
- Plot modes: Standard (Time Series) and Logic Analyzer (Stacked rows).
|
||||||
- Signal transformations: Gain, offset, units, and custom labels.
|
- Signal transformations: Gain, offset, units, and custom labels.
|
||||||
- **FR-10 (Navigation & Scope):**
|
- Visual styling: Deep customization of colors, line styles (Solid, Dashed, etc.), and marker shapes (Circle, Square, etc.).
|
||||||
|
- **FR-09 (Navigation):**
|
||||||
- Context menus for resetting zoom (X, Y, or both).
|
- Context menus for resetting zoom (X, Y, or both).
|
||||||
- "Fit to View" functionality that automatically scales both axes.
|
- "Fit to View" functionality that automatically scales both axes to encompass all available buffered data points.
|
||||||
|
- **FR-10 (Scope Mode):**
|
||||||
- High-performance oscilloscope mode with configurable time windows (10ms to 10s).
|
- High-performance oscilloscope mode with configurable time windows (10ms to 10s).
|
||||||
- Triggered acquisition (Single/Continuous, rising/falling edges).
|
- Global synchronization of time axes across all plot panels.
|
||||||
- **FR-11 (Data Recording):** Record any traced signal to disk in Parquet format with a visual recording indicator in the GUI.
|
- Support for Free-run and Triggered acquisition (Single/Continuous, rising/falling edges).
|
||||||
- **FR-12 (Configuration Awareness):** The DebugService SHALL store a complete copy of the application's configuration provided at initialization.
|
- **FR-11 (Data Recording):**
|
||||||
- **FR-13 (Metadata Enrichment):** Metadata returned by `INFO` and `DISCOVER` SHALL be enriched with additional fields from the stored configuration (e.g., Frequency, PVNames, Units).
|
- Record any traced signal to disk in Parquet format.
|
||||||
- **FR-14 (Configuration Serving):** Provide a `CONFIG` command to serve the full stored configuration in JSON format to the client.
|
- Native file dialog for destination selection.
|
||||||
|
- Visual recording indicator in the GUI.
|
||||||
|
|
||||||
### 3.2 Technical Constraints (TC)
|
### 2.2 Technical Constraints (TC)
|
||||||
- **TC-01:** No modifications allowed to the MARTe2 core library or component source code.
|
- **TC-01:** No modifications allowed to the MARTe2 core library or component source code.
|
||||||
- **TC-02:** Instrumentation must use Runtime Class Registry Patching.
|
- **TC-02:** Instrumentation must use Runtime Class Registry Patching.
|
||||||
- **TC-03:** Real-time threads must remain lock-free; use `FastPollingMutexSem` or atomic operations for synchronization.
|
- **TC-03:** Real-time threads must remain lock-free; use `FastPollingMutexSem` or atomic operations for synchronization.
|
||||||
- **TC-04:** Telemetry must be delivered via UDP to minimize impact on real-time jitter.
|
- **TC-04:** Telemetry must be delivered via UDP to minimize impact on real-time jitter.
|
||||||
|
|
||||||
## 4. Performance Metrics
|
## 3. Performance Metrics
|
||||||
- **Latency:** Telemetry dispatch overhead < 5 microseconds per signal.
|
- **Latency:** Telemetry dispatch overhead < 5 microseconds per signal.
|
||||||
- **Throughput:** Support for 100Hz+ sampling rates with zero packet loss on local networks.
|
- **Throughput:** Support for 100Hz+ sampling rates with zero packet loss on local networks.
|
||||||
- **Scalability:** Handle up to 4096 unique signals and 16 simultaneous client connections.
|
- **Scalability:** Handle up to 4096 unique signals and 16 simultaneous client connections.
|
||||||
- **Code Quality:** Maintain a minimum of **85% code coverage** across all core service and broker logic.
|
- **Code Quality:** Maintain a minimum of **85% code coverage** across all core service and broker logic.
|
||||||
|
|
||||||
## 5. Communication Protocol (Port 8080)
|
|
||||||
- **LS [Path]:** List nodes at the specified path.
|
|
||||||
- **TREE:** Returns a full recursive JSON structure representing the entire application tree.
|
|
||||||
- **INFO [Path]:** Returns detailed metadata for a specific node or signal.
|
|
||||||
- **PAUSE / RESUME:** Global execution control.
|
|
||||||
- **TRACE <Signal> <1/0> [Decimation]:** Enable/disable telemetry for a signal.
|
|
||||||
- **FORCE <Signal> <Value>:** Persistent signal override.
|
|
||||||
- **UNFORCE <Signal>:** Remove override.
|
|
||||||
- **LOG <Level> <Msg>:** Streaming format used on Port 8082.
|
|
||||||
|
|||||||
@@ -1,436 +0,0 @@
|
|||||||
#ifndef DEBUGBROKERWRAPPER_H
|
|
||||||
#define DEBUGBROKERWRAPPER_H
|
|
||||||
|
|
||||||
#include "BrokerI.h"
|
|
||||||
#include "DataSourceI.h"
|
|
||||||
#include "DebugService.h"
|
|
||||||
#include "FastPollingMutexSem.h"
|
|
||||||
#include "HighResolutionTimer.h"
|
|
||||||
#include "MemoryMapBroker.h"
|
|
||||||
#include "ObjectBuilder.h"
|
|
||||||
#include "ObjectRegistryDatabase.h"
|
|
||||||
#include "Vec.h"
|
|
||||||
|
|
||||||
// Original broker headers
|
|
||||||
#include "MemoryMapAsyncOutputBroker.h"
|
|
||||||
#include "MemoryMapAsyncTriggerOutputBroker.h"
|
|
||||||
#include "MemoryMapInputBroker.h"
|
|
||||||
#include "MemoryMapInterpolatedInputBroker.h"
|
|
||||||
#include "MemoryMapMultiBufferInputBroker.h"
|
|
||||||
#include "MemoryMapMultiBufferOutputBroker.h"
|
|
||||||
#include "MemoryMapOutputBroker.h"
|
|
||||||
#include "MemoryMapSynchronisedInputBroker.h"
|
|
||||||
#include "MemoryMapSynchronisedMultiBufferInputBroker.h"
|
|
||||||
#include "MemoryMapSynchronisedMultiBufferOutputBroker.h"
|
|
||||||
#include "MemoryMapSynchronisedOutputBroker.h"
|
|
||||||
|
|
||||||
namespace MARTe {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Helper for optimized signal processing within brokers.
|
|
||||||
*/
|
|
||||||
class DebugBrokerHelper {
|
|
||||||
public:
|
|
||||||
static void Process(DebugService *service,
|
|
||||||
DebugSignalInfo **signalInfoPointers,
|
|
||||||
Vec<uint32> &activeIndices, Vec<uint32> &activeSizes,
|
|
||||||
FastPollingMutexSem &activeMutex) {
|
|
||||||
if (service == NULL_PTR(DebugService *))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Re-establish break logic
|
|
||||||
while (service->IsPaused()) {
|
|
||||||
Sleep::MSec(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
activeMutex.FastLock();
|
|
||||||
uint32 n = activeIndices.Size();
|
|
||||||
if (n > 0 && signalInfoPointers != NULL_PTR(DebugSignalInfo **)) {
|
|
||||||
// Capture timestamp ONCE per broker cycle for lowest impact
|
|
||||||
uint64 ts = (uint64)((float64)HighResolutionTimer::Counter() *
|
|
||||||
HighResolutionTimer::Period() * 1000000.0);
|
|
||||||
|
|
||||||
for (uint32 i = 0; i < n; i++) {
|
|
||||||
uint32 idx = activeIndices[i];
|
|
||||||
uint32 size = activeSizes[i];
|
|
||||||
DebugSignalInfo *s = signalInfoPointers[idx];
|
|
||||||
if (s != NULL_PTR(DebugSignalInfo *)) {
|
|
||||||
service->ProcessSignal(s, size, ts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
activeMutex.FastUnLock();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pass numCopies explicitly so we can mock it
|
|
||||||
static void
|
|
||||||
InitSignals(BrokerI *broker, DataSourceI &dataSourceIn,
|
|
||||||
DebugService *&service, DebugSignalInfo **&signalInfoPointers,
|
|
||||||
uint32 numCopies, MemoryMapBrokerCopyTableEntry *copyTable,
|
|
||||||
const char8 *functionName, SignalDirection direction,
|
|
||||||
volatile bool *anyActiveFlag, Vec<uint32> *activeIndices,
|
|
||||||
Vec<uint32> *activeSizes, FastPollingMutexSem *activeMutex) {
|
|
||||||
if (numCopies > 0) {
|
|
||||||
signalInfoPointers = new DebugSignalInfo *[numCopies];
|
|
||||||
for (uint32 i = 0; i < numCopies; i++)
|
|
||||||
signalInfoPointers[i] = NULL_PTR(DebugSignalInfo *);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReferenceContainer *root = ObjectRegistryDatabase::Instance();
|
|
||||||
Reference serviceRef = root->Find("DebugService");
|
|
||||||
if (serviceRef.IsValid()) {
|
|
||||||
service = dynamic_cast<DebugService *>(serviceRef.operator->());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (service && (copyTable != NULL_PTR(MemoryMapBrokerCopyTableEntry *))) {
|
|
||||||
|
|
||||||
StreamString dsPath;
|
|
||||||
DebugService::GetFullObjectName(dataSourceIn, dsPath);
|
|
||||||
fprintf(stderr, ">> %s broker for %s [%d]\n",
|
|
||||||
direction == InputSignals ? "Input" : "Output", dsPath.Buffer(),
|
|
||||||
numCopies);
|
|
||||||
MemoryMapBroker *mmb = dynamic_cast<MemoryMapBroker *>(broker);
|
|
||||||
if (mmb == NULL_PTR(MemoryMapBroker *)) {
|
|
||||||
fprintf(stderr, ">> Impossible to get broker pointer!!\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint32 i = 0; i < numCopies; i++) {
|
|
||||||
void *addr = copyTable[i].dataSourcePointer;
|
|
||||||
TypeDescriptor type = copyTable[i].type;
|
|
||||||
|
|
||||||
uint32 dsIdx = i;
|
|
||||||
if (mmb != NULL_PTR(MemoryMapBroker *)) {
|
|
||||||
dsIdx = mmb->GetDSCopySignalIndex(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
StreamString signalName;
|
|
||||||
if (!dataSourceIn.GetSignalName(dsIdx, signalName))
|
|
||||||
signalName = "Unknown";
|
|
||||||
fprintf(stderr, ">> registering %s.%s [%p]\n", dsPath.Buffer(),
|
|
||||||
signalName.Buffer(), mmb);
|
|
||||||
|
|
||||||
// Register canonical name
|
|
||||||
StreamString dsFullName;
|
|
||||||
dsFullName.Printf("%s.%s", dsPath.Buffer(), signalName.Buffer());
|
|
||||||
service->RegisterSignal(addr, type, dsFullName.Buffer());
|
|
||||||
|
|
||||||
// Register alias
|
|
||||||
if (functionName != NULL_PTR(const char8 *)) {
|
|
||||||
StreamString gamFullName;
|
|
||||||
const char8 *dirStr =
|
|
||||||
(direction == InputSignals) ? "InputSignals" : "OutputSignals";
|
|
||||||
const char8 *dirStrShort = (direction == InputSignals) ? "In" : "Out";
|
|
||||||
|
|
||||||
// Try to find the GAM with different path variations
|
|
||||||
Reference gamRef =
|
|
||||||
ObjectRegistryDatabase::Instance()->Find(functionName);
|
|
||||||
if (!gamRef.IsValid()) {
|
|
||||||
// Try with "App.Functions." prefix
|
|
||||||
StreamString tryPath;
|
|
||||||
tryPath.Printf("App.Functions.%s", functionName);
|
|
||||||
gamRef = ObjectRegistryDatabase::Instance()->Find(tryPath.Buffer());
|
|
||||||
}
|
|
||||||
if (!gamRef.IsValid()) {
|
|
||||||
// Try with "Functions." prefix
|
|
||||||
StreamString tryPath;
|
|
||||||
tryPath.Printf("Functions.%s", functionName);
|
|
||||||
gamRef = ObjectRegistryDatabase::Instance()->Find(tryPath.Buffer());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gamRef.IsValid()) {
|
|
||||||
StreamString absGamPath;
|
|
||||||
DebugService::GetFullObjectName(*(gamRef.operator->()), absGamPath);
|
|
||||||
// Register full path (InputSignals/OutputSignals)
|
|
||||||
// gamFullName.fPrintf(stderr, "%s.%s.%s", absGamPath.Buffer(),
|
|
||||||
// dirStr, signalName.Buffer()); signalInfoPointers[i] =
|
|
||||||
// service->RegisterSignal(addr, type, gamFullName.Buffer()); Also
|
|
||||||
// register short path (In/Out) for GUI compatibility
|
|
||||||
gamFullName.Printf("%s.%s.%s", absGamPath.Buffer(), dirStrShort,
|
|
||||||
signalName.Buffer());
|
|
||||||
signalInfoPointers[i] =
|
|
||||||
service->RegisterSignal(addr, type, gamFullName.Buffer());
|
|
||||||
} else {
|
|
||||||
// Fallback to short name
|
|
||||||
// gamFullName.fPrintf(stderr, "%s.%s.%s", functionName, dirStr,
|
|
||||||
// signalName.Buffer()); signalInfoPointers[i] =
|
|
||||||
// service->RegisterSignal(addr, type, gamFullName.Buffer()); Also
|
|
||||||
// register short form
|
|
||||||
gamFullName.Printf("%s.%s.%s", functionName, dirStrShort,
|
|
||||||
signalName.Buffer());
|
|
||||||
signalInfoPointers[i] =
|
|
||||||
service->RegisterSignal(addr, type, gamFullName.Buffer());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
signalInfoPointers[i] =
|
|
||||||
service->RegisterSignal(addr, type, dsFullName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Register broker in DebugService for optimized control
|
|
||||||
service->RegisterBroker(signalInfoPointers, numCopies, mmb, anyActiveFlag,
|
|
||||||
activeIndices, activeSizes, activeMutex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Template class to instrument any MARTe2 Broker.
|
|
||||||
*/
|
|
||||||
template <typename BaseClass> class DebugBrokerWrapper : public BaseClass {
|
|
||||||
public:
|
|
||||||
DebugBrokerWrapper() : BaseClass() {
|
|
||||||
service = NULL_PTR(DebugService *);
|
|
||||||
signalInfoPointers = NULL_PTR(DebugSignalInfo **);
|
|
||||||
numSignals = 0;
|
|
||||||
anyActive = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~DebugBrokerWrapper() {
|
|
||||||
if (signalInfoPointers)
|
|
||||||
delete[] signalInfoPointers;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool Execute() {
|
|
||||||
bool ret = BaseClass::Execute();
|
|
||||||
if (ret && (anyActive || (service && service->IsPaused()))) {
|
|
||||||
DebugBrokerHelper::Process(service, signalInfoPointers, activeIndices,
|
|
||||||
activeSizes, activeMutex);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool Init(SignalDirection direction, DataSourceI &ds,
|
|
||||||
const char8 *const name, void *gamMem) {
|
|
||||||
bool ret = BaseClass::Init(direction, ds, name, gamMem);
|
|
||||||
fprintf(stderr, ">> INIT BROKER %s %s\n", name,
|
|
||||||
direction == InputSignals ? "In" : "Out");
|
|
||||||
if (ret) {
|
|
||||||
numSignals = this->GetNumberOfCopies();
|
|
||||||
DebugBrokerHelper::InitSignals(this, ds, service, signalInfoPointers,
|
|
||||||
numSignals, this->copyTable, name,
|
|
||||||
direction, &anyActive, &activeIndices,
|
|
||||||
&activeSizes, &activeMutex);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool Init(SignalDirection direction, DataSourceI &ds,
|
|
||||||
const char8 *const name, void *gamMem, const bool optim) {
|
|
||||||
bool ret = BaseClass::Init(direction, ds, name, gamMem, false);
|
|
||||||
fprintf(stderr, ">> INIT optimized BROKER %s %s\n", name,
|
|
||||||
direction == InputSignals ? "In" : "Out");
|
|
||||||
if (ret) {
|
|
||||||
numSignals = this->GetNumberOfCopies();
|
|
||||||
DebugBrokerHelper::InitSignals(this, ds, service, signalInfoPointers,
|
|
||||||
numSignals, this->copyTable, name,
|
|
||||||
direction, &anyActive, &activeIndices,
|
|
||||||
&activeSizes, &activeMutex);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugService *service;
|
|
||||||
DebugSignalInfo **signalInfoPointers;
|
|
||||||
uint32 numSignals;
|
|
||||||
volatile bool anyActive;
|
|
||||||
Vec<uint32> activeIndices;
|
|
||||||
Vec<uint32> activeSizes;
|
|
||||||
FastPollingMutexSem activeMutex;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename BaseClass>
|
|
||||||
class DebugBrokerWrapperNoOptim : public BaseClass {
|
|
||||||
public:
|
|
||||||
DebugBrokerWrapperNoOptim() : BaseClass() {
|
|
||||||
service = NULL_PTR(DebugService *);
|
|
||||||
signalInfoPointers = NULL_PTR(DebugSignalInfo **);
|
|
||||||
numSignals = 0;
|
|
||||||
anyActive = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~DebugBrokerWrapperNoOptim() {
|
|
||||||
if (signalInfoPointers)
|
|
||||||
delete[] signalInfoPointers;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool Execute() {
|
|
||||||
bool ret = BaseClass::Execute();
|
|
||||||
if (ret && (anyActive || (service && service->IsPaused()))) {
|
|
||||||
DebugBrokerHelper::Process(service, signalInfoPointers, activeIndices,
|
|
||||||
activeSizes, activeMutex);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool Init(SignalDirection direction, DataSourceI &ds,
|
|
||||||
const char8 *const name, void *gamMem) {
|
|
||||||
bool ret = BaseClass::Init(direction, ds, name, gamMem);
|
|
||||||
if (ret) {
|
|
||||||
numSignals = this->GetNumberOfCopies();
|
|
||||||
DebugBrokerHelper::InitSignals(this, ds, service, signalInfoPointers,
|
|
||||||
numSignals, this->copyTable, name,
|
|
||||||
direction, &anyActive, &activeIndices,
|
|
||||||
&activeSizes, &activeMutex);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugService *service;
|
|
||||||
DebugSignalInfo **signalInfoPointers;
|
|
||||||
uint32 numSignals;
|
|
||||||
volatile bool anyActive;
|
|
||||||
Vec<uint32> activeIndices;
|
|
||||||
Vec<uint32> activeSizes;
|
|
||||||
FastPollingMutexSem activeMutex;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DebugMemoryMapAsyncOutputBroker : public MemoryMapAsyncOutputBroker {
|
|
||||||
public:
|
|
||||||
DebugMemoryMapAsyncOutputBroker() : MemoryMapAsyncOutputBroker() {
|
|
||||||
service = NULL_PTR(DebugService *);
|
|
||||||
signalInfoPointers = NULL_PTR(DebugSignalInfo **);
|
|
||||||
numSignals = 0;
|
|
||||||
anyActive = false;
|
|
||||||
}
|
|
||||||
virtual ~DebugMemoryMapAsyncOutputBroker() {
|
|
||||||
if (signalInfoPointers)
|
|
||||||
delete[] signalInfoPointers;
|
|
||||||
}
|
|
||||||
virtual bool Execute() {
|
|
||||||
bool ret = MemoryMapAsyncOutputBroker::Execute();
|
|
||||||
if (ret && (anyActive || (service && service->IsPaused()))) {
|
|
||||||
DebugBrokerHelper::Process(service, signalInfoPointers, activeIndices,
|
|
||||||
activeSizes, activeMutex);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
virtual bool InitWithBufferParameters(const SignalDirection direction,
|
|
||||||
DataSourceI &dataSourceIn,
|
|
||||||
const char8 *const functionName,
|
|
||||||
void *const gamMemoryAddress,
|
|
||||||
const uint32 numberOfBuffersIn,
|
|
||||||
const ProcessorType &cpuMaskIn,
|
|
||||||
const uint32 stackSizeIn) {
|
|
||||||
bool ret = MemoryMapAsyncOutputBroker::InitWithBufferParameters(
|
|
||||||
direction, dataSourceIn, functionName, gamMemoryAddress,
|
|
||||||
numberOfBuffersIn, cpuMaskIn, stackSizeIn);
|
|
||||||
if (ret) {
|
|
||||||
numSignals = this->GetNumberOfCopies();
|
|
||||||
DebugBrokerHelper::InitSignals(
|
|
||||||
this, dataSourceIn, service, signalInfoPointers, numSignals,
|
|
||||||
this->copyTable, functionName, direction, &anyActive, &activeIndices,
|
|
||||||
&activeSizes, &activeMutex);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
DebugService *service;
|
|
||||||
DebugSignalInfo **signalInfoPointers;
|
|
||||||
uint32 numSignals;
|
|
||||||
volatile bool anyActive;
|
|
||||||
Vec<uint32> activeIndices;
|
|
||||||
Vec<uint32> activeSizes;
|
|
||||||
FastPollingMutexSem activeMutex;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DebugMemoryMapAsyncTriggerOutputBroker
|
|
||||||
: public MemoryMapAsyncTriggerOutputBroker {
|
|
||||||
public:
|
|
||||||
DebugMemoryMapAsyncTriggerOutputBroker()
|
|
||||||
: MemoryMapAsyncTriggerOutputBroker() {
|
|
||||||
service = NULL_PTR(DebugService *);
|
|
||||||
signalInfoPointers = NULL_PTR(DebugSignalInfo **);
|
|
||||||
numSignals = 0;
|
|
||||||
anyActive = false;
|
|
||||||
}
|
|
||||||
virtual ~DebugMemoryMapAsyncTriggerOutputBroker() {
|
|
||||||
if (signalInfoPointers)
|
|
||||||
delete[] signalInfoPointers;
|
|
||||||
}
|
|
||||||
virtual bool Execute() {
|
|
||||||
bool ret = MemoryMapAsyncTriggerOutputBroker::Execute();
|
|
||||||
if (ret && (anyActive || (service && service->IsPaused()))) {
|
|
||||||
DebugBrokerHelper::Process(service, signalInfoPointers, activeIndices,
|
|
||||||
activeSizes, activeMutex);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
virtual bool InitWithTriggerParameters(
|
|
||||||
const SignalDirection direction, DataSourceI &dataSourceIn,
|
|
||||||
const char8 *const functionName, void *const gamMemoryAddress,
|
|
||||||
const uint32 numberOfBuffersIn, const uint32 preTriggerBuffersIn,
|
|
||||||
const uint32 postTriggerBuffersIn, const ProcessorType &cpuMaskIn,
|
|
||||||
const uint32 stackSizeIn) {
|
|
||||||
bool ret = MemoryMapAsyncTriggerOutputBroker::InitWithTriggerParameters(
|
|
||||||
direction, dataSourceIn, functionName, gamMemoryAddress,
|
|
||||||
numberOfBuffersIn, preTriggerBuffersIn, postTriggerBuffersIn, cpuMaskIn,
|
|
||||||
stackSizeIn);
|
|
||||||
if (ret) {
|
|
||||||
numSignals = this->GetNumberOfCopies();
|
|
||||||
DebugBrokerHelper::InitSignals(
|
|
||||||
this, dataSourceIn, service, signalInfoPointers, numSignals,
|
|
||||||
this->copyTable, functionName, direction, &anyActive, &activeIndices,
|
|
||||||
&activeSizes, &activeMutex);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
DebugService *service;
|
|
||||||
DebugSignalInfo **signalInfoPointers;
|
|
||||||
uint32 numSignals;
|
|
||||||
volatile bool anyActive;
|
|
||||||
Vec<uint32> activeIndices;
|
|
||||||
Vec<uint32> activeSizes;
|
|
||||||
FastPollingMutexSem activeMutex;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T> class DebugBrokerBuilder : public ObjectBuilder {
|
|
||||||
public:
|
|
||||||
virtual Object *Build(HeapI *const heap) const { return new (heap) T(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef DebugBrokerWrapper<MemoryMapInputBroker> DebugMemoryMapInputBroker;
|
|
||||||
// LCOV_EXCL_START
|
|
||||||
typedef DebugBrokerWrapper<MemoryMapOutputBroker> DebugMemoryMapOutputBroker;
|
|
||||||
typedef DebugBrokerWrapper<MemoryMapSynchronisedInputBroker>
|
|
||||||
DebugMemoryMapSynchronisedInputBroker;
|
|
||||||
typedef DebugBrokerWrapper<MemoryMapSynchronisedOutputBroker>
|
|
||||||
DebugMemoryMapSynchronisedOutputBroker;
|
|
||||||
typedef DebugBrokerWrapperNoOptim<MemoryMapInterpolatedInputBroker>
|
|
||||||
DebugMemoryMapInterpolatedInputBroker;
|
|
||||||
typedef DebugBrokerWrapper<MemoryMapMultiBufferInputBroker>
|
|
||||||
DebugMemoryMapMultiBufferInputBroker;
|
|
||||||
typedef DebugBrokerWrapper<MemoryMapMultiBufferOutputBroker>
|
|
||||||
DebugMemoryMapMultiBufferOutputBroker;
|
|
||||||
typedef DebugBrokerWrapper<MemoryMapSynchronisedMultiBufferInputBroker>
|
|
||||||
DebugMemoryMapSynchronisedMultiBufferInputBroker;
|
|
||||||
typedef DebugBrokerWrapper<MemoryMapSynchronisedMultiBufferOutputBroker>
|
|
||||||
DebugMemoryMapSynchronisedMultiBufferOutputBroker;
|
|
||||||
// LCOV_EXCL_STOP
|
|
||||||
|
|
||||||
typedef DebugBrokerBuilder<DebugMemoryMapInputBroker>
|
|
||||||
DebugMemoryMapInputBrokerBuilder;
|
|
||||||
// LCOV_EXCL_START
|
|
||||||
typedef DebugBrokerBuilder<DebugMemoryMapOutputBroker>
|
|
||||||
DebugMemoryMapOutputBrokerBuilder;
|
|
||||||
typedef DebugBrokerBuilder<DebugMemoryMapSynchronisedInputBroker>
|
|
||||||
DebugMemoryMapSynchronisedInputBrokerBuilder;
|
|
||||||
typedef DebugBrokerBuilder<DebugMemoryMapSynchronisedOutputBroker>
|
|
||||||
DebugMemoryMapSynchronisedOutputBrokerBuilder;
|
|
||||||
typedef DebugBrokerBuilder<DebugMemoryMapInterpolatedInputBroker>
|
|
||||||
DebugMemoryMapInterpolatedInputBrokerBuilder;
|
|
||||||
typedef DebugBrokerBuilder<DebugMemoryMapMultiBufferInputBroker>
|
|
||||||
DebugMemoryMapMultiBufferInputBrokerBuilder;
|
|
||||||
typedef DebugBrokerBuilder<DebugMemoryMapMultiBufferOutputBroker>
|
|
||||||
DebugMemoryMapMultiBufferOutputBrokerBuilder;
|
|
||||||
typedef DebugBrokerBuilder<DebugMemoryMapSynchronisedMultiBufferInputBroker>
|
|
||||||
DebugMemoryMapSynchronisedMultiBufferInputBrokerBuilder;
|
|
||||||
typedef DebugBrokerBuilder<DebugMemoryMapSynchronisedMultiBufferOutputBroker>
|
|
||||||
DebugMemoryMapSynchronisedMultiBufferOutputBrokerBuilder;
|
|
||||||
typedef DebugBrokerBuilder<DebugMemoryMapAsyncOutputBroker>
|
|
||||||
DebugMemoryMapAsyncOutputBrokerBuilder;
|
|
||||||
typedef DebugBrokerBuilder<DebugMemoryMapAsyncTriggerOutputBroker>
|
|
||||||
DebugMemoryMapAsyncTriggerOutputBrokerBuilder;
|
|
||||||
// LCOV_EXCL_STOP
|
|
||||||
|
|
||||||
} // namespace MARTe
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,972 +0,0 @@
|
|||||||
#include "BasicTCPSocket.h"
|
|
||||||
#include "ClassRegistryItem.h"
|
|
||||||
#include "ConfigurationDatabase.h"
|
|
||||||
#include "DebugBrokerWrapper.h"
|
|
||||||
#include "DebugService.h"
|
|
||||||
#include "GAM.h"
|
|
||||||
#include "HighResolutionTimer.h"
|
|
||||||
#include "ObjectBuilder.h"
|
|
||||||
#include "ObjectRegistryDatabase.h"
|
|
||||||
#include "StreamString.h"
|
|
||||||
#include "TimeoutType.h"
|
|
||||||
#include "TypeConversion.h"
|
|
||||||
|
|
||||||
namespace MARTe {
|
|
||||||
|
|
||||||
DebugService *DebugService::instance = (DebugService *)0;
|
|
||||||
|
|
||||||
static void EscapeJson(const char8 *src, StreamString &dst) {
|
|
||||||
if (src == NULL_PTR(const char8 *))
|
|
||||||
return;
|
|
||||||
while (*src != '\0') {
|
|
||||||
if (*src == '"')
|
|
||||||
dst += "\\\"";
|
|
||||||
else if (*src == '\\')
|
|
||||||
dst += "\\\\";
|
|
||||||
else if (*src == '\n')
|
|
||||||
dst += "\\n";
|
|
||||||
else if (*src == '\r')
|
|
||||||
dst += "\\r";
|
|
||||||
else if (*src == '\t')
|
|
||||||
dst += "\\t";
|
|
||||||
else
|
|
||||||
dst += *src;
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool SuffixMatch(const char8 *target, const char8 *pattern) {
|
|
||||||
uint32 tLen = StringHelper::Length(target);
|
|
||||||
uint32 pLen = StringHelper::Length(pattern);
|
|
||||||
if (pLen > tLen)
|
|
||||||
return false;
|
|
||||||
const char8 *suffix = target + (tLen - pLen);
|
|
||||||
if (StringHelper::Compare(suffix, pattern) == 0) {
|
|
||||||
if (tLen == pLen || *(suffix - 1) == '.')
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool FindPathInContainer(ReferenceContainer *container,
|
|
||||||
const Object *target, StreamString &path) {
|
|
||||||
if (container == NULL_PTR(ReferenceContainer *))
|
|
||||||
return false;
|
|
||||||
uint32 n = container->Size();
|
|
||||||
for (uint32 i = 0u; i < n; i++) {
|
|
||||||
Reference ref = container->Get(i);
|
|
||||||
if (ref.IsValid()) {
|
|
||||||
if (ref.operator->() == target) {
|
|
||||||
path = ref->GetName();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
ReferenceContainer *sub =
|
|
||||||
dynamic_cast<ReferenceContainer *>(ref.operator->());
|
|
||||||
if (sub != NULL_PTR(ReferenceContainer *)) {
|
|
||||||
if (FindPathInContainer(sub, target, path)) {
|
|
||||||
StreamString full;
|
|
||||||
full.Printf("%s.%s", ref->GetName(), path.Buffer());
|
|
||||||
path = full;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(DebugService, "1.0")
|
|
||||||
|
|
||||||
DebugService::DebugService()
|
|
||||||
: ReferenceContainer(), EmbeddedServiceMethodBinderI(),
|
|
||||||
binderServer(this, ServiceBinder::ServerType),
|
|
||||||
binderStreamer(this, ServiceBinder::StreamerType),
|
|
||||||
threadService(binderServer), streamerService(binderStreamer) {
|
|
||||||
controlPort = 0;
|
|
||||||
streamPort = 8081;
|
|
||||||
streamIP = "127.0.0.1";
|
|
||||||
isServer = false;
|
|
||||||
suppressTimeoutLogs = true;
|
|
||||||
isPaused = false;
|
|
||||||
activeClient = NULL_PTR(BasicTCPSocket *);
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugService::~DebugService() {
|
|
||||||
if (instance == this) {
|
|
||||||
instance = NULL_PTR(DebugService *);
|
|
||||||
}
|
|
||||||
threadService.Stop();
|
|
||||||
streamerService.Stop();
|
|
||||||
tcpServer.Close();
|
|
||||||
udpSocket.Close();
|
|
||||||
if (activeClient != NULL_PTR(BasicTCPSocket *)) {
|
|
||||||
activeClient->Close();
|
|
||||||
delete activeClient;
|
|
||||||
}
|
|
||||||
for (uint32 i = 0; i < signals.Size(); i++) {
|
|
||||||
delete signals[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DebugService::Initialise(StructuredDataI &data) {
|
|
||||||
if (!ReferenceContainer::Initialise(data))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint32 port = 0;
|
|
||||||
if (data.Read("ControlPort", port)) {
|
|
||||||
controlPort = (uint16)port;
|
|
||||||
} else {
|
|
||||||
(void)data.Read("TcpPort", port);
|
|
||||||
controlPort = (uint16)port;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (controlPort > 0) {
|
|
||||||
isServer = true;
|
|
||||||
instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
port = 8081;
|
|
||||||
if (data.Read("StreamPort", port)) {
|
|
||||||
streamPort = (uint16)port;
|
|
||||||
} else {
|
|
||||||
(void)data.Read("UdpPort", port);
|
|
||||||
streamPort = (uint16)port;
|
|
||||||
}
|
|
||||||
StreamString tempIP;
|
|
||||||
if (data.Read("StreamIP", tempIP)) {
|
|
||||||
streamIP = tempIP;
|
|
||||||
} else {
|
|
||||||
streamIP = "127.0.0.1";
|
|
||||||
}
|
|
||||||
uint32 suppress = 1;
|
|
||||||
if (data.Read("SuppressTimeoutLogs", suppress)) {
|
|
||||||
suppressTimeoutLogs = (suppress == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to capture full configuration autonomously if data is a
|
|
||||||
// ConfigurationDatabase
|
|
||||||
ConfigurationDatabase *cdb = dynamic_cast<ConfigurationDatabase *>(&data);
|
|
||||||
if (cdb != NULL_PTR(ConfigurationDatabase *)) {
|
|
||||||
// Save current position
|
|
||||||
StreamString currentPath;
|
|
||||||
// In MARTe2 ConfigurationDatabase there isn't a direct GetCurrentPath,
|
|
||||||
// but we can at least try to copy from root if we are at root.
|
|
||||||
// For now, we rely on explicit SetFullConfig or documentary injection.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy local branch as fallback
|
|
||||||
(void)data.Copy(fullConfig);
|
|
||||||
|
|
||||||
if (isServer) {
|
|
||||||
if (!traceBuffer.Init(8 * 1024 * 1024))
|
|
||||||
return false;
|
|
||||||
PatchRegistry();
|
|
||||||
ConfigurationDatabase threadData;
|
|
||||||
threadData.Write("Timeout", (uint32)1000);
|
|
||||||
threadService.Initialise(threadData);
|
|
||||||
streamerService.Initialise(threadData);
|
|
||||||
if (!tcpServer.Open())
|
|
||||||
return false;
|
|
||||||
if (!tcpServer.Listen(controlPort))
|
|
||||||
return false;
|
|
||||||
if (!udpSocket.Open())
|
|
||||||
return false;
|
|
||||||
if (threadService.Start() != ErrorManagement::NoError)
|
|
||||||
return false;
|
|
||||||
if (streamerService.Start() != ErrorManagement::NoError)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugService::SetFullConfig(ConfigurationDatabase &config) {
|
|
||||||
config.MoveToRoot();
|
|
||||||
config.Copy(fullConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void PatchItemInternal(const char8 *originalName,
|
|
||||||
ObjectBuilder *debugBuilder) {
|
|
||||||
ClassRegistryItem *item =
|
|
||||||
ClassRegistryDatabase::Instance()->Find(originalName);
|
|
||||||
if (item != NULL_PTR(ClassRegistryItem *)) {
|
|
||||||
item->SetObjectBuilder(debugBuilder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugService::PatchRegistry() {
|
|
||||||
DebugMemoryMapInputBrokerBuilder *b1 = new DebugMemoryMapInputBrokerBuilder();
|
|
||||||
PatchItemInternal("MemoryMapInputBroker", b1);
|
|
||||||
DebugMemoryMapOutputBrokerBuilder *b2 =
|
|
||||||
new DebugMemoryMapOutputBrokerBuilder();
|
|
||||||
PatchItemInternal("MemoryMapOutputBroker", b2);
|
|
||||||
DebugMemoryMapSynchronisedInputBrokerBuilder *b3 =
|
|
||||||
new DebugMemoryMapSynchronisedInputBrokerBuilder();
|
|
||||||
PatchItemInternal("MemoryMapSynchronisedInputBroker", b3);
|
|
||||||
DebugMemoryMapSynchronisedOutputBrokerBuilder *b4 =
|
|
||||||
new DebugMemoryMapSynchronisedOutputBrokerBuilder();
|
|
||||||
PatchItemInternal("MemoryMapSynchronisedOutputBroker", b4);
|
|
||||||
DebugMemoryMapInterpolatedInputBrokerBuilder *b5 =
|
|
||||||
new DebugMemoryMapInterpolatedInputBrokerBuilder();
|
|
||||||
PatchItemInternal("MemoryMapInterpolatedInputBroker", b5);
|
|
||||||
DebugMemoryMapMultiBufferInputBrokerBuilder *b6 =
|
|
||||||
new DebugMemoryMapMultiBufferInputBrokerBuilder();
|
|
||||||
PatchItemInternal("MemoryMapMultiBufferInputBroker", b6);
|
|
||||||
DebugMemoryMapMultiBufferOutputBrokerBuilder *b7 =
|
|
||||||
new DebugMemoryMapMultiBufferOutputBrokerBuilder();
|
|
||||||
PatchItemInternal("MemoryMapMultiBufferOutputBroker", b7);
|
|
||||||
DebugMemoryMapSynchronisedMultiBufferInputBrokerBuilder *b8 =
|
|
||||||
new DebugMemoryMapSynchronisedMultiBufferInputBrokerBuilder();
|
|
||||||
PatchItemInternal("MemoryMapSynchronisedMultiBufferInputBroker", b8);
|
|
||||||
DebugMemoryMapSynchronisedMultiBufferOutputBrokerBuilder *b9 =
|
|
||||||
new DebugMemoryMapSynchronisedMultiBufferOutputBrokerBuilder();
|
|
||||||
PatchItemInternal("MemoryMapSynchronisedMultiBufferOutputBroker", b9);
|
|
||||||
DebugMemoryMapAsyncOutputBrokerBuilder *b10 =
|
|
||||||
new DebugMemoryMapAsyncOutputBrokerBuilder();
|
|
||||||
PatchItemInternal("MemoryMapAsyncOutputBroker", b10);
|
|
||||||
DebugMemoryMapAsyncTriggerOutputBrokerBuilder *b11 =
|
|
||||||
new DebugMemoryMapAsyncTriggerOutputBrokerBuilder();
|
|
||||||
PatchItemInternal("MemoryMapAsyncTriggerOutputBroker", b11);
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugSignalInfo *DebugService::RegisterSignal(void *memoryAddress,
|
|
||||||
TypeDescriptor type,
|
|
||||||
const char8 *name) {
|
|
||||||
printf("<debug> registering: %s\n", name);
|
|
||||||
mutex.FastLock();
|
|
||||||
DebugSignalInfo *res = NULL_PTR(DebugSignalInfo *);
|
|
||||||
uint32 sigIdx = 0xFFFFFFFF;
|
|
||||||
for (uint32 i = 0; i < signals.Size(); i++) {
|
|
||||||
if (signals[i]->memoryAddress == memoryAddress) {
|
|
||||||
res = signals[i];
|
|
||||||
sigIdx = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (res == NULL_PTR(DebugSignalInfo *)) {
|
|
||||||
sigIdx = signals.Size();
|
|
||||||
res = new DebugSignalInfo();
|
|
||||||
res->memoryAddress = memoryAddress;
|
|
||||||
res->type = type;
|
|
||||||
res->name = name;
|
|
||||||
res->isTracing = false;
|
|
||||||
res->isForcing = false;
|
|
||||||
res->internalID = sigIdx;
|
|
||||||
res->decimationFactor = 1;
|
|
||||||
res->decimationCounter = 0;
|
|
||||||
signals.Push(res);
|
|
||||||
}
|
|
||||||
if (sigIdx != 0xFFFFFFFF) {
|
|
||||||
bool foundAlias = false;
|
|
||||||
for (uint32 i = 0; i < aliases.Size(); i++) {
|
|
||||||
if (aliases[i].name == name) {
|
|
||||||
foundAlias = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!foundAlias) {
|
|
||||||
SignalAlias a;
|
|
||||||
a.name = name;
|
|
||||||
a.signalIndex = sigIdx;
|
|
||||||
aliases.Push(a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mutex.FastUnLock();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugService::ProcessSignal(DebugSignalInfo *signalInfo, uint32 size,
|
|
||||||
uint64 timestamp) {
|
|
||||||
if (signalInfo == NULL_PTR(DebugSignalInfo *))
|
|
||||||
return;
|
|
||||||
if (signalInfo->isForcing) {
|
|
||||||
memcpy(signalInfo->memoryAddress, signalInfo->forcedValue, size);
|
|
||||||
}
|
|
||||||
if (signalInfo->isTracing) {
|
|
||||||
if (signalInfo->decimationCounter == 0) {
|
|
||||||
traceBuffer.Push(signalInfo->internalID, timestamp,
|
|
||||||
(uint8 *)signalInfo->memoryAddress, size);
|
|
||||||
}
|
|
||||||
signalInfo->decimationCounter =
|
|
||||||
(signalInfo->decimationCounter + 1) % signalInfo->decimationFactor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugService::RegisterBroker(DebugSignalInfo **signalPointers,
|
|
||||||
uint32 numSignals, MemoryMapBroker *broker,
|
|
||||||
volatile bool *anyActiveFlag,
|
|
||||||
Vec<uint32> *activeIndices,
|
|
||||||
Vec<uint32> *activeSizes,
|
|
||||||
FastPollingMutexSem *activeMutex) {
|
|
||||||
mutex.FastLock();
|
|
||||||
BrokerInfo b;
|
|
||||||
b.signalPointers = signalPointers;
|
|
||||||
b.numSignals = numSignals;
|
|
||||||
b.broker = broker;
|
|
||||||
b.anyActiveFlag = anyActiveFlag;
|
|
||||||
b.activeIndices = activeIndices;
|
|
||||||
b.activeSizes = activeSizes;
|
|
||||||
b.activeMutex = activeMutex;
|
|
||||||
brokers.Push(b);
|
|
||||||
mutex.FastUnLock();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugService::UpdateBrokersActiveStatus() {
|
|
||||||
for (uint32 i = 0; i < brokers.Size(); i++) {
|
|
||||||
uint32 count = 0;
|
|
||||||
for (uint32 j = 0; j < brokers[i].numSignals; j++) {
|
|
||||||
DebugSignalInfo *s = brokers[i].signalPointers[j];
|
|
||||||
if (s != NULL_PTR(DebugSignalInfo *) && (s->isTracing || s->isForcing)) {
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Vec<uint32> tempInd;
|
|
||||||
Vec<uint32> tempSizes;
|
|
||||||
for (uint32 j = 0; j < brokers[i].numSignals; j++) {
|
|
||||||
DebugSignalInfo *s = brokers[i].signalPointers[j];
|
|
||||||
if (s != NULL_PTR(DebugSignalInfo *) && (s->isTracing || s->isForcing)) {
|
|
||||||
tempInd.Push(j);
|
|
||||||
tempSizes.Push((brokers[i].broker != NULL_PTR(MemoryMapBroker *))
|
|
||||||
? brokers[i].broker->GetCopyByteSize(j)
|
|
||||||
: 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (brokers[i].activeMutex)
|
|
||||||
brokers[i].activeMutex->FastLock();
|
|
||||||
|
|
||||||
if (brokers[i].activeIndices)
|
|
||||||
*(brokers[i].activeIndices) = tempInd;
|
|
||||||
if (brokers[i].activeSizes)
|
|
||||||
*(brokers[i].activeSizes) = tempSizes;
|
|
||||||
if (brokers[i].anyActiveFlag)
|
|
||||||
*(brokers[i].anyActiveFlag) = (count > 0);
|
|
||||||
|
|
||||||
if (brokers[i].activeMutex)
|
|
||||||
brokers[i].activeMutex->FastUnLock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorManagement::ErrorType DebugService::Execute(ExecutionInfo &info) {
|
|
||||||
return ErrorManagement::FatalError;
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorManagement::ErrorType DebugService::Server(ExecutionInfo &info) {
|
|
||||||
if (info.GetStage() == ExecutionInfo::TerminationStage)
|
|
||||||
return ErrorManagement::NoError;
|
|
||||||
if (info.GetStage() == ExecutionInfo::StartupStage) {
|
|
||||||
serverThreadId = Threads::Id();
|
|
||||||
return ErrorManagement::NoError;
|
|
||||||
}
|
|
||||||
while (info.GetStage() == ExecutionInfo::MainStage) {
|
|
||||||
while (activeClient == NULL_PTR(BasicTCPSocket *)) {
|
|
||||||
BasicTCPSocket *newClient = tcpServer.WaitConnection(TTInfiniteWait);
|
|
||||||
if (newClient != NULL_PTR(BasicTCPSocket *)) {
|
|
||||||
// Single connection mode: disconnect any existing client first
|
|
||||||
activeClient = newClient;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Single connection mode: only check client 0
|
|
||||||
{
|
|
||||||
if (activeClient != NULL_PTR(BasicTCPSocket *)) {
|
|
||||||
// Check if client is still connected
|
|
||||||
if (!activeClient->IsConnected()) {
|
|
||||||
activeClient->Close();
|
|
||||||
delete activeClient;
|
|
||||||
activeClient = NULL_PTR(BasicTCPSocket *);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
char buffer[1024];
|
|
||||||
uint32 size = 1024;
|
|
||||||
if (activeClient->Read(buffer, size)) {
|
|
||||||
if (size > 0) {
|
|
||||||
// Process each line separately
|
|
||||||
char *ptr = buffer;
|
|
||||||
char *end = buffer + size;
|
|
||||||
while (ptr < end) {
|
|
||||||
char *newline = (char *)memchr(ptr, '\n', end - ptr);
|
|
||||||
if (!newline) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*newline = '\0';
|
|
||||||
// Skip carriage return if present
|
|
||||||
if (newline > ptr && *(newline - 1) == '\r')
|
|
||||||
*(newline - 1) = '\0';
|
|
||||||
StreamString command;
|
|
||||||
uint32 len = (uint32)(newline - ptr);
|
|
||||||
command.Write(ptr, len);
|
|
||||||
if (command.Size() > 0) {
|
|
||||||
HandleCommand(command, activeClient);
|
|
||||||
}
|
|
||||||
ptr = newline + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// // Read failed (client disconnected or error), clean up
|
|
||||||
if (activeClient != NULL_PTR(BasicTCPSocket *)) {
|
|
||||||
activeClient->Close();
|
|
||||||
delete activeClient;
|
|
||||||
activeClient = NULL_PTR(BasicTCPSocket *);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Sleep::MSec(10);
|
|
||||||
}
|
|
||||||
return ErrorManagement::NoError;
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorManagement::ErrorType DebugService::Streamer(ExecutionInfo &info) {
|
|
||||||
if (info.GetStage() == ExecutionInfo::TerminationStage)
|
|
||||||
return ErrorManagement::NoError;
|
|
||||||
if (info.GetStage() == ExecutionInfo::StartupStage) {
|
|
||||||
streamerThreadId = Threads::Id();
|
|
||||||
return ErrorManagement::NoError;
|
|
||||||
}
|
|
||||||
InternetHost dest(streamPort, streamIP.Buffer());
|
|
||||||
(void)udpSocket.SetDestination(dest);
|
|
||||||
uint8 packetBuffer[4096];
|
|
||||||
uint32 packetOffset = 0;
|
|
||||||
uint32 sequenceNumber = 0;
|
|
||||||
while (info.GetStage() == ExecutionInfo::MainStage) {
|
|
||||||
uint32 id, size;
|
|
||||||
uint64 ts;
|
|
||||||
uint8 sampleData[1024];
|
|
||||||
bool hasData = false;
|
|
||||||
while ((info.GetStage() == ExecutionInfo::MainStage) &&
|
|
||||||
traceBuffer.Pop(id, ts, sampleData, size, 1024)) {
|
|
||||||
hasData = true;
|
|
||||||
if (packetOffset == 0) {
|
|
||||||
TraceHeader header;
|
|
||||||
header.magic = 0xDA7A57AD;
|
|
||||||
header.seq = sequenceNumber++;
|
|
||||||
header.timestamp = HighResolutionTimer::Counter();
|
|
||||||
header.count = 0;
|
|
||||||
memcpy(packetBuffer, &header, sizeof(TraceHeader));
|
|
||||||
packetOffset = sizeof(TraceHeader);
|
|
||||||
}
|
|
||||||
if (packetOffset + 16 + size > 1400) {
|
|
||||||
uint32 toWrite = packetOffset;
|
|
||||||
(void)udpSocket.Write((char8 *)packetBuffer, toWrite);
|
|
||||||
TraceHeader header;
|
|
||||||
header.magic = 0xDA7A57AD;
|
|
||||||
header.seq = sequenceNumber++;
|
|
||||||
header.timestamp = HighResolutionTimer::Counter();
|
|
||||||
header.count = 0;
|
|
||||||
memcpy(packetBuffer, &header, sizeof(TraceHeader));
|
|
||||||
packetOffset = sizeof(TraceHeader);
|
|
||||||
}
|
|
||||||
memcpy(&packetBuffer[packetOffset], &id, 4);
|
|
||||||
memcpy(&packetBuffer[packetOffset + 4], &ts, 8);
|
|
||||||
memcpy(&packetBuffer[packetOffset + 12], &size, 4);
|
|
||||||
memcpy(&packetBuffer[packetOffset + 16], sampleData, size);
|
|
||||||
packetOffset += (16 + size);
|
|
||||||
((TraceHeader *)packetBuffer)->count++;
|
|
||||||
}
|
|
||||||
if (packetOffset > 0) {
|
|
||||||
uint32 toWrite = packetOffset;
|
|
||||||
(void)udpSocket.Write((char8 *)packetBuffer, toWrite);
|
|
||||||
packetOffset = 0;
|
|
||||||
}
|
|
||||||
if (!hasData)
|
|
||||||
Sleep::MSec(1);
|
|
||||||
}
|
|
||||||
return ErrorManagement::NoError;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DebugService::GetFullObjectName(const Object &obj,
|
|
||||||
StreamString &fullPath) {
|
|
||||||
fullPath = "";
|
|
||||||
if (FindPathInContainer(ObjectRegistryDatabase::Instance(), &obj, fullPath)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
const char8 *name = obj.GetName();
|
|
||||||
if (name != NULL_PTR(const char8 *))
|
|
||||||
fullPath = name;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugService::HandleCommand(StreamString cmd, BasicTCPSocket *client) {
|
|
||||||
StreamString token;
|
|
||||||
cmd.Seek(0);
|
|
||||||
char8 term;
|
|
||||||
const char8 *delims = " \r\n";
|
|
||||||
if (cmd.GetToken(token, delims, term)) {
|
|
||||||
if (token == "FORCE") {
|
|
||||||
StreamString name, val;
|
|
||||||
if (cmd.GetToken(name, delims, term) && cmd.GetToken(val, delims, term)) {
|
|
||||||
uint32 count = ForceSignal(name.Buffer(), val.Buffer());
|
|
||||||
if (client) {
|
|
||||||
StreamString resp;
|
|
||||||
resp.Printf("OK FORCE %u\n", count);
|
|
||||||
uint32 s = resp.Size();
|
|
||||||
(void)client->Write(resp.Buffer(), s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (token == "UNFORCE") {
|
|
||||||
StreamString name;
|
|
||||||
if (cmd.GetToken(name, delims, term)) {
|
|
||||||
uint32 count = UnforceSignal(name.Buffer());
|
|
||||||
if (client) {
|
|
||||||
StreamString resp;
|
|
||||||
resp.Printf("OK UNFORCE %u\n", count);
|
|
||||||
uint32 s = resp.Size();
|
|
||||||
(void)client->Write(resp.Buffer(), s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (token == "TRACE") {
|
|
||||||
StreamString name, state, decim;
|
|
||||||
if (cmd.GetToken(name, delims, term) &&
|
|
||||||
cmd.GetToken(state, delims, term)) {
|
|
||||||
bool enable = (state == "1");
|
|
||||||
uint32 d = 1;
|
|
||||||
if (cmd.GetToken(decim, delims, term)) {
|
|
||||||
AnyType decimVal(UnsignedInteger32Bit, 0u, &d);
|
|
||||||
AnyType decimStr(CharString, 0u, decim.Buffer());
|
|
||||||
(void)TypeConvert(decimVal, decimStr);
|
|
||||||
}
|
|
||||||
uint32 count = TraceSignal(name.Buffer(), enable, d);
|
|
||||||
if (client) {
|
|
||||||
StreamString resp;
|
|
||||||
resp.Printf("OK TRACE %u\n", count);
|
|
||||||
uint32 s = resp.Size();
|
|
||||||
(void)client->Write(resp.Buffer(), s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (token == "DISCOVER")
|
|
||||||
Discover(client);
|
|
||||||
else if (token == "CONFIG")
|
|
||||||
ServeConfig(client);
|
|
||||||
else if (token == "PAUSE") {
|
|
||||||
SetPaused(true);
|
|
||||||
if (client) {
|
|
||||||
uint32 s = 3;
|
|
||||||
(void)client->Write("OK\n", s);
|
|
||||||
}
|
|
||||||
} else if (token == "RESUME") {
|
|
||||||
SetPaused(false);
|
|
||||||
if (client) {
|
|
||||||
uint32 s = 3;
|
|
||||||
(void)client->Write("OK\n", s);
|
|
||||||
}
|
|
||||||
} else if (token == "TREE") {
|
|
||||||
StreamString json;
|
|
||||||
json = "{\"Name\": \"Root\", \"Class\": \"ObjectRegistryDatabase\", "
|
|
||||||
"\"Children\": [\n";
|
|
||||||
(void)ExportTree(ObjectRegistryDatabase::Instance(), json);
|
|
||||||
json += "\n]}\nOK TREE\n";
|
|
||||||
uint32 s = json.Size();
|
|
||||||
if (client)
|
|
||||||
(void)client->Write(json.Buffer(), s);
|
|
||||||
} else if (token == "INFO") {
|
|
||||||
StreamString path;
|
|
||||||
if (cmd.GetToken(path, delims, term))
|
|
||||||
InfoNode(path.Buffer(), client);
|
|
||||||
} else if (token == "LS") {
|
|
||||||
StreamString path;
|
|
||||||
if (cmd.GetToken(path, delims, term))
|
|
||||||
ListNodes(path.Buffer(), client);
|
|
||||||
else
|
|
||||||
ListNodes(NULL_PTR(const char8 *), client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugService::EnrichWithConfig(const char8 *path, StreamString &json) {
|
|
||||||
if (path == NULL_PTR(const char8 *))
|
|
||||||
return;
|
|
||||||
fullConfig.MoveToRoot();
|
|
||||||
|
|
||||||
const char8 *current = path;
|
|
||||||
bool ok = true;
|
|
||||||
while (ok) {
|
|
||||||
const char8 *nextDot = StringHelper::SearchString(current, ".");
|
|
||||||
StreamString part;
|
|
||||||
if (nextDot != NULL_PTR(const char8 *)) {
|
|
||||||
uint32 len = (uint32)(nextDot - current);
|
|
||||||
(void)part.Write(current, len);
|
|
||||||
current = nextDot + 1;
|
|
||||||
} else {
|
|
||||||
part = current;
|
|
||||||
ok = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fullConfig.MoveRelative(part.Buffer())) {
|
|
||||||
// Found exact
|
|
||||||
} else {
|
|
||||||
bool found = false;
|
|
||||||
if (part == "In") {
|
|
||||||
if (fullConfig.MoveRelative("InputSignals")) {
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
} else if (part == "Out") {
|
|
||||||
if (fullConfig.MoveRelative("OutputSignals")) {
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
StreamString prefixed;
|
|
||||||
prefixed.Printf("+%s", part.Buffer());
|
|
||||||
if (fullConfig.MoveRelative(prefixed.Buffer())) {
|
|
||||||
// Found prefixed
|
|
||||||
} else {
|
|
||||||
return; // Not found
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigurationDatabase db;
|
|
||||||
fullConfig.Copy(db);
|
|
||||||
fullConfig.MoveToRoot();
|
|
||||||
db.MoveToRoot();
|
|
||||||
uint32 n = db.GetNumberOfChildren();
|
|
||||||
for (uint32 i = 0u; i < n; i++) {
|
|
||||||
const char8 *name = db.GetChildName(i);
|
|
||||||
AnyType at = db.GetType(name);
|
|
||||||
if (!at.GetTypeDescriptor().isStructuredData) {
|
|
||||||
json += ", \"";
|
|
||||||
EscapeJson(name, json);
|
|
||||||
json += "\": \"";
|
|
||||||
char8 buf[1024];
|
|
||||||
AnyType st(CharString, 0u, buf);
|
|
||||||
st.SetNumberOfElements(0, 1024);
|
|
||||||
if (TypeConvert(st, at)) {
|
|
||||||
EscapeJson(buf, json);
|
|
||||||
}
|
|
||||||
json += "\"";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugService::JsonifyDatabase(ConfigurationDatabase &db,
|
|
||||||
StreamString &json) {
|
|
||||||
json += "{";
|
|
||||||
uint32 n = db.GetNumberOfChildren();
|
|
||||||
for (uint32 i = 0u; i < n; i++) {
|
|
||||||
const char8 *name = db.GetChildName(i);
|
|
||||||
json += "\"";
|
|
||||||
EscapeJson(name, json);
|
|
||||||
json += "\": ";
|
|
||||||
if (db.MoveRelative(name)) {
|
|
||||||
ConfigurationDatabase child;
|
|
||||||
db.Copy(child);
|
|
||||||
JsonifyDatabase(child, json);
|
|
||||||
db.MoveToAncestor(1u);
|
|
||||||
} else {
|
|
||||||
AnyType at = db.GetType(name);
|
|
||||||
char8 buf[1024];
|
|
||||||
AnyType st(CharString, 0u, buf);
|
|
||||||
st.SetNumberOfElements(0, 1024);
|
|
||||||
if (TypeConvert(st, at)) {
|
|
||||||
json += "\"";
|
|
||||||
EscapeJson(buf, json);
|
|
||||||
json += "\"";
|
|
||||||
} else {
|
|
||||||
json += "null";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (i < n - 1)
|
|
||||||
json += ", ";
|
|
||||||
}
|
|
||||||
json += "}";
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugService::ServeConfig(BasicTCPSocket *client) {
|
|
||||||
if (client == NULL_PTR(BasicTCPSocket *))
|
|
||||||
return;
|
|
||||||
StreamString json;
|
|
||||||
fullConfig.MoveToRoot();
|
|
||||||
JsonifyDatabase(fullConfig, json);
|
|
||||||
json += "\nOK CONFIG\n";
|
|
||||||
uint32 s = json.Size();
|
|
||||||
(void)client->Write(json.Buffer(), s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugService::InfoNode(const char8 *path, BasicTCPSocket *client) {
|
|
||||||
if (!client)
|
|
||||||
return;
|
|
||||||
Reference ref = ObjectRegistryDatabase::Instance()->Find(path);
|
|
||||||
StreamString json = "{";
|
|
||||||
if (ref.IsValid()) {
|
|
||||||
json += "\"Name\": \"";
|
|
||||||
EscapeJson(ref->GetName(), json);
|
|
||||||
json += "\", \"Class\": \"";
|
|
||||||
EscapeJson(ref->GetClassProperties()->GetName(), json);
|
|
||||||
json += "\"";
|
|
||||||
ConfigurationDatabase db;
|
|
||||||
if (ref->ExportData(db)) {
|
|
||||||
json += ", \"Config\": {";
|
|
||||||
db.MoveToRoot();
|
|
||||||
uint32 nChildren = db.GetNumberOfChildren();
|
|
||||||
for (uint32 i = 0; i < nChildren; i++) {
|
|
||||||
const char8 *cname = db.GetChildName(i);
|
|
||||||
AnyType at = db.GetType(cname);
|
|
||||||
char8 valBuf[1024];
|
|
||||||
AnyType strType(CharString, 0u, valBuf);
|
|
||||||
strType.SetNumberOfElements(0, 1024);
|
|
||||||
if (TypeConvert(strType, at)) {
|
|
||||||
json += "\"";
|
|
||||||
EscapeJson(cname, json);
|
|
||||||
json += "\": \"";
|
|
||||||
EscapeJson(valBuf, json);
|
|
||||||
json += "\"";
|
|
||||||
if (i < nChildren - 1)
|
|
||||||
json += ", ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
json += "}";
|
|
||||||
}
|
|
||||||
EnrichWithConfig(path, json);
|
|
||||||
} else {
|
|
||||||
mutex.FastLock();
|
|
||||||
bool found = false;
|
|
||||||
for (uint32 i = 0; i < aliases.Size(); i++) {
|
|
||||||
if (aliases[i].name == path ||
|
|
||||||
SuffixMatch(aliases[i].name.Buffer(), path)) {
|
|
||||||
DebugSignalInfo *s = signals[aliases[i].signalIndex];
|
|
||||||
const char8 *tname =
|
|
||||||
TypeDescriptor::GetTypeNameFromTypeDescriptor(s->type);
|
|
||||||
json.Printf("\"Name\": \"%s\", \"Class\": \"Signal\", \"Type\": "
|
|
||||||
"\"%s\", \"ID\": %d",
|
|
||||||
s->name.Buffer(), tname ? tname : "Unknown", s->internalID);
|
|
||||||
EnrichWithConfig(aliases[i].name.Buffer(), json);
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mutex.FastUnLock();
|
|
||||||
if (!found)
|
|
||||||
json += "\"Error\": \"Object not found\"";
|
|
||||||
}
|
|
||||||
json += "}\nOK INFO\n";
|
|
||||||
uint32 s = json.Size();
|
|
||||||
(void)client->Write(json.Buffer(), s);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 DebugService::ExportTree(ReferenceContainer *container,
|
|
||||||
StreamString &json) {
|
|
||||||
if (container == NULL_PTR(ReferenceContainer *))
|
|
||||||
return 0;
|
|
||||||
uint32 size = container->Size();
|
|
||||||
uint32 validCount = 0;
|
|
||||||
for (uint32 i = 0u; i < size; i++) {
|
|
||||||
Reference child = container->Get(i);
|
|
||||||
if (child.IsValid()) {
|
|
||||||
if (validCount > 0u)
|
|
||||||
json += ",\n";
|
|
||||||
StreamString nodeJson;
|
|
||||||
const char8 *cname = child->GetName();
|
|
||||||
if (cname == NULL_PTR(const char8 *))
|
|
||||||
cname = "unnamed";
|
|
||||||
nodeJson += "{\"Name\": \"";
|
|
||||||
EscapeJson(cname, nodeJson);
|
|
||||||
nodeJson += "\", \"Class\": \"";
|
|
||||||
EscapeJson(child->GetClassProperties()->GetName(), nodeJson);
|
|
||||||
nodeJson += "\"";
|
|
||||||
ReferenceContainer *inner =
|
|
||||||
dynamic_cast<ReferenceContainer *>(child.operator->());
|
|
||||||
DataSourceI *ds = dynamic_cast<DataSourceI *>(child.operator->());
|
|
||||||
GAM *gam = dynamic_cast<GAM *>(child.operator->());
|
|
||||||
if ((inner != NULL_PTR(ReferenceContainer *)) ||
|
|
||||||
(ds != NULL_PTR(DataSourceI *)) || (gam != NULL_PTR(GAM *))) {
|
|
||||||
nodeJson += ", \"Children\": [\n";
|
|
||||||
uint32 subCount = 0u;
|
|
||||||
if (inner != NULL_PTR(ReferenceContainer *))
|
|
||||||
subCount += ExportTree(inner, nodeJson);
|
|
||||||
if (ds != NULL_PTR(DataSourceI *)) {
|
|
||||||
uint32 nSignals = ds->GetNumberOfSignals();
|
|
||||||
for (uint32 j = 0u; j < nSignals; j++) {
|
|
||||||
if (subCount > 0u)
|
|
||||||
nodeJson += ",\n";
|
|
||||||
subCount++;
|
|
||||||
StreamString sname;
|
|
||||||
(void)ds->GetSignalName(j, sname);
|
|
||||||
const char8 *stype = TypeDescriptor::GetTypeNameFromTypeDescriptor(
|
|
||||||
ds->GetSignalType(j));
|
|
||||||
uint8 dims = 0u;
|
|
||||||
(void)ds->GetSignalNumberOfDimensions(j, dims);
|
|
||||||
uint32 elems = 0u;
|
|
||||||
(void)ds->GetSignalNumberOfElements(j, elems);
|
|
||||||
nodeJson += "{\"Name\": \"";
|
|
||||||
EscapeJson(sname.Buffer(), nodeJson);
|
|
||||||
nodeJson += "\", \"Class\": \"Signal\", \"Type\": \"";
|
|
||||||
EscapeJson(stype ? stype : "Unknown", nodeJson);
|
|
||||||
nodeJson.Printf("\", \"Dimensions\": %d, \"Elements\": %u}", dims,
|
|
||||||
elems);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (gam != NULL_PTR(GAM *)) {
|
|
||||||
uint32 nIn = gam->GetNumberOfInputSignals();
|
|
||||||
for (uint32 j = 0u; j < nIn; j++) {
|
|
||||||
if (subCount > 0u)
|
|
||||||
nodeJson += ",\n";
|
|
||||||
subCount++;
|
|
||||||
StreamString sname;
|
|
||||||
(void)gam->GetSignalName(InputSignals, j, sname);
|
|
||||||
const char8 *stype = TypeDescriptor::GetTypeNameFromTypeDescriptor(
|
|
||||||
gam->GetSignalType(InputSignals, j));
|
|
||||||
uint32 dims = 0u;
|
|
||||||
(void)gam->GetSignalNumberOfDimensions(InputSignals, j, dims);
|
|
||||||
uint32 elems = 0u;
|
|
||||||
(void)gam->GetSignalNumberOfElements(InputSignals, j, elems);
|
|
||||||
nodeJson += "{\"Name\": \"In.";
|
|
||||||
EscapeJson(sname.Buffer(), nodeJson);
|
|
||||||
nodeJson += "\", \"Class\": \"InputSignal\", \"Type\": \"";
|
|
||||||
EscapeJson(stype ? stype : "Unknown", nodeJson);
|
|
||||||
nodeJson.Printf("\", \"Dimensions\": %u, \"Elements\": %u}", dims,
|
|
||||||
elems);
|
|
||||||
}
|
|
||||||
uint32 nOut = gam->GetNumberOfOutputSignals();
|
|
||||||
for (uint32 j = 0u; j < nOut; j++) {
|
|
||||||
if (subCount > 0u)
|
|
||||||
nodeJson += ",\n";
|
|
||||||
subCount++;
|
|
||||||
StreamString sname;
|
|
||||||
(void)gam->GetSignalName(OutputSignals, j, sname);
|
|
||||||
const char8 *stype = TypeDescriptor::GetTypeNameFromTypeDescriptor(
|
|
||||||
gam->GetSignalType(OutputSignals, j));
|
|
||||||
uint32 dims = 0u;
|
|
||||||
(void)gam->GetSignalNumberOfDimensions(OutputSignals, j, dims);
|
|
||||||
uint32 elems = 0u;
|
|
||||||
(void)gam->GetSignalNumberOfElements(OutputSignals, j, elems);
|
|
||||||
nodeJson += "{\"Name\": \"Out.";
|
|
||||||
EscapeJson(sname.Buffer(), nodeJson);
|
|
||||||
nodeJson += "\", \"Class\": \"OutputSignal\", \"Type\": \"";
|
|
||||||
EscapeJson(stype ? stype : "Unknown", nodeJson);
|
|
||||||
nodeJson.Printf("\", \"Dimensions\": %u, \"Elements\": %u}", dims,
|
|
||||||
elems);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nodeJson += "\n]";
|
|
||||||
}
|
|
||||||
nodeJson += "}";
|
|
||||||
json += nodeJson;
|
|
||||||
validCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return validCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 DebugService::ForceSignal(const char8 *name, const char8 *valueStr) {
|
|
||||||
mutex.FastLock();
|
|
||||||
uint32 count = 0;
|
|
||||||
for (uint32 i = 0; i < aliases.Size(); i++) {
|
|
||||||
if (aliases[i].name == name ||
|
|
||||||
SuffixMatch(aliases[i].name.Buffer(), name)) {
|
|
||||||
|
|
||||||
DebugSignalInfo *s = signals[aliases[i].signalIndex];
|
|
||||||
s->isForcing = true;
|
|
||||||
AnyType dest(s->type, 0u, s->forcedValue);
|
|
||||||
AnyType source(CharString, 0u, valueStr);
|
|
||||||
(void)TypeConvert(dest, source);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
UpdateBrokersActiveStatus();
|
|
||||||
mutex.FastUnLock();
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 DebugService::UnforceSignal(const char8 *name) {
|
|
||||||
mutex.FastLock();
|
|
||||||
uint32 count = 0;
|
|
||||||
for (uint32 i = 0; i < aliases.Size(); i++) {
|
|
||||||
if (aliases[i].name == name ||
|
|
||||||
SuffixMatch(aliases[i].name.Buffer(), name)) {
|
|
||||||
signals[aliases[i].signalIndex]->isForcing = false;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
UpdateBrokersActiveStatus();
|
|
||||||
mutex.FastUnLock();
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 DebugService::TraceSignal(const char8 *name, bool enable,
|
|
||||||
uint32 decimation) {
|
|
||||||
mutex.FastLock();
|
|
||||||
uint32 count = 0;
|
|
||||||
for (uint32 i = 0; i < aliases.Size(); i++) {
|
|
||||||
printf("<debug>%s\n", aliases[i].name.Buffer());
|
|
||||||
if (aliases[i].name == name ||
|
|
||||||
SuffixMatch(aliases[i].name.Buffer(), name)) {
|
|
||||||
DebugSignalInfo *s = signals[aliases[i].signalIndex];
|
|
||||||
s->isTracing = enable;
|
|
||||||
s->decimationFactor = decimation;
|
|
||||||
s->decimationCounter = 0;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (count == 0) {
|
|
||||||
printf("<!!> signal %s not found\n", name);
|
|
||||||
}
|
|
||||||
UpdateBrokersActiveStatus();
|
|
||||||
mutex.FastUnLock();
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugService::Discover(BasicTCPSocket *client) {
|
|
||||||
if (client) {
|
|
||||||
StreamString header = "{\n \"Signals\": [\n";
|
|
||||||
uint32 s = header.Size();
|
|
||||||
(void)client->Write(header.Buffer(), s);
|
|
||||||
mutex.FastLock();
|
|
||||||
for (uint32 i = 0; i < aliases.Size(); i++) {
|
|
||||||
StreamString line;
|
|
||||||
DebugSignalInfo *sig = signals[aliases[i].signalIndex];
|
|
||||||
const char8 *typeName =
|
|
||||||
TypeDescriptor::GetTypeNameFromTypeDescriptor(sig->type);
|
|
||||||
line.Printf(" {\"name\": \"%s\", \"id\": %d, \"type\": \"%s\"",
|
|
||||||
aliases[i].name.Buffer(), sig->internalID,
|
|
||||||
typeName ? typeName : "Unknown");
|
|
||||||
EnrichWithConfig(aliases[i].name.Buffer(), line);
|
|
||||||
line += "}";
|
|
||||||
if (i < aliases.Size() - 1)
|
|
||||||
line += ",";
|
|
||||||
line += "\n";
|
|
||||||
s = line.Size();
|
|
||||||
(void)client->Write(line.Buffer(), s);
|
|
||||||
}
|
|
||||||
mutex.FastUnLock();
|
|
||||||
StreamString footer = " ]\n}\nOK DISCOVER\n";
|
|
||||||
s = footer.Size();
|
|
||||||
(void)client->Write(footer.Buffer(), s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugService::ListNodes(const char8 *path, BasicTCPSocket *client) {
|
|
||||||
if (!client)
|
|
||||||
return;
|
|
||||||
Reference ref =
|
|
||||||
(path == NULL_PTR(const char8 *) || StringHelper::Length(path) == 0 ||
|
|
||||||
StringHelper::Compare(path, "/") == 0)
|
|
||||||
? ObjectRegistryDatabase::Instance()
|
|
||||||
: ObjectRegistryDatabase::Instance()->Find(path);
|
|
||||||
if (ref.IsValid()) {
|
|
||||||
StreamString out;
|
|
||||||
out.Printf("Nodes under %s:\n", path ? path : "/");
|
|
||||||
ReferenceContainer *container =
|
|
||||||
dynamic_cast<ReferenceContainer *>(ref.operator->());
|
|
||||||
if (container) {
|
|
||||||
for (uint32 i = 0; i < container->Size(); i++) {
|
|
||||||
Reference child = container->Get(i);
|
|
||||||
if (child.IsValid())
|
|
||||||
out.Printf(" %s [%s]\n", child->GetName(),
|
|
||||||
child->GetClassProperties()->GetName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const char *okMsg = "OK LS\n";
|
|
||||||
out += okMsg;
|
|
||||||
uint32 s = out.Size();
|
|
||||||
(void)client->Write(out.Buffer(), s);
|
|
||||||
} else {
|
|
||||||
const char *msg = "ERROR: Path not found\n";
|
|
||||||
uint32 s = StringHelper::Length(msg);
|
|
||||||
(void)client->Write(msg, s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace MARTe
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
#ifndef DEBUGSERVICE_H
|
|
||||||
#define DEBUGSERVICE_H
|
|
||||||
|
|
||||||
#include "BasicTCPSocket.h"
|
|
||||||
#include "BasicUDPSocket.h"
|
|
||||||
#include "ConfigurationDatabase.h"
|
|
||||||
#include "DebugCore.h"
|
|
||||||
#include "EmbeddedServiceMethodBinderI.h"
|
|
||||||
#include "MessageI.h"
|
|
||||||
#include "Object.h"
|
|
||||||
#include "ReferenceContainer.h"
|
|
||||||
#include "SingleThreadService.h"
|
|
||||||
#include "StreamString.h"
|
|
||||||
#include "Vec.h"
|
|
||||||
|
|
||||||
namespace MARTe {
|
|
||||||
|
|
||||||
class MemoryMapBroker;
|
|
||||||
|
|
||||||
struct SignalAlias {
|
|
||||||
StreamString name;
|
|
||||||
uint32 signalIndex;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BrokerInfo {
|
|
||||||
DebugSignalInfo **signalPointers;
|
|
||||||
uint32 numSignals;
|
|
||||||
MemoryMapBroker *broker;
|
|
||||||
volatile bool *anyActiveFlag;
|
|
||||||
Vec<uint32> *activeIndices;
|
|
||||||
Vec<uint32> *activeSizes;
|
|
||||||
FastPollingMutexSem *activeMutex;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DebugService : public ReferenceContainer,
|
|
||||||
public MessageI,
|
|
||||||
public EmbeddedServiceMethodBinderI {
|
|
||||||
public:
|
|
||||||
friend class DebugServiceTest;
|
|
||||||
CLASS_REGISTER_DECLARATION()
|
|
||||||
|
|
||||||
DebugService();
|
|
||||||
virtual ~DebugService();
|
|
||||||
|
|
||||||
virtual bool Initialise(StructuredDataI &data);
|
|
||||||
|
|
||||||
DebugSignalInfo *RegisterSignal(void *memoryAddress, TypeDescriptor type,
|
|
||||||
const char8 *name);
|
|
||||||
void ProcessSignal(DebugSignalInfo *signalInfo, uint32 size,
|
|
||||||
uint64 timestamp);
|
|
||||||
|
|
||||||
void RegisterBroker(DebugSignalInfo **signalPointers, uint32 numSignals,
|
|
||||||
MemoryMapBroker *broker, volatile bool *anyActiveFlag,
|
|
||||||
Vec<uint32> *activeIndices, Vec<uint32> *activeSizes,
|
|
||||||
FastPollingMutexSem *activeMutex);
|
|
||||||
|
|
||||||
virtual ErrorManagement::ErrorType Execute(ExecutionInfo &info);
|
|
||||||
|
|
||||||
bool IsPaused() const { return isPaused; }
|
|
||||||
void SetPaused(bool paused) { isPaused = paused; }
|
|
||||||
|
|
||||||
static bool GetFullObjectName(const Object &obj, StreamString &fullPath);
|
|
||||||
|
|
||||||
uint32 ForceSignal(const char8 *name, const char8 *valueStr);
|
|
||||||
uint32 UnforceSignal(const char8 *name);
|
|
||||||
uint32 TraceSignal(const char8 *name, bool enable, uint32 decimation = 1);
|
|
||||||
void Discover(BasicTCPSocket *client);
|
|
||||||
void InfoNode(const char8 *path, BasicTCPSocket *client);
|
|
||||||
void ListNodes(const char8 *path, BasicTCPSocket *client);
|
|
||||||
void ServeConfig(BasicTCPSocket *client);
|
|
||||||
void SetFullConfig(ConfigurationDatabase &config);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void HandleCommand(StreamString cmd, BasicTCPSocket *client);
|
|
||||||
void UpdateBrokersActiveStatus();
|
|
||||||
|
|
||||||
uint32 ExportTree(ReferenceContainer *container, StreamString &json);
|
|
||||||
void PatchRegistry();
|
|
||||||
|
|
||||||
void EnrichWithConfig(const char8 *path, StreamString &json);
|
|
||||||
static void JsonifyDatabase(ConfigurationDatabase &db, StreamString &json);
|
|
||||||
|
|
||||||
ErrorManagement::ErrorType Server(ExecutionInfo &info);
|
|
||||||
ErrorManagement::ErrorType Streamer(ExecutionInfo &info);
|
|
||||||
|
|
||||||
uint16 controlPort;
|
|
||||||
uint16 streamPort;
|
|
||||||
StreamString streamIP;
|
|
||||||
bool isServer;
|
|
||||||
bool suppressTimeoutLogs;
|
|
||||||
volatile bool isPaused;
|
|
||||||
|
|
||||||
BasicTCPSocket tcpServer;
|
|
||||||
BasicUDPSocket udpSocket;
|
|
||||||
|
|
||||||
class ServiceBinder : public EmbeddedServiceMethodBinderI {
|
|
||||||
public:
|
|
||||||
enum ServiceType { ServerType, StreamerType };
|
|
||||||
ServiceBinder(DebugService *parent, ServiceType type)
|
|
||||||
: parent(parent), type(type) {}
|
|
||||||
virtual ErrorManagement::ErrorType Execute(ExecutionInfo &info) {
|
|
||||||
if (type == StreamerType) {
|
|
||||||
return parent->Streamer(info);
|
|
||||||
}
|
|
||||||
printf("serve TCP\n");
|
|
||||||
return parent->Server(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
DebugService *parent;
|
|
||||||
ServiceType type;
|
|
||||||
};
|
|
||||||
|
|
||||||
ServiceBinder binderServer;
|
|
||||||
ServiceBinder binderStreamer;
|
|
||||||
|
|
||||||
SingleThreadService threadService;
|
|
||||||
SingleThreadService streamerService;
|
|
||||||
|
|
||||||
ThreadIdentifier serverThreadId;
|
|
||||||
ThreadIdentifier streamerThreadId;
|
|
||||||
|
|
||||||
Vec<DebugSignalInfo *> signals;
|
|
||||||
Vec<SignalAlias> aliases;
|
|
||||||
Vec<BrokerInfo> brokers;
|
|
||||||
|
|
||||||
FastPollingMutexSem mutex;
|
|
||||||
TraceRingBuffer traceBuffer;
|
|
||||||
|
|
||||||
BasicTCPSocket *activeClient;
|
|
||||||
|
|
||||||
ConfigurationDatabase fullConfig;
|
|
||||||
|
|
||||||
static DebugService *instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace MARTe
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# Copyright 2015 F4E | European Joint Undertaking for ITER
|
|
||||||
# and the Development of Fusion Energy ('Fusion for Energy')
|
|
||||||
#
|
|
||||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
|
||||||
# will be approved by the European Commission - subsequent
|
|
||||||
# versions of the EUPL (the "Licence");
|
|
||||||
# You may not use this work except in compliance with the
|
|
||||||
# Licence.
|
|
||||||
# You may obtain a copy of the Licence at:
|
|
||||||
#
|
|
||||||
# http://ec.europa.eu/idabc/eupl
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in
|
|
||||||
# writing, software distributed under the Licence is
|
|
||||||
# distributed on an "AS IS" basis,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
||||||
# express or implied.
|
|
||||||
# See the Licence for the specific language governing
|
|
||||||
# permissions and limitations under the Licence.
|
|
||||||
#
|
|
||||||
# $Id: Makefile.gcc 3 2015-01-15 16:26:07Z aneto $
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
|
|
||||||
|
|
||||||
include Makefile.inc
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# Copyright 2015 F4E | European Joint Undertaking for ITER
|
|
||||||
# and the Development of Fusion Energy ('Fusion for Energy')
|
|
||||||
#
|
|
||||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
|
||||||
# will be approved by the European Commission - subsequent
|
|
||||||
# versions of the EUPL (the "Licence");
|
|
||||||
# You may not use this work except in compliance with the
|
|
||||||
# Licence.
|
|
||||||
# You may obtain a copy of the Licence at:
|
|
||||||
#
|
|
||||||
# http://ec.europa.eu/idabc/eupl
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in
|
|
||||||
# writing, software distributed under the Licence is
|
|
||||||
# distributed on an "AS IS" basis,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
||||||
# express or implied.
|
|
||||||
# See the Licence for the specific language governing
|
|
||||||
# permissions and limitations under the Licence.
|
|
||||||
#
|
|
||||||
# $Id: Makefile.inc 3 2012-01-15 16:26:07Z aneto $
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
OBJSX=DebugService.x
|
|
||||||
|
|
||||||
PACKAGE=Components/Interfaces
|
|
||||||
|
|
||||||
ROOT_DIR=../../../../
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
|
||||||
|
|
||||||
INCLUDES += -I$(ROOT_DIR)/Source/Core/Types/Result
|
|
||||||
INCLUDES += -I$(ROOT_DIR)/Source/Core/Types/Vec
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L0Types
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L1Portability
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L2Objects
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L3Streams
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Messages
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Logger
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Configuration
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L5GAMs
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L1Portability
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L3Services
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4Messages
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4LoggerService
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L5GAMs
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L1Portability
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L3Streams
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ) \
|
|
||||||
$(BUILD_DIR)/DebugService$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/DebugService$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# Copyright 2015 F4E | European Joint Undertaking for ITER
|
|
||||||
# and the Development of Fusion Energy ('Fusion for Energy')
|
|
||||||
#
|
|
||||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
|
||||||
# will be approved by the European Commission - subsequent
|
|
||||||
# versions of the EUPL (the "Licence");
|
|
||||||
# You may not use this work except in compliance with the
|
|
||||||
# Licence.
|
|
||||||
# You may obtain a copy of the Licence at:
|
|
||||||
#
|
|
||||||
# http://ec.europa.eu/idabc/eupl
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in
|
|
||||||
# writing, software distributed under the Licence is
|
|
||||||
# distributed on an "AS IS" basis,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
||||||
# express or implied.
|
|
||||||
# See the Licence for the specific language governing
|
|
||||||
# permissions and limitations under the Licence.
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
|
|
||||||
|
|
||||||
include Makefile.inc
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# Copyright 2015 F4E | European Joint Undertaking for ITER
|
|
||||||
# and the Development of Fusion Energy ('Fusion for Energy')
|
|
||||||
#
|
|
||||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
|
||||||
# will be approved by the European Commission - subsequent
|
|
||||||
# versions of the EUPL (the "Licence");
|
|
||||||
# You may not use this work except in compliance with the
|
|
||||||
# Licence.
|
|
||||||
# You may obtain a copy of the Licence at:
|
|
||||||
#
|
|
||||||
# http://ec.europa.eu/idabc/eupl
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in
|
|
||||||
# writing, software distributed under the Licence is
|
|
||||||
# distributed on an "AS IS" basis,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
||||||
# express or implied.
|
|
||||||
# See the Licence for the specific language governing
|
|
||||||
# permissions and limitations under the Licence.
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
|
|
||||||
OBJSX=
|
|
||||||
|
|
||||||
SPB = TCPLogger.x DebugService.x
|
|
||||||
|
|
||||||
ROOT_DIR=../../..
|
|
||||||
|
|
||||||
|
|
||||||
PACKAGE=Components
|
|
||||||
ROOT_DIR=../../..
|
|
||||||
ABS_ROOT_DIR=$(abspath $(ROOT_DIR))
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
include Makefile.inc
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
OBJSX=TcpLogger.x
|
|
||||||
|
|
||||||
PACKAGE=Components/Interfaces
|
|
||||||
|
|
||||||
ROOT_DIR=../../../../
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
|
||||||
|
|
||||||
INCLUDES += -I.
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L0Types
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L1Portability
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L2Objects
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L3Streams
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Messages
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Logger
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Configuration
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L5GAMs
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L1Portability
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L3Services
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4Messages
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4LoggerService
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L5GAMs
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L1Portability
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L3Streams
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ) \
|
|
||||||
$(BUILD_DIR)/TcpLogger$(LIBEXT) \
|
|
||||||
$(BUILD_DIR)/TcpLogger$(DLLEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
include Makefile.inc
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
#
|
|
||||||
# Copyright 2015 F4E | European Joint Undertaking for ITER
|
|
||||||
# and the Development of Fusion Energy ('Fusion for Energy')
|
|
||||||
#
|
|
||||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
|
||||||
# will be approved by the European Commission - subsequent
|
|
||||||
# versions of the EUPL (the "Licence");
|
|
||||||
# You may not use this work except in compliance with the
|
|
||||||
# Licence.
|
|
||||||
# You may obtain a copy of the Licence at:
|
|
||||||
#
|
|
||||||
# http://ec.europa.eu/idabc/eupl
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in
|
|
||||||
# writing, software distributed under the Licence is
|
|
||||||
# distributed on an "AS IS" basis,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
||||||
# express or implied.
|
|
||||||
# See the Licence for the specific language governing
|
|
||||||
# permissions and limitations under the Licence.
|
|
||||||
#
|
|
||||||
# $Id: Makefile.inc 3 2012-01-15 16:26:07Z aneto $
|
|
||||||
#
|
|
||||||
#############################################################
|
|
||||||
|
|
||||||
SPB =
|
|
||||||
|
|
||||||
|
|
||||||
ROOT_DIR=../../..
|
|
||||||
|
|
||||||
|
|
||||||
PACKAGE=Core
|
|
||||||
ROOT_DIR=../../..
|
|
||||||
ABS_ROOT_DIR=$(abspath $(ROOT_DIR))
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
|
||||||
|
|
||||||
all: $(OBJS) $(SUBPROJ)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include depends.$(TARGET)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
#ifndef __RESULT_H
|
|
||||||
#define __RESULT_H
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
namespace MARTe {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Namespace for result error codes.
|
|
||||||
*/
|
|
||||||
namespace Errors {
|
|
||||||
enum ErrorT {
|
|
||||||
None = 0,
|
|
||||||
Generic = 1,
|
|
||||||
OutOfMemory = 2,
|
|
||||||
IndexOutOfBounds = 3,
|
|
||||||
ValueOutOfRange = 4,
|
|
||||||
WrongType = 5,
|
|
||||||
Empty = 6,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief A simple Result type for error handling.
|
|
||||||
* @details This implementation is header-only to ensure template linkage.
|
|
||||||
* Requirement: T and E must have default constructors and be copyable.
|
|
||||||
*/
|
|
||||||
template <typename T, typename E = Errors::ErrorT>
|
|
||||||
class Result {
|
|
||||||
public:
|
|
||||||
static Result Success(const T &t) {
|
|
||||||
return Result(t, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Result Fail(const E &e) {
|
|
||||||
return Result(e, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result() : state(false), val(T()), err(E()) {}
|
|
||||||
Result(const Result &r) : state(r.state), val(r.val), err(r.err) {}
|
|
||||||
|
|
||||||
Result& operator=(const Result &r) {
|
|
||||||
if (this != &r) {
|
|
||||||
state = r.state;
|
|
||||||
val = r.val;
|
|
||||||
err = r.err;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Ok() const { return state; }
|
|
||||||
bool IsOk() const { return state; }
|
|
||||||
|
|
||||||
// Const accessors
|
|
||||||
const T &Val() const { assert(state); return val; }
|
|
||||||
const E &Err() const { assert(!state); return err; }
|
|
||||||
|
|
||||||
// Non-const accessors
|
|
||||||
T &Val() { assert(state); return val; }
|
|
||||||
E &Err() { assert(!state); return err; }
|
|
||||||
|
|
||||||
operator bool() const { return state; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
Result(const T &v, bool s) : state(s), val(v), err(E()) {}
|
|
||||||
Result(const E &e, bool s) : state(s), val(T()), err(e) {}
|
|
||||||
|
|
||||||
bool state;
|
|
||||||
T val;
|
|
||||||
E err;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace MARTe
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Result.o: Result.cpp Result.h
|
|
||||||
@@ -1,143 +0,0 @@
|
|||||||
#ifndef __VEC_H
|
|
||||||
#define __VEC_H
|
|
||||||
|
|
||||||
#include "Result.h"
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <cassert>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
namespace MARTe {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Simple dynamic array (vector) implementation with fixed growth.
|
|
||||||
* @tparam T The type of elements.
|
|
||||||
* @tparam GROWTH The number of elements to add when the buffer is full.
|
|
||||||
*/
|
|
||||||
template <typename T, size_t GROWTH = 16>
|
|
||||||
class Vec {
|
|
||||||
public:
|
|
||||||
Vec() : size(0), mem_size(GROWTH), arr(NULL) {
|
|
||||||
arr = new T[mem_size];
|
|
||||||
}
|
|
||||||
|
|
||||||
Vec(const Vec<T, GROWTH> &other) : size(other.size), mem_size(other.mem_size), arr(NULL) {
|
|
||||||
arr = new T[mem_size];
|
|
||||||
for (size_t i = 0; i < size; ++i) {
|
|
||||||
arr[i] = other.arr[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Vec(const T *data, const size_t count) : size(count), mem_size(count + GROWTH), arr(NULL) {
|
|
||||||
arr = new T[mem_size];
|
|
||||||
for (size_t i = 0; i < size; ++i) {
|
|
||||||
arr[i] = data[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
~Vec() {
|
|
||||||
if (arr != NULL) {
|
|
||||||
delete[] arr;
|
|
||||||
arr = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Vec& operator=(const Vec<T, GROWTH> &other) {
|
|
||||||
if (this != &other) {
|
|
||||||
T* new_arr = new T[other.mem_size];
|
|
||||||
for (size_t i = 0; i < other.size; ++i) {
|
|
||||||
new_arr[i] = other.arr[i];
|
|
||||||
}
|
|
||||||
if (arr != NULL) {
|
|
||||||
delete[] arr;
|
|
||||||
}
|
|
||||||
arr = new_arr;
|
|
||||||
size = other.size;
|
|
||||||
mem_size = other.mem_size;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Clear() {
|
|
||||||
size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t Size() const {
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
T* GetInternalBuffer() { return arr; }
|
|
||||||
|
|
||||||
bool Remove(size_t index) {
|
|
||||||
if (index >= size) return false;
|
|
||||||
for (size_t i = index; i < size - 1; ++i) {
|
|
||||||
arr[i] = arr[i + 1];
|
|
||||||
}
|
|
||||||
size--;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Insert(size_t index, const T& val) {
|
|
||||||
if (index > size) return false;
|
|
||||||
if (size == mem_size) extend();
|
|
||||||
|
|
||||||
for (size_t i = size; i > index; --i) {
|
|
||||||
arr[i] = arr[i - 1];
|
|
||||||
}
|
|
||||||
arr[index] = val;
|
|
||||||
size++;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<T> Get(size_t index) const {
|
|
||||||
if (index >= size) return Result<T>::Fail(Errors::IndexOutOfBounds);
|
|
||||||
return Result<T>::Success(arr[index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Push(const T &val) {
|
|
||||||
if (size == mem_size) extend();
|
|
||||||
arr[size++] = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<T> Pop() {
|
|
||||||
if (size == 0) return Result<T>::Fail(Errors::Empty);
|
|
||||||
T last = arr[--size];
|
|
||||||
return Result<T>::Success(last);
|
|
||||||
}
|
|
||||||
|
|
||||||
const T &operator[](const size_t index) const {
|
|
||||||
assert(index < size);
|
|
||||||
return arr[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
T &operator[](const size_t index) {
|
|
||||||
assert(index < size);
|
|
||||||
return arr[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const T *mem() const { return arr; }
|
|
||||||
size_t memSize() const { return mem_size; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
size_t size;
|
|
||||||
size_t mem_size;
|
|
||||||
T *arr;
|
|
||||||
|
|
||||||
void extend() {
|
|
||||||
size_t new_mem_size = mem_size + GROWTH;
|
|
||||||
T *new_arr = new T[new_mem_size];
|
|
||||||
for (size_t i = 0; i < size; ++i) {
|
|
||||||
new_arr[i] = arr[i];
|
|
||||||
}
|
|
||||||
if (arr != NULL) {
|
|
||||||
delete[] arr;
|
|
||||||
}
|
|
||||||
arr = new_arr;
|
|
||||||
mem_size = new_mem_size;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace MARTe
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../..//Build/x86-linux/Core/Types/Vec/Vec.o: Vec.cpp
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Vec.o: Vec.cpp
|
|
||||||
518
Source/DebugService.cpp
Normal file
518
Source/DebugService.cpp
Normal file
@@ -0,0 +1,518 @@
|
|||||||
|
#include "DebugService.h"
|
||||||
|
#include "StandardParser.h"
|
||||||
|
#include "StreamString.h"
|
||||||
|
#include "BasicSocket.h"
|
||||||
|
#include "DebugBrokerWrapper.h"
|
||||||
|
#include "ObjectRegistryDatabase.h"
|
||||||
|
#include "ClassRegistryItem.h"
|
||||||
|
#include "ObjectBuilder.h"
|
||||||
|
#include "TypeConversion.h"
|
||||||
|
#include "HighResolutionTimer.h"
|
||||||
|
#include "ConfigurationDatabase.h"
|
||||||
|
#include "GAM.h"
|
||||||
|
#include "Atomic.h"
|
||||||
|
|
||||||
|
namespace MARTe {
|
||||||
|
|
||||||
|
DebugService* GlobalDebugServiceInstance = NULL_PTR(DebugService*);
|
||||||
|
|
||||||
|
static void EscapeJson(const char8* src, StreamString &dst) {
|
||||||
|
if (src == NULL_PTR(const char8*)) return;
|
||||||
|
while (*src != '\0') {
|
||||||
|
if (*src == '"') dst += "\\\"";
|
||||||
|
else if (*src == '\\') dst += "\\\\";
|
||||||
|
else if (*src == '\n') dst += "\\n";
|
||||||
|
else if (*src == '\r') dst += "\\r";
|
||||||
|
else if (*src == '\t') dst += "\\t";
|
||||||
|
else dst += *src;
|
||||||
|
src++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool SuffixMatch(const char8* target, const char8* pattern) {
|
||||||
|
uint32 tLen = StringHelper::Length(target); uint32 pLen = StringHelper::Length(pattern);
|
||||||
|
if (pLen > tLen) return false;
|
||||||
|
const char8* suffix = target + (tLen - pLen);
|
||||||
|
if (StringHelper::Compare(suffix, pattern) == 0) { if (tLen == pLen || *(suffix - 1) == '.') return true; }
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool RecursiveGetFullObjectName(ReferenceContainer *container, const Object &obj, StreamString &path) {
|
||||||
|
uint32 size = container->Size();
|
||||||
|
for (uint32 i=0; i<size; i++) {
|
||||||
|
Reference child = container->Get(i);
|
||||||
|
if (child.IsValid()) {
|
||||||
|
if (child.operator->() == &obj) { path = child->GetName(); return true; }
|
||||||
|
ReferenceContainer *inner = dynamic_cast<ReferenceContainer*>(child.operator->());
|
||||||
|
if (inner) {
|
||||||
|
if (RecursiveGetFullObjectName(inner, obj, path)) {
|
||||||
|
StreamString prefix = child->GetName(); prefix += "."; prefix += path;
|
||||||
|
path = prefix; return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DebugService::GetFullObjectName(const Object &obj, StreamString &fullPath) {
|
||||||
|
fullPath = "";
|
||||||
|
if (RecursiveGetFullObjectName(ObjectRegistryDatabase::Instance(), obj, fullPath)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CLASS_REGISTER(DebugService, "1.0")
|
||||||
|
|
||||||
|
DebugService* DebugService::Instance() {
|
||||||
|
return GlobalDebugServiceInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PatchItemInternal(const char8* className, ObjectBuilder* builder) {
|
||||||
|
ClassRegistryDatabase *db = ClassRegistryDatabase::Instance();
|
||||||
|
ClassRegistryItem *item = (ClassRegistryItem*)db->Find(className);
|
||||||
|
if (item != NULL_PTR(ClassRegistryItem*)) {
|
||||||
|
item->SetObjectBuilder(builder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 DebugService::ForceSignal(const char8* name, const char8* valueStr) {
|
||||||
|
mutex.FastLock(); uint32 count = 0;
|
||||||
|
for (uint32 i = 0; i < numberOfAliases; i++) {
|
||||||
|
if (aliases[i].name == name || SuffixMatch(aliases[i].name.Buffer(), name)) {
|
||||||
|
DebugSignalInfo &s = signals[aliases[i].signalIndex]; s.isForcing = true;
|
||||||
|
AnyType dest(s.type, 0u, s.forcedValue); AnyType source(CharString, 0u, valueStr); (void)TypeConvert(dest, source);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mutex.FastUnLock(); return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 DebugService::UnforceSignal(const char8* name) {
|
||||||
|
mutex.FastLock(); uint32 count = 0;
|
||||||
|
for (uint32 i = 0; i < numberOfAliases; i++) {
|
||||||
|
if (aliases[i].name == name || SuffixMatch(aliases[i].name.Buffer(), name)) { signals[aliases[i].signalIndex].isForcing = false; count++; }
|
||||||
|
}
|
||||||
|
mutex.FastUnLock(); return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 DebugService::TraceSignal(const char8* name, bool enable, uint32 decimation) {
|
||||||
|
mutex.FastLock(); uint32 count = 0;
|
||||||
|
for (uint32 i = 0; i < numberOfAliases; i++) {
|
||||||
|
if (aliases[i].name == name || SuffixMatch(aliases[i].name.Buffer(), name)) {
|
||||||
|
uint32 sigIdx = aliases[i].signalIndex;
|
||||||
|
DebugSignalInfo &s = signals[sigIdx];
|
||||||
|
s.isTracing = enable;
|
||||||
|
s.decimationFactor = decimation;
|
||||||
|
s.decimationCounter = 0;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mutex.FastUnLock(); return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorManagement::ErrorType DebugService::Execute(ExecutionInfo & info) {
|
||||||
|
return ErrorManagement::FatalError;
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorManagement::ErrorType DebugService::Server(ExecutionInfo & info) {
|
||||||
|
if (info.GetStage() == ExecutionInfo::TerminationStage) return ErrorManagement::NoError;
|
||||||
|
if (info.GetStage() == ExecutionInfo::StartupStage) { serverThreadId = Threads::Id(); return ErrorManagement::NoError; }
|
||||||
|
while (info.GetStage() == ExecutionInfo::MainStage) {
|
||||||
|
BasicTCPSocket *newClient = tcpServer.WaitConnection(10);
|
||||||
|
if (newClient != NULL_PTR(BasicTCPSocket *)) {
|
||||||
|
clientsMutex.FastLock(); bool added = false;
|
||||||
|
for (uint32 i=0; i<MAX_CLIENTS; i++) { if (activeClients[i] == NULL_PTR(BasicTCPSocket*)) { activeClients[i] = newClient; added = true; break; } }
|
||||||
|
clientsMutex.FastUnLock();
|
||||||
|
if (!added) { newClient->Close(); delete newClient; }
|
||||||
|
}
|
||||||
|
for (uint32 i=0; i<MAX_CLIENTS; i++) {
|
||||||
|
BasicTCPSocket *client = NULL_PTR(BasicTCPSocket*);
|
||||||
|
clientsMutex.FastLock(); client = activeClients[i]; clientsMutex.FastUnLock();
|
||||||
|
if (client != NULL_PTR(BasicTCPSocket*)) {
|
||||||
|
char buffer[1024]; uint32 size = 1024; TimeoutType timeout(0);
|
||||||
|
if (client->Read(buffer, size, timeout) && size > 0) {
|
||||||
|
StreamString command; command.Write(buffer, size); HandleCommand(command, client);
|
||||||
|
} else if (!client->IsValid()) {
|
||||||
|
clientsMutex.FastLock(); client->Close(); delete client; activeClients[i] = NULL_PTR(BasicTCPSocket*); clientsMutex.FastUnLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Sleep::MSec(10);
|
||||||
|
}
|
||||||
|
return ErrorManagement::NoError;
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorManagement::ErrorType DebugService::Streamer(ExecutionInfo & info) {
|
||||||
|
if (info.GetStage() == ExecutionInfo::TerminationStage) return ErrorManagement::NoError;
|
||||||
|
if (info.GetStage() == ExecutionInfo::StartupStage) { streamerThreadId = Threads::Id(); return ErrorManagement::NoError; }
|
||||||
|
InternetHost dest(streamPort, streamIP.Buffer());
|
||||||
|
(void)udpSocket.SetDestination(dest);
|
||||||
|
uint8 packetBuffer[4096]; uint32 packetOffset = 0; uint32 sequenceNumber = 0;
|
||||||
|
while (info.GetStage() == ExecutionInfo::MainStage) {
|
||||||
|
uint32 id, size; uint64 ts; uint8 sampleData[1024]; bool hasData = false;
|
||||||
|
while ((info.GetStage() == ExecutionInfo::MainStage) && traceBuffer.Pop(id, ts, sampleData, size, 1024)) {
|
||||||
|
hasData = true;
|
||||||
|
if (packetOffset == 0) {
|
||||||
|
TraceHeader header; header.magic = 0xDA7A57AD; header.seq = sequenceNumber++; header.timestamp = HighResolutionTimer::Counter(); header.count = 0;
|
||||||
|
std::memcpy(packetBuffer, &header, sizeof(TraceHeader)); packetOffset = sizeof(TraceHeader);
|
||||||
|
}
|
||||||
|
if (packetOffset + 16 + size > 1400) {
|
||||||
|
uint32 toWrite = packetOffset; (void)udpSocket.Write((char8*)packetBuffer, toWrite);
|
||||||
|
TraceHeader header; header.magic = 0xDA7A57AD; header.seq = sequenceNumber++; header.timestamp = HighResolutionTimer::Counter(); header.count = 0;
|
||||||
|
std::memcpy(packetBuffer, &header, sizeof(TraceHeader)); packetOffset = sizeof(TraceHeader);
|
||||||
|
}
|
||||||
|
std::memcpy(&packetBuffer[packetOffset], &id, 4);
|
||||||
|
std::memcpy(&packetBuffer[packetOffset + 4], &ts, 8);
|
||||||
|
std::memcpy(&packetBuffer[packetOffset + 12], &size, 4);
|
||||||
|
std::memcpy(&packetBuffer[packetOffset + 16], sampleData, size);
|
||||||
|
packetOffset += (16 + size);
|
||||||
|
((TraceHeader*)packetBuffer)->count++;
|
||||||
|
}
|
||||||
|
if (packetOffset > 0) { uint32 toWrite = packetOffset; (void)udpSocket.Write((char8*)packetBuffer, toWrite); packetOffset = 0; }
|
||||||
|
if (!hasData) Sleep::MSec(1);
|
||||||
|
}
|
||||||
|
return ErrorManagement::NoError;
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugService::DebugService() :
|
||||||
|
ReferenceContainer(), EmbeddedServiceMethodBinderI(),
|
||||||
|
binderServer(this, ServiceBinder::ServerType),
|
||||||
|
binderStreamer(this, ServiceBinder::StreamerType),
|
||||||
|
threadService(binderServer),
|
||||||
|
streamerService(binderStreamer)
|
||||||
|
{
|
||||||
|
GlobalDebugServiceInstance = this;
|
||||||
|
controlPort = 0;
|
||||||
|
streamPort = 8081;
|
||||||
|
streamIP = "127.0.0.1";
|
||||||
|
numberOfSignals = 0;
|
||||||
|
numberOfAliases = 0;
|
||||||
|
numberOfBrokers = 0;
|
||||||
|
isServer = false;
|
||||||
|
suppressTimeoutLogs = true;
|
||||||
|
isPaused = false;
|
||||||
|
for (uint32 i=0; i<MAX_CLIENTS; i++) {
|
||||||
|
activeClients[i] = NULL_PTR(BasicTCPSocket*);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Forced patching on library load
|
||||||
|
__attribute__((constructor))
|
||||||
|
static void GlobalDebugSuiteInit() {
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapInputBroker> B1; PatchItemInternal("MemoryMapInputBroker", new B1());
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapOutputBroker> B2; PatchItemInternal("MemoryMapOutputBroker", new B2());
|
||||||
|
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapSynchronisedInputBroker> B3; PatchItemInternal("MemoryMapSynchronisedInputBroker", new B3());
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapSynchronisedOutputBroker> B4; PatchItemInternal("MemoryMapSynchronisedOutputBroker", new B4());
|
||||||
|
|
||||||
|
typedef DebugBrokerBuilder<DebugMemoryMapInterpolatedInputBroker> B5; PatchItemInternal("MemoryMapInterpolatedInputBroker", new B5());
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugService::~DebugService() {
|
||||||
|
if (GlobalDebugServiceInstance == this) GlobalDebugServiceInstance = NULL_PTR(DebugService*);
|
||||||
|
threadService.Stop(); streamerService.Stop();
|
||||||
|
tcpServer.Close(); udpSocket.Close();
|
||||||
|
for (uint32 i=0; i<MAX_CLIENTS; i++) {
|
||||||
|
if (activeClients[i] != NULL_PTR(BasicTCPSocket*)) { activeClients[i]->Close(); delete activeClients[i]; }
|
||||||
|
}
|
||||||
|
for (uint32 i=0; i<numberOfBrokers; i++) {
|
||||||
|
for (uint32 j=0; j<2; j++) {
|
||||||
|
if (brokers[i].sets[j].forcedSignals) delete[] brokers[i].sets[j].forcedSignals;
|
||||||
|
if (brokers[i].sets[j].tracedSignals) delete[] brokers[i].sets[j].tracedSignals;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DebugService::Initialise(StructuredDataI & data) {
|
||||||
|
if (!ReferenceContainer::Initialise(data)) return false;
|
||||||
|
if (!data.Read("ControlPort", controlPort)) (void)data.Read("TcpPort", controlPort);
|
||||||
|
if (controlPort > 0) { isServer = true; GlobalDebugServiceInstance = this; }
|
||||||
|
if (!data.Read("StreamPort", streamPort)) (void)data.Read("UdpPort", streamPort);
|
||||||
|
StreamString tempIP; if (data.Read("StreamIP", tempIP)) streamIP = tempIP; else streamIP = "127.0.0.1";
|
||||||
|
uint32 suppress = 1; if (data.Read("SuppressTimeoutLogs", suppress)) suppressTimeoutLogs = (suppress == 1);
|
||||||
|
|
||||||
|
if (isServer) {
|
||||||
|
if (!traceBuffer.Init(8 * 1024 * 1024)) return false;
|
||||||
|
ConfigurationDatabase threadData; threadData.Write("Timeout", (uint32)1000);
|
||||||
|
threadService.Initialise(threadData); streamerService.Initialise(threadData);
|
||||||
|
if (!tcpServer.Open()) return false;
|
||||||
|
if (!tcpServer.Listen(controlPort)) return false;
|
||||||
|
printf("[DebugService] TCP Server listening on port %u\n", controlPort);
|
||||||
|
if (!udpSocket.Open()) return false;
|
||||||
|
printf("[DebugService] UDP Streamer socket opened\n");
|
||||||
|
if (threadService.Start() != ErrorManagement::NoError) return false;
|
||||||
|
if (streamerService.Start() != ErrorManagement::NoError) return false;
|
||||||
|
printf("[DebugService] Worker threads started.\n");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugService::PatchRegistry() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugService::ProcessSignal(DebugSignalInfo* s, uint32 size, uint64 timestamp) {
|
||||||
|
if (s == NULL_PTR(DebugSignalInfo*)) return;
|
||||||
|
if (s->isForcing) CopySignal(s->memoryAddress, s->forcedValue, size);
|
||||||
|
if (s->isTracing) {
|
||||||
|
if (s->decimationFactor <= 1) (void)traceBuffer.Push(s->internalID, timestamp, s->memoryAddress, size);
|
||||||
|
else {
|
||||||
|
if (s->decimationCounter == 0) { (void)traceBuffer.Push(s->internalID, timestamp, s->memoryAddress, size); s->decimationCounter = s->decimationFactor - 1; }
|
||||||
|
else s->decimationCounter--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugService::RegisterBroker(DebugSignalInfo** signalPointers, uint32 numSignals, MemoryMapBroker* broker, volatile bool* anyActiveFlag) {
|
||||||
|
mutex.FastLock();
|
||||||
|
for (uint32 i=0; i<numberOfBrokers; i++) { if (brokers[i].broker == broker) { mutex.FastUnLock(); return; } }
|
||||||
|
if (numberOfBrokers < MAX_BROKERS) {
|
||||||
|
printf("[DebugService] Registering Broker %u (%u signals, anyActiveFlag=%p)\n", numberOfBrokers, numSignals, (void*)anyActiveFlag);
|
||||||
|
brokers[numberOfBrokers].signalPointers = signalPointers;
|
||||||
|
brokers[numberOfBrokers].numSignals = numSignals;
|
||||||
|
brokers[numberOfBrokers].broker = broker;
|
||||||
|
brokers[numberOfBrokers].anyActiveFlag = anyActiveFlag;
|
||||||
|
brokers[numberOfBrokers].currentSetIdx = 0;
|
||||||
|
for (uint32 j=0; j<2; j++) {
|
||||||
|
brokers[numberOfBrokers].sets[j].numForced = 0; brokers[numberOfBrokers].sets[j].numTraced = 0;
|
||||||
|
brokers[numberOfBrokers].sets[j].forcedSignals = NULL_PTR(SignalExecuteInfo*); brokers[numberOfBrokers].sets[j].tracedSignals = NULL_PTR(SignalExecuteInfo*);
|
||||||
|
}
|
||||||
|
numberOfBrokers++;
|
||||||
|
}
|
||||||
|
mutex.FastUnLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void AdoptOrphans(ReferenceContainer *container, DebugService* service) {
|
||||||
|
if (!container) return;
|
||||||
|
for (uint32 i=0; i<container->Size(); i++) {
|
||||||
|
Reference child = container->Get(i);
|
||||||
|
if (child.IsValid()) {
|
||||||
|
DebugBrokerI* b = dynamic_cast<DebugBrokerI*>(child.operator->());
|
||||||
|
if (b && !b->IsLinked()) {
|
||||||
|
b->SetService(service);
|
||||||
|
}
|
||||||
|
ReferenceContainer *inner = dynamic_cast<ReferenceContainer*>(child.operator->());
|
||||||
|
if (inner) AdoptOrphans(inner, service);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugService::UpdateBrokersActiveStatus() {
|
||||||
|
AdoptOrphans(ObjectRegistryDatabase::Instance(), this);
|
||||||
|
for (uint32 i = 0; i < numberOfBrokers; i++) {
|
||||||
|
uint32 nextIdx = (brokers[i].currentSetIdx + 1) % 2;
|
||||||
|
BrokerActiveSet& nextSet = brokers[i].sets[nextIdx];
|
||||||
|
uint32 forcedCount = 0; uint32 tracedCount = 0;
|
||||||
|
for (uint32 j = 0; j < brokers[i].numSignals; j++) {
|
||||||
|
DebugSignalInfo *s = brokers[i].signalPointers[j];
|
||||||
|
if (s != NULL_PTR(DebugSignalInfo*)) {
|
||||||
|
if (s->isForcing) forcedCount++;
|
||||||
|
if (s->isTracing) tracedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SignalExecuteInfo* newForced = (forcedCount > 0) ? new SignalExecuteInfo[forcedCount] : NULL_PTR(SignalExecuteInfo*);
|
||||||
|
SignalExecuteInfo* newTraced = (tracedCount > 0) ? new SignalExecuteInfo[tracedCount] : NULL_PTR(SignalExecuteInfo*);
|
||||||
|
uint32 fIdx = 0; uint32 tIdx = 0;
|
||||||
|
for (uint32 j = 0; j < brokers[i].numSignals; j++) {
|
||||||
|
DebugSignalInfo *s = brokers[i].signalPointers[j];
|
||||||
|
if (s != NULL_PTR(DebugSignalInfo*)) {
|
||||||
|
uint32 size = (brokers[i].broker != NULL_PTR(MemoryMapBroker*)) ? brokers[i].broker->GetCopyByteSize(j) : 4;
|
||||||
|
if (s->isForcing) { newForced[fIdx].memoryAddress = s->memoryAddress; newForced[fIdx].forcedValue = s->forcedValue; newForced[fIdx].size = size; fIdx++; }
|
||||||
|
if (s->isTracing) { newTraced[tIdx].memoryAddress = s->memoryAddress; newTraced[tIdx].internalID = s->internalID; newTraced[tIdx].size = size; tIdx++; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SignalExecuteInfo* oldForced = nextSet.forcedSignals; SignalExecuteInfo* oldTraced = nextSet.tracedSignals;
|
||||||
|
nextSet.forcedSignals = newForced; nextSet.tracedSignals = newTraced; nextSet.numForced = forcedCount; nextSet.numTraced = tracedCount;
|
||||||
|
Atomic::Exchange((int32*)&brokers[i].currentSetIdx, (int32)nextIdx);
|
||||||
|
if (brokers[i].anyActiveFlag) *(brokers[i].anyActiveFlag) = (forcedCount > 0 || tracedCount > 0);
|
||||||
|
if (oldForced) delete[] oldForced; if (oldTraced) delete[] oldTraced;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugSignalInfo* DebugService::RegisterSignal(void* memoryAddress, TypeDescriptor type, const char8* name) {
|
||||||
|
mutex.FastLock();
|
||||||
|
DebugSignalInfo* res = NULL_PTR(DebugSignalInfo*); uint32 sigIdx = 0xFFFFFFFF;
|
||||||
|
for (uint32 i=0; i<numberOfAliases; i++) {
|
||||||
|
if (aliases[i].name == name) {
|
||||||
|
sigIdx = aliases[i].signalIndex; res = &signals[sigIdx];
|
||||||
|
if (res->memoryAddress == NULL && memoryAddress != NULL) res->memoryAddress = memoryAddress;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (res == NULL_PTR(DebugSignalInfo*) && numberOfSignals < MAX_SIGNALS) {
|
||||||
|
sigIdx = numberOfSignals; res = &signals[numberOfSignals];
|
||||||
|
res->memoryAddress = memoryAddress; res->type = type; res->name = name;
|
||||||
|
res->isTracing = false; res->isForcing = false; res->internalID = numberOfSignals;
|
||||||
|
res->decimationFactor = 1; res->decimationCounter = 0; numberOfSignals++;
|
||||||
|
}
|
||||||
|
if (sigIdx != 0xFFFFFFFF && numberOfAliases < MAX_ALIASES) {
|
||||||
|
bool foundAlias = false;
|
||||||
|
for (uint32 i=0; i<numberOfAliases; i++) { if (aliases[i].name == name) { foundAlias = true; break; } }
|
||||||
|
if (!foundAlias) { aliases[numberOfAliases].name = name; aliases[numberOfAliases].signalIndex = sigIdx; numberOfAliases++; }
|
||||||
|
}
|
||||||
|
mutex.FastUnLock(); return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void RecursivePopulate(ReferenceContainer *container, DebugService* service) {
|
||||||
|
if (!container) return;
|
||||||
|
for (uint32 i=0; i<container->Size(); i++) {
|
||||||
|
Reference child = container->Get(i);
|
||||||
|
if (child.IsValid()) {
|
||||||
|
DataSourceI *ds = dynamic_cast<DataSourceI*>(child.operator->());
|
||||||
|
if (ds) {
|
||||||
|
StreamString dsPath;
|
||||||
|
if (DebugService::GetFullObjectName(*ds, dsPath)) {
|
||||||
|
for (uint32 j=0; j<ds->GetNumberOfSignals(); j++) {
|
||||||
|
StreamString sname; (void)ds->GetSignalName(j, sname);
|
||||||
|
StreamString fullName = dsPath; fullName += "."; fullName += sname;
|
||||||
|
service->RegisterSignal(NULL, ds->GetSignalType(j), fullName.Buffer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ReferenceContainer *inner = dynamic_cast<ReferenceContainer*>(child.operator->());
|
||||||
|
if (inner) RecursivePopulate(inner, service);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugService::Discover(BasicTCPSocket *client) {
|
||||||
|
if (client) {
|
||||||
|
RecursivePopulate(ObjectRegistryDatabase::Instance(), this);
|
||||||
|
StreamString json; json = "{\n \"Signals\": [\n";
|
||||||
|
mutex.FastLock();
|
||||||
|
for (uint32 i = 0; i < numberOfAliases; i++) {
|
||||||
|
DebugSignalInfo &sig = signals[aliases[i].signalIndex];
|
||||||
|
const char8* typeName = TypeDescriptor::GetTypeNameFromTypeDescriptor(sig.type);
|
||||||
|
StreamString line;
|
||||||
|
line.Printf(" {\"name\": \"%s\", \"id\": %u, \"type\": \"%s\", \"ready\": %s}",
|
||||||
|
aliases[i].name.Buffer(), sig.internalID, typeName ? typeName : "Unknown", (sig.memoryAddress != NULL) ? "true" : "false");
|
||||||
|
json += line; if (i < numberOfAliases - 1) json += ","; json += "\n";
|
||||||
|
}
|
||||||
|
mutex.FastUnLock();
|
||||||
|
json += " ]\n}\nOK DISCOVER\n"; uint32 s = json.Size(); (void)client->Write(json.Buffer(), s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugService::HandleCommand(StreamString cmd, BasicTCPSocket *client) {
|
||||||
|
StreamString token; cmd.Seek(0); char8 term; const char8* delims = " \r\n";
|
||||||
|
if (cmd.GetToken(token, delims, term)) {
|
||||||
|
if (token == "FORCE") {
|
||||||
|
StreamString name, val;
|
||||||
|
if (cmd.GetToken(name, delims, term) && cmd.GetToken(val, delims, term)) {
|
||||||
|
uint32 count = ForceSignal(name.Buffer(), val.Buffer());
|
||||||
|
if (client) { StreamString resp; resp.Printf("OK FORCE %u\n", count); uint32 s = resp.Size(); (void)client->Write(resp.Buffer(), s); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (token == "UNFORCE") {
|
||||||
|
StreamString name; if (cmd.GetToken(name, delims, term)) {
|
||||||
|
uint32 count = UnforceSignal(name.Buffer());
|
||||||
|
if (client) { StreamString resp; resp.Printf("OK UNFORCE %u\n", count); uint32 s = resp.Size(); (void)client->Write(resp.Buffer(), s); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (token == "TRACE") {
|
||||||
|
StreamString name, state, decim;
|
||||||
|
if (cmd.GetToken(name, delims, term) && cmd.GetToken(state, delims, term)) {
|
||||||
|
bool enable = (state == "1"); uint32 d = 1;
|
||||||
|
if (cmd.GetToken(decim, delims, term)) {
|
||||||
|
AnyType decimVal(UnsignedInteger32Bit, 0u, &d); AnyType decimStr(CharString, 0u, decim.Buffer()); (void)TypeConvert(decimVal, decimStr);
|
||||||
|
}
|
||||||
|
uint32 count = TraceSignal(name.Buffer(), enable, d);
|
||||||
|
if (client) { StreamString resp; resp.Printf("OK TRACE %u\n", count); uint32 s = resp.Size(); (void)client->Write(resp.Buffer(), s); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (token == "DISCOVER") Discover(client);
|
||||||
|
else if (token == "PAUSE") { SetPaused(true); if (client) { uint32 s = 3; (void)client->Write("OK\n", s); } }
|
||||||
|
else if (token == "RESUME") { SetPaused(false); if (client) { uint32 s = 3; (void)client->Write("OK\n", s); } }
|
||||||
|
else if (token == "TREE") {
|
||||||
|
StreamString json; json = "{\"Name\": \"Root\", \"Class\": \"ObjectRegistryDatabase\", \"Children\": [\n";
|
||||||
|
(void)ExportTree(ObjectRegistryDatabase::Instance(), json); json += "\n]}\nOK TREE\n";
|
||||||
|
uint32 s = json.Size(); if (client) (void)client->Write(json.Buffer(), s);
|
||||||
|
}
|
||||||
|
else if (token == "INFO") { StreamString path; if (cmd.GetToken(path, delims, term)) InfoNode(path.Buffer(), client); }
|
||||||
|
else if (token == "LS") {
|
||||||
|
StreamString path; if (cmd.GetToken(path, delims, term)) ListNodes(path.Buffer(), client); else ListNodes(NULL_PTR(const char8*), client);
|
||||||
|
}
|
||||||
|
UpdateBrokersActiveStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugService::InfoNode(const char8* path, BasicTCPSocket *client) {
|
||||||
|
if (!client) return;
|
||||||
|
Reference ref = ObjectRegistryDatabase::Instance()->Find(path); StreamString json = "{";
|
||||||
|
if (ref.IsValid()) {
|
||||||
|
json += "\"Name\": \""; EscapeJson(ref->GetName(), json); json += "\", \"Class\": \""; EscapeJson(ref->GetClassProperties()->GetName(), json); json += "\"";
|
||||||
|
ConfigurationDatabase db; if (ref->ExportData(db)) {
|
||||||
|
json += ", \"Config\": {"; db.MoveToRoot(); uint32 nChildren = db.GetNumberOfChildren();
|
||||||
|
for (uint32 i=0; i<nChildren; i++) {
|
||||||
|
const char8* cname = db.GetChildName(i); AnyType at = db.GetType(cname); char8 valBuf[1024]; AnyType strType(CharString, 0u, valBuf); strType.SetNumberOfElements(0, 1024);
|
||||||
|
if (TypeConvert(strType, at)) { json += "\""; EscapeJson(cname, json); json += "\": \""; EscapeJson(valBuf, json); json += "\""; if (i < nChildren - 1) json += ", "; }
|
||||||
|
}
|
||||||
|
json += "}";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mutex.FastLock(); bool found = false;
|
||||||
|
for (uint32 i=0; i<numberOfAliases; i++) {
|
||||||
|
if (aliases[i].name == path || SuffixMatch(aliases[i].name.Buffer(), path)) {
|
||||||
|
DebugSignalInfo &s = signals[aliases[i].signalIndex]; const char8* tname = TypeDescriptor::GetTypeNameFromTypeDescriptor(s.type);
|
||||||
|
json.Printf("\"Name\": \"%s\", \"Class\": \"Signal\", \"Type\": \"%s\", \"ID\": %d", s.name.Buffer(), tname ? tname : "Unknown", s.internalID); found = true; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mutex.FastUnLock(); if (!found) json += "\"Error\": \"Object not found\"";
|
||||||
|
}
|
||||||
|
json += "}\nOK INFO\n"; uint32 s = json.Size(); (void)client->Write(json.Buffer(), s);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 DebugService::ExportTree(ReferenceContainer *container, StreamString &json) {
|
||||||
|
if (container == NULL_PTR(ReferenceContainer*)) return 0;
|
||||||
|
uint32 size = container->Size(); uint32 validCount = 0;
|
||||||
|
for (uint32 i = 0u; i < size; i++) {
|
||||||
|
Reference child = container->Get(i);
|
||||||
|
if (child.IsValid()) {
|
||||||
|
if (validCount > 0u) json += ",\n";
|
||||||
|
StreamString nodeJson; const char8* cname = child->GetName(); if (cname == NULL_PTR(const char8*)) cname = "unnamed";
|
||||||
|
nodeJson += "{\"Name\": \""; EscapeJson(cname, nodeJson); nodeJson += "\", \"Class\": \""; EscapeJson(child->GetClassProperties()->GetName(), nodeJson); nodeJson += "\"";
|
||||||
|
ReferenceContainer *inner = dynamic_cast<ReferenceContainer*>(child.operator->());
|
||||||
|
DataSourceI *ds = dynamic_cast<DataSourceI*>(child.operator->());
|
||||||
|
GAM *gam = dynamic_cast<GAM*>(child.operator->());
|
||||||
|
if ((inner != NULL_PTR(ReferenceContainer*)) || (ds != NULL_PTR(DataSourceI*)) || (gam != NULL_PTR(GAM*))) {
|
||||||
|
nodeJson += ", \"Children\": [\n"; uint32 subCount = 0u;
|
||||||
|
if (inner != NULL_PTR(ReferenceContainer*)) subCount += ExportTree(inner, nodeJson);
|
||||||
|
if (ds != NULL_PTR(DataSourceI*)) {
|
||||||
|
uint32 nSignals = ds->GetNumberOfSignals();
|
||||||
|
for (uint32 j = 0u; j < nSignals; j++) {
|
||||||
|
if (subCount > 0u) nodeJson += ",\n";
|
||||||
|
subCount++; StreamString sname; (void)ds->GetSignalName(j, sname);
|
||||||
|
const char8* stype = TypeDescriptor::GetTypeNameFromTypeDescriptor(ds->GetSignalType(j));
|
||||||
|
uint8 dims = 0u; (void)ds->GetSignalNumberOfDimensions(j, dims);
|
||||||
|
uint32 elems = 0u; (void)ds->GetSignalNumberOfElements(j, elems);
|
||||||
|
nodeJson += "{\"Name\": \""; EscapeJson(sname.Buffer(), nodeJson); nodeJson += "\", \"Class\": \"Signal\", \"Type\": \""; EscapeJson(stype ? stype : "Unknown", nodeJson); nodeJson.Printf("\", \"Dimensions\": %d, \"Elements\": %u}", dims, elems);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (gam != NULL_PTR(GAM*)) {
|
||||||
|
uint32 nIn = gam->GetNumberOfInputSignals();
|
||||||
|
for (uint32 j = 0u; j < nIn; j++) {
|
||||||
|
if (subCount > 0u) nodeJson += ",\n";
|
||||||
|
subCount++; StreamString sname; (void)gam->GetSignalName(InputSignals, j, sname);
|
||||||
|
const char8* stype = TypeDescriptor::GetTypeNameFromTypeDescriptor(gam->GetSignalType(InputSignals, j));
|
||||||
|
uint32 dims = 0u; (void)gam->GetSignalNumberOfDimensions(InputSignals, j, dims);
|
||||||
|
uint32 elems = 0u; (void)gam->GetSignalNumberOfElements(InputSignals, j, elems);
|
||||||
|
nodeJson += "{\"Name\": \"In."; EscapeJson(sname.Buffer(), nodeJson); nodeJson += "\", \"Class\": \"InputSignal\", \"Type\": \""; EscapeJson(stype ? stype : "Unknown", nodeJson); nodeJson.Printf("\", \"Dimensions\": %u, \"Elements\": %u}", dims, elems);
|
||||||
|
}
|
||||||
|
uint32 nOut = gam->GetNumberOfOutputSignals();
|
||||||
|
for (uint32 j = 0u; j < nOut; j++) {
|
||||||
|
if (subCount > 0u) nodeJson += ",\n";
|
||||||
|
subCount++; StreamString sname; (void)gam->GetSignalName(OutputSignals, j, sname);
|
||||||
|
const char8* stype = TypeDescriptor::GetTypeNameFromTypeDescriptor(gam->GetSignalType(OutputSignals, j));
|
||||||
|
uint32 dims = 0u; (void)gam->GetSignalNumberOfDimensions(OutputSignals, j, dims);
|
||||||
|
uint32 elems = 0u; (void)gam->GetSignalNumberOfElements(OutputSignals, j, elems);
|
||||||
|
nodeJson += "{\"Name\": \"Out."; EscapeJson(sname.Buffer(), nodeJson); nodeJson += "\", \"Class\": \"OutputSignal\", \"Type\": \""; EscapeJson(stype ? stype : "Unknown", nodeJson); nodeJson.Printf("\", \"Dimensions\": %u, \"Elements\": %u}", dims, elems);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nodeJson += "\n]";
|
||||||
|
}
|
||||||
|
nodeJson += "}"; json += nodeJson; validCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return validCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,3 +1,19 @@
|
|||||||
|
+DebugService = {
|
||||||
|
Class = DebugService
|
||||||
|
ControlPort = 8080
|
||||||
|
UdpPort = 8081
|
||||||
|
StreamIP = "127.0.0.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
+LoggerService = {
|
||||||
|
Class = LoggerService
|
||||||
|
CPUs = 0x1
|
||||||
|
+DebugConsumer = {
|
||||||
|
Class = TcpLogger
|
||||||
|
Port = 8082
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+App = {
|
+App = {
|
||||||
Class = RealTimeApplication
|
Class = RealTimeApplication
|
||||||
+Functions = {
|
+Functions = {
|
||||||
@@ -31,7 +47,7 @@
|
|||||||
InputSignals = {
|
InputSignals = {
|
||||||
Counter = {
|
Counter = {
|
||||||
DataSource = TimerSlow
|
DataSource = TimerSlow
|
||||||
Frequency = 1
|
Frequency = 10
|
||||||
}
|
}
|
||||||
Time = {
|
Time = {
|
||||||
DataSource = TimerSlow
|
DataSource = TimerSlow
|
||||||
@@ -120,19 +136,3 @@
|
|||||||
TimingDataSource = DAMS
|
TimingDataSource = DAMS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+DebugService = {
|
|
||||||
Class = DebugService
|
|
||||||
ControlPort = 8080
|
|
||||||
UdpPort = 8081
|
|
||||||
StreamIP = "127.0.0.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
+LoggerService = {
|
|
||||||
Class = LoggerService
|
|
||||||
CPUs = 0x1
|
|
||||||
+DebugConsumer = {
|
|
||||||
Class = TcpLogger
|
|
||||||
Port = 8082
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
109
Test/Integration/BrokerExecuteTest.cpp
Normal file
109
Test/Integration/BrokerExecuteTest.cpp
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
#include "DebugService.h"
|
||||||
|
#include "DebugBrokerWrapper.h"
|
||||||
|
#include "MemoryMapInputBroker.h"
|
||||||
|
#include "ObjectRegistryDatabase.h"
|
||||||
|
#include "StandardParser.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
using namespace MARTe;
|
||||||
|
|
||||||
|
namespace MARTe {
|
||||||
|
|
||||||
|
class ManualDebugMemoryMapInputBroker : public DebugMemoryMapInputBroker {
|
||||||
|
public:
|
||||||
|
virtual bool Execute() {
|
||||||
|
if (infoPtr) DebugBrokerHelper::Process(service, *infoPtr);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
using MemoryMapBroker::copyTable;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MockDS : public DataSourceI {
|
||||||
|
public:
|
||||||
|
CLASS_REGISTER_DECLARATION()
|
||||||
|
MockDS() { SetName("MockDS"); }
|
||||||
|
virtual bool AllocateMemory() { return true; }
|
||||||
|
virtual uint32 GetNumberOfMemoryBuffers() { return 1; }
|
||||||
|
virtual bool GetSignalMemoryBuffer(const uint32 signalIdx, const uint32 bufferIdx, void *&signalAddress) {
|
||||||
|
static uint32 val = 0;
|
||||||
|
signalAddress = &val;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
virtual const char8 *GetBrokerName(StructuredDataI &data, const SignalDirection direction) { return "MemoryMapInputBroker"; }
|
||||||
|
virtual bool GetInputBrokers(ReferenceContainer &inputBrokers, const char8 *const functionName, void *const gamMem) { return true; }
|
||||||
|
virtual bool GetOutputBrokers(ReferenceContainer &outputBrokers, const char8 *const functionName, void *const gamMem) { return true; }
|
||||||
|
virtual bool PrepareNextState(const char8 *const currentStateName, const char8 *const nextStateName) { return true; }
|
||||||
|
virtual bool Synchronise() { return true; }
|
||||||
|
};
|
||||||
|
CLASS_REGISTER(MockDS, "1.0")
|
||||||
|
|
||||||
|
void RunTest() {
|
||||||
|
printf("--- Broker Execute Path Test (Isolated) ---\n");
|
||||||
|
|
||||||
|
DebugService* service = new DebugService();
|
||||||
|
service->traceBuffer.Init(1024 * 1024);
|
||||||
|
ConfigurationDatabase cfg;
|
||||||
|
cfg.Write("ControlPort", (uint32)0);
|
||||||
|
cfg.Write("StreamPort", (uint32)0);
|
||||||
|
assert(service->Initialise(cfg));
|
||||||
|
|
||||||
|
ObjectRegistryDatabase::Instance()->Insert(Reference(service));
|
||||||
|
|
||||||
|
MockDS ds;
|
||||||
|
uint32 gamMem = 42;
|
||||||
|
|
||||||
|
ManualDebugMemoryMapInputBroker* broker = new ManualDebugMemoryMapInputBroker();
|
||||||
|
broker->service = service;
|
||||||
|
|
||||||
|
printf("Manually bootstrapping Broker for testing...\n");
|
||||||
|
broker->copyTable = new MemoryMapBrokerCopyTableEntry[1];
|
||||||
|
broker->copyTable[0].copySize = 4;
|
||||||
|
broker->copyTable[0].dataSourcePointer = &gamMem;
|
||||||
|
broker->copyTable[0].gamPointer = &gamMem;
|
||||||
|
broker->copyTable[0].type = UnsignedInteger32Bit;
|
||||||
|
|
||||||
|
DebugSignalInfo** sigPtrs = NULL;
|
||||||
|
DebugBrokerHelper::InitSignals(NULL_PTR(BrokerI*), ds, service, sigPtrs, 1, broker->copyTable, "TestGAM", InputSignals, &broker->anyActive);
|
||||||
|
broker->infoPtr = &service->brokers[service->numberOfBrokers - 1];
|
||||||
|
|
||||||
|
printf("Broker ready. Registered signals in service: %u\n", service->numberOfSignals);
|
||||||
|
|
||||||
|
printf("Executing IDLE cycle...\n");
|
||||||
|
broker->Execute();
|
||||||
|
assert(service->traceBuffer.Count() == 0);
|
||||||
|
|
||||||
|
printf("Manually enabling TRACE for first signal...\n");
|
||||||
|
// Directly enable tracing on the signal info to bypass name matching
|
||||||
|
service->signals[0].isTracing = true;
|
||||||
|
service->signals[0].decimationFactor = 1;
|
||||||
|
service->signals[0].decimationCounter = 0;
|
||||||
|
|
||||||
|
printf("Updating brokers active status...\n");
|
||||||
|
service->UpdateBrokersActiveStatus();
|
||||||
|
assert(broker->anyActive == true);
|
||||||
|
|
||||||
|
printf("Executing TRACE cycle...\n");
|
||||||
|
broker->Execute();
|
||||||
|
|
||||||
|
uint32 rbCount = service->traceBuffer.Count();
|
||||||
|
printf("Trace Buffer Count: %u\n", rbCount);
|
||||||
|
|
||||||
|
if (rbCount > 0) {
|
||||||
|
printf("SUCCESS: Data reached Trace Buffer via Broker!\n");
|
||||||
|
uint32 rid, rsize; uint64 rts; uint32 rval;
|
||||||
|
assert(service->traceBuffer.Pop(rid, rts, &rval, rsize, 4));
|
||||||
|
printf("Value popped: %u (ID=%u, TS=%lu)\n", rval, rid, rts);
|
||||||
|
assert(rval == 42);
|
||||||
|
} else {
|
||||||
|
printf("FAILURE: Trace Buffer is still empty.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectRegistryDatabase::Instance()->Purge();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
MARTe::RunTest();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
20
Test/Integration/CMakeLists.txt
Normal file
20
Test/Integration/CMakeLists.txt
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
add_executable(IntegrationTest main.cpp)
|
||||||
|
target_link_libraries(IntegrationTest marte_dev ${MARTe2_LIB})
|
||||||
|
|
||||||
|
add_executable(TraceTest TraceTest.cpp)
|
||||||
|
target_link_libraries(TraceTest marte_dev ${MARTe2_LIB})
|
||||||
|
|
||||||
|
add_executable(ValidationTest ValidationTest.cpp)
|
||||||
|
target_link_libraries(ValidationTest marte_dev ${MARTe2_LIB} ${IOGAM_LIB} ${LinuxTimer_LIB})
|
||||||
|
|
||||||
|
add_executable(SchedulerTest SchedulerTest.cpp)
|
||||||
|
target_link_libraries(SchedulerTest marte_dev ${MARTe2_LIB} ${IOGAM_LIB} ${LinuxTimer_LIB})
|
||||||
|
|
||||||
|
add_executable(PerformanceTest PerformanceTest.cpp)
|
||||||
|
target_link_libraries(PerformanceTest marte_dev ${MARTe2_LIB})
|
||||||
|
|
||||||
|
add_executable(BrokerExecuteTest BrokerExecuteTest.cpp)
|
||||||
|
target_link_libraries(BrokerExecuteTest marte_dev ${MARTe2_LIB})
|
||||||
|
|
||||||
|
add_executable(FinalValidationTest FinalValidationTest.cpp)
|
||||||
|
target_link_libraries(FinalValidationTest marte_dev ${MARTe2_LIB} ${IOGAM_LIB} ${LinuxTimer_LIB} ${LoggerDataSource_LIB})
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
#include "BasicTCPSocket.h"
|
|
||||||
#include "DebugService.h"
|
|
||||||
#include "ObjectRegistryDatabase.h"
|
|
||||||
#include "StandardParser.h"
|
|
||||||
#include "StreamString.h"
|
|
||||||
#include "GlobalObjectsDatabase.h"
|
|
||||||
#include "RealTimeApplication.h"
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
using namespace MARTe;
|
|
||||||
|
|
||||||
const char8 * const config_command_text =
|
|
||||||
"DebugService = {"
|
|
||||||
" Class = DebugService "
|
|
||||||
" ControlPort = 8100 "
|
|
||||||
" UdpPort = 8101 "
|
|
||||||
" StreamIP = \"127.0.0.1\" "
|
|
||||||
" MyCustomField = \"HelloConfig\" "
|
|
||||||
"}"
|
|
||||||
"App = {"
|
|
||||||
" Class = RealTimeApplication "
|
|
||||||
" +Functions = {"
|
|
||||||
" Class = ReferenceContainer "
|
|
||||||
" +GAM1 = {"
|
|
||||||
" Class = IOGAM "
|
|
||||||
" CustomGAMField = \"GAMValue\" "
|
|
||||||
" InputSignals = {"
|
|
||||||
" Counter = { DataSource = Timer Type = uint32 Frequency = 1000 PVName = \"PROC:VAR:1\" }"
|
|
||||||
" }"
|
|
||||||
" OutputSignals = {"
|
|
||||||
" Counter = { DataSource = DDB Type = uint32 }"
|
|
||||||
" }"
|
|
||||||
" }"
|
|
||||||
" }"
|
|
||||||
" +Data = {"
|
|
||||||
" Class = ReferenceContainer "
|
|
||||||
" +Timer = { Class = LinuxTimer SleepTime = 1000 Signals = { Counter = { Type = uint32 } } }"
|
|
||||||
" +DDB = { Class = GAMDataSource Signals = { Counter = { Type = uint32 } } }"
|
|
||||||
" +DAMS = { Class = TimingDataSource }"
|
|
||||||
" }"
|
|
||||||
" +States = {"
|
|
||||||
" Class = ReferenceContainer "
|
|
||||||
" +State1 = { Class = RealTimeState +Threads = { Class = ReferenceContainer +Thread1 = { Class = RealTimeThread Functions = {GAM1} } } }"
|
|
||||||
" }"
|
|
||||||
" +Scheduler = { Class = GAMScheduler TimingDataSource = DAMS }"
|
|
||||||
"}";
|
|
||||||
|
|
||||||
static bool SendCommandAndGetReply(uint16 port, const char8* cmd, StreamString &reply) {
|
|
||||||
BasicTCPSocket client;
|
|
||||||
if (!client.Open()) return false;
|
|
||||||
if (!client.Connect("127.0.0.1", port)) return false;
|
|
||||||
|
|
||||||
uint32 s = StringHelper::Length(cmd);
|
|
||||||
if (!client.Write(cmd, s)) return false;
|
|
||||||
|
|
||||||
char buffer[4096];
|
|
||||||
uint32 size = 4096;
|
|
||||||
TimeoutType timeout(2000000); // 2s
|
|
||||||
if (client.Read(buffer, size, timeout)) {
|
|
||||||
reply.Write(buffer, size);
|
|
||||||
client.Close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
client.Close();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestConfigCommands() {
|
|
||||||
printf("--- MARTe2 Config & Metadata Enrichment Test ---\n");
|
|
||||||
|
|
||||||
ObjectRegistryDatabase::Instance()->Purge();
|
|
||||||
|
|
||||||
ConfigurationDatabase cdb;
|
|
||||||
StreamString ss = config_command_text;
|
|
||||||
ss.Seek(0);
|
|
||||||
StandardParser parser(ss, cdb);
|
|
||||||
assert(parser.Parse());
|
|
||||||
|
|
||||||
cdb.MoveToRoot();
|
|
||||||
uint32 n = cdb.GetNumberOfChildren();
|
|
||||||
for (uint32 i=0; i<n; i++) {
|
|
||||||
const char8* name = cdb.GetChildName(i);
|
|
||||||
ConfigurationDatabase child;
|
|
||||||
cdb.MoveRelative(name);
|
|
||||||
cdb.Copy(child);
|
|
||||||
cdb.MoveToAncestor(1u);
|
|
||||||
StreamString className;
|
|
||||||
child.Read("Class", className);
|
|
||||||
Reference ref(className.Buffer(), GlobalObjectsDatabase::Instance()->GetStandardHeap());
|
|
||||||
ref->SetName(name);
|
|
||||||
assert(ref->Initialise(child));
|
|
||||||
ObjectRegistryDatabase::Instance()->Insert(ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Application and DebugService (port 8100) initialised.\n");
|
|
||||||
|
|
||||||
// Start the application to trigger broker execution and signal registration
|
|
||||||
ReferenceT<RealTimeApplication> app = ObjectRegistryDatabase::Instance()->Find("App");
|
|
||||||
if (app.IsValid()) {
|
|
||||||
if (app->ConfigureApplication()) {
|
|
||||||
if (app->PrepareNextState("State1") == ErrorManagement::NoError) {
|
|
||||||
if (app->StartNextStateExecution() == ErrorManagement::NoError) {
|
|
||||||
printf("Application started (for signal registration).\n");
|
|
||||||
Sleep::MSec(500); // Wait for some cycles
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ReferenceT<DebugService> service = ObjectRegistryDatabase::Instance()->Find("DebugService");
|
|
||||||
if (service.IsValid()) {
|
|
||||||
service->SetFullConfig(cdb);
|
|
||||||
}
|
|
||||||
|
|
||||||
Sleep::MSec(1000);
|
|
||||||
|
|
||||||
// 1. Test CONFIG command
|
|
||||||
{
|
|
||||||
printf("Testing CONFIG command...\n");
|
|
||||||
StreamString reply;
|
|
||||||
assert(SendCommandAndGetReply(8100, "CONFIG\n", reply));
|
|
||||||
printf("\n%s\n", reply.Buffer());
|
|
||||||
// Verify it contains some key parts of the config
|
|
||||||
assert(StringHelper::SearchString(reply.Buffer(), "MyCustomField") != NULL_PTR(const char8*));
|
|
||||||
assert(StringHelper::SearchString(reply.Buffer(), "HelloConfig") != NULL_PTR(const char8*));
|
|
||||||
assert(StringHelper::SearchString(reply.Buffer(), "PROC:VAR:1") != NULL_PTR(const char8*));
|
|
||||||
assert(StringHelper::SearchString(reply.Buffer(), "OK CONFIG") != NULL_PTR(const char8*));
|
|
||||||
printf("SUCCESS: CONFIG command validated.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Test INFO on object with enrichment
|
|
||||||
{
|
|
||||||
printf("Testing INFO on App.Functions.GAM1...\n");
|
|
||||||
StreamString reply;
|
|
||||||
assert(SendCommandAndGetReply(8100, "INFO App.Functions.GAM1\n", reply));
|
|
||||||
// Check standard MARTe fields (Name, Class)
|
|
||||||
assert(StringHelper::SearchString(reply.Buffer(), "\"Name\": \"GAM1\"") != NULL_PTR(const char8*));
|
|
||||||
// Check enriched fields from fullConfig
|
|
||||||
assert(StringHelper::SearchString(reply.Buffer(), "\"CustomGAMField\": \"GAMValue\"") != NULL_PTR(const char8*));
|
|
||||||
assert(StringHelper::SearchString(reply.Buffer(), "OK INFO") != NULL_PTR(const char8*));
|
|
||||||
printf("SUCCESS: Object metadata enrichment validated.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. Test INFO on signal with enrichment
|
|
||||||
{
|
|
||||||
printf("Testing INFO on App.Functions.GAM1.In.Counter...\n");
|
|
||||||
StreamString reply;
|
|
||||||
assert(SendCommandAndGetReply(8100, "INFO App.Functions.GAM1.In.Counter\n", reply));
|
|
||||||
|
|
||||||
// Check enriched fields from signal configuration
|
|
||||||
assert(StringHelper::SearchString(reply.Buffer(), "\"Frequency\": \"1000\"") != NULL_PTR(const char8*));
|
|
||||||
assert(StringHelper::SearchString(reply.Buffer(), "\"PVName\": \"PROC:VAR:1\"") != NULL_PTR(const char8*));
|
|
||||||
assert(StringHelper::SearchString(reply.Buffer(), "OK INFO") != NULL_PTR(const char8*));
|
|
||||||
printf("SUCCESS: Signal metadata enrichment validated.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (app.IsValid()) {
|
|
||||||
app->StopCurrentStateExecution();
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectRegistryDatabase::Instance()->Purge();
|
|
||||||
}
|
|
||||||
217
Test/Integration/FinalValidationTest.cpp
Normal file
217
Test/Integration/FinalValidationTest.cpp
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
#include "DebugService.h"
|
||||||
|
#include "DebugCore.h"
|
||||||
|
#include "ObjectRegistryDatabase.h"
|
||||||
|
#include "StandardParser.h"
|
||||||
|
#include "RealTimeApplication.h"
|
||||||
|
#include "GlobalObjectsDatabase.h"
|
||||||
|
#include "BasicUDPSocket.h"
|
||||||
|
#include "BasicTCPSocket.h"
|
||||||
|
#include "HighResolutionTimer.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
using namespace MARTe;
|
||||||
|
|
||||||
|
void RunFinalValidation() {
|
||||||
|
printf("--- MARTe2 Debug Final Validation (End-to-End) ---\n");
|
||||||
|
|
||||||
|
ObjectRegistryDatabase::Instance()->Purge();
|
||||||
|
|
||||||
|
// 1. Initialise DebugService FIRST
|
||||||
|
const char8 * const service_cfg =
|
||||||
|
"+DebugService = {"
|
||||||
|
" Class = DebugService "
|
||||||
|
" ControlPort = 8080 "
|
||||||
|
" UdpPort = 8081 "
|
||||||
|
" StreamIP = \"127.0.0.1\" "
|
||||||
|
"}";
|
||||||
|
|
||||||
|
StreamString ssSrv = service_cfg;
|
||||||
|
ssSrv.Seek(0);
|
||||||
|
ConfigurationDatabase cdbSrv;
|
||||||
|
StandardParser parserSrv(ssSrv, cdbSrv);
|
||||||
|
assert(parserSrv.Parse());
|
||||||
|
|
||||||
|
cdbSrv.MoveToRoot();
|
||||||
|
if (cdbSrv.MoveRelative("+DebugService")) {
|
||||||
|
ConfigurationDatabase child;
|
||||||
|
cdbSrv.Copy(child);
|
||||||
|
cdbSrv.MoveToAncestor(1u);
|
||||||
|
Reference ref("DebugService", GlobalObjectsDatabase::Instance()->GetStandardHeap());
|
||||||
|
ref->SetName("DebugService");
|
||||||
|
if (!ref->Initialise(child)) {
|
||||||
|
printf("ERROR: Failed to initialise DebugService\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ObjectRegistryDatabase::Instance()->Insert(ref);
|
||||||
|
printf("[Init] DebugService started.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Minimal App configuration
|
||||||
|
const char8 * const minimal_app_cfg =
|
||||||
|
"+App = {"
|
||||||
|
" Class = RealTimeApplication "
|
||||||
|
" +Functions = {"
|
||||||
|
" Class = ReferenceContainer "
|
||||||
|
" +GAM1 = {"
|
||||||
|
" Class = IOGAM "
|
||||||
|
" InputSignals = {"
|
||||||
|
" Counter = { DataSource = Timer Type = uint32 Frequency = 1000 }"
|
||||||
|
" }"
|
||||||
|
" OutputSignals = {"
|
||||||
|
" Counter = { DataSource = DDB Type = uint32 }"
|
||||||
|
" }"
|
||||||
|
" }"
|
||||||
|
" }"
|
||||||
|
" +Data = {"
|
||||||
|
" Class = ReferenceContainer "
|
||||||
|
" DefaultDataSource = DDB "
|
||||||
|
" +Timer = { Class = LinuxTimer SleepTime = 1000 Signals = { +Counter = { Type = uint32 } } }"
|
||||||
|
" +DDB = { Class = GAMDataSource Signals = { +Counter = { Type = uint32 } } }"
|
||||||
|
" +DAMS = { Class = TimingDataSource }"
|
||||||
|
" }"
|
||||||
|
" +States = {"
|
||||||
|
" Class = ReferenceContainer "
|
||||||
|
" +State1 = { Class = RealTimeState +Threads = { Class = ReferenceContainer +Thread1 = { Class = RealTimeThread Functions = {GAM1} } } }"
|
||||||
|
" }"
|
||||||
|
" +Scheduler = { Class = GAMScheduler TimingDataSource = DAMS }"
|
||||||
|
"}";
|
||||||
|
|
||||||
|
StreamString ssApp = minimal_app_cfg;
|
||||||
|
ssApp.Seek(0);
|
||||||
|
ConfigurationDatabase cdbApp;
|
||||||
|
StandardParser parserApp(ssApp, cdbApp);
|
||||||
|
assert(parserApp.Parse());
|
||||||
|
|
||||||
|
cdbApp.MoveToRoot();
|
||||||
|
if (cdbApp.MoveRelative("+App")) {
|
||||||
|
ConfigurationDatabase child;
|
||||||
|
cdbApp.Copy(child);
|
||||||
|
cdbApp.MoveToAncestor(1u);
|
||||||
|
Reference ref("RealTimeApplication", GlobalObjectsDatabase::Instance()->GetStandardHeap());
|
||||||
|
ref->SetName("App");
|
||||||
|
if (ref->Initialise(child)) {
|
||||||
|
ObjectRegistryDatabase::Instance()->Insert(ref);
|
||||||
|
printf("[Init] App object created.\n");
|
||||||
|
} else {
|
||||||
|
printf("ERROR: Failed to initialise App object.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference appRef = ObjectRegistryDatabase::Instance()->Find("App");
|
||||||
|
RealTimeApplication* app = dynamic_cast<RealTimeApplication*>(appRef.operator->());
|
||||||
|
|
||||||
|
// 3. Start Application
|
||||||
|
printf("Configuring Application...\n");
|
||||||
|
if (!app->ConfigureApplication()) {
|
||||||
|
printf("ERROR: ConfigureApplication failed.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
printf("Preparing State1...\n");
|
||||||
|
if (app->PrepareNextState("State1") != ErrorManagement::NoError) {
|
||||||
|
printf("ERROR: Failed to prepare State1.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
printf("Starting State1 Execution...\n");
|
||||||
|
if (app->StartNextStateExecution() != ErrorManagement::NoError) {
|
||||||
|
printf("ERROR: Failed to start State1 execution.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Application running. Starting client simulation...\n");
|
||||||
|
Sleep::MSec(1000);
|
||||||
|
|
||||||
|
// 4. Act as Client: Send Commands
|
||||||
|
BasicTCPSocket client;
|
||||||
|
if (client.Connect("127.0.0.1", 8080, TimeoutType(2000))) {
|
||||||
|
printf("[Client] Connected to DebugService.\n");
|
||||||
|
|
||||||
|
// Command 1: TREE
|
||||||
|
printf("[Client] Sending TREE...\n");
|
||||||
|
uint32 cmdLen = 5;
|
||||||
|
client.Write("TREE\n", cmdLen);
|
||||||
|
char buf[4096]; uint32 rsize = 4096;
|
||||||
|
if (client.Read(buf, rsize, TimeoutType(1000))) {
|
||||||
|
printf("[Client] TREE response received (%u bytes).\n", rsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Command 2: DISCOVER
|
||||||
|
printf("[Client] Sending DISCOVER...\n");
|
||||||
|
cmdLen = 9;
|
||||||
|
client.Write("DISCOVER\n", cmdLen);
|
||||||
|
rsize = 4096;
|
||||||
|
if (client.Read(buf, rsize, TimeoutType(1000))) {
|
||||||
|
buf[rsize] = '\0';
|
||||||
|
printf("[Client] DISCOVER response:\n%s\n", buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Command 3: TRACE
|
||||||
|
const char* target = "App.Data.Timer.Counter";
|
||||||
|
printf("[Client] Sending TRACE %s 1...\n", target);
|
||||||
|
StreamString traceCmd;
|
||||||
|
traceCmd.Printf("TRACE %s 1\n", target);
|
||||||
|
cmdLen = traceCmd.Size();
|
||||||
|
client.Write(traceCmd.Buffer(), cmdLen);
|
||||||
|
|
||||||
|
rsize = 1024;
|
||||||
|
if (client.Read(buf, rsize, TimeoutType(1000))) {
|
||||||
|
buf[rsize] = '\0';
|
||||||
|
printf("[Client] TRACE response: %s", buf);
|
||||||
|
}
|
||||||
|
client.Close();
|
||||||
|
} else {
|
||||||
|
printf("ERROR: Client failed to connect to 127.0.0.1:8080\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. Verify Telemetry
|
||||||
|
BasicUDPSocket telemListener;
|
||||||
|
assert(telemListener.Open());
|
||||||
|
assert(telemListener.Listen(8081));
|
||||||
|
|
||||||
|
printf("Listening for UDP Telemetry on 8081...\n");
|
||||||
|
uint32 totalSamples = 0;
|
||||||
|
uint64 startBench = HighResolutionTimer::Counter();
|
||||||
|
|
||||||
|
while (totalSamples < 50 && (HighResolutionTimer::Counter() - startBench) * HighResolutionTimer::Period() < 10.0) {
|
||||||
|
char packet[4096];
|
||||||
|
uint32 psize = 4096;
|
||||||
|
if (telemListener.Read(packet, psize, TimeoutType(100))) {
|
||||||
|
if (psize < 20) continue;
|
||||||
|
uint32 magic = *(uint32*)(&packet[0]);
|
||||||
|
if (magic != 0xDA7A57AD) continue;
|
||||||
|
|
||||||
|
uint32 count = *(uint32*)(&packet[16]);
|
||||||
|
uint32 offset = 20;
|
||||||
|
for (uint32 j=0; j<count; j++) {
|
||||||
|
if (offset + 16 > psize) break;
|
||||||
|
uint32 id = *(uint32*)(&packet[offset]);
|
||||||
|
uint64 ts = *(uint64*)(&packet[offset + 4]);
|
||||||
|
uint32 size = *(uint32*)(&packet[offset + 12]);
|
||||||
|
offset += 16;
|
||||||
|
if (offset + size > psize) break;
|
||||||
|
if (size == 4) {
|
||||||
|
uint32 val = *(uint32*)(&packet[offset]);
|
||||||
|
if (totalSamples % 10 == 0) printf("[Telemetry] Sample %u: ID=%u, TS=%lu, Val=%u\n", totalSamples, id, ts, val);
|
||||||
|
totalSamples++;
|
||||||
|
}
|
||||||
|
offset += size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (totalSamples >= 50) {
|
||||||
|
printf("\nSUCCESS: End-to-End pipeline verified with real MARTe2 app!\n");
|
||||||
|
} else {
|
||||||
|
printf("\nFAILURE: Received only %u samples in 10 seconds.\n", totalSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
app->StopCurrentStateExecution();
|
||||||
|
telemListener.Close();
|
||||||
|
ObjectRegistryDatabase::Instance()->Purge();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
RunFinalValidation();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1,314 +0,0 @@
|
|||||||
#include "ClassRegistryDatabase.h"
|
|
||||||
#include "ConfigurationDatabase.h"
|
|
||||||
#include "DebugService.h"
|
|
||||||
#include "ObjectRegistryDatabase.h"
|
|
||||||
#include "ErrorManagement.h"
|
|
||||||
#include "BasicTCPSocket.h"
|
|
||||||
#include "BasicUDPSocket.h"
|
|
||||||
#include "RealTimeApplication.h"
|
|
||||||
#include "StandardParser.h"
|
|
||||||
#include "StreamString.h"
|
|
||||||
#include "GlobalObjectsDatabase.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
using namespace MARTe;
|
|
||||||
|
|
||||||
#include <signal.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
void timeout_handler(int sig) {
|
|
||||||
printf("Test timed out!\n");
|
|
||||||
_exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ErrorProcessFunction(const MARTe::ErrorManagement::ErrorInformation &errorInfo, const char8 * const errorDescription) {
|
|
||||||
// printf("[MARTe Error] %s: %s\n", errorInfo.className, errorDescription);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Forward declarations of other tests
|
|
||||||
void TestSchedulerControl();
|
|
||||||
void TestFullTracePipeline();
|
|
||||||
void RunValidationTest();
|
|
||||||
void TestConfigCommands();
|
|
||||||
void TestGAMSignalTracing();
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
signal(SIGALRM, timeout_handler);
|
|
||||||
alarm(180);
|
|
||||||
|
|
||||||
MARTe::ErrorManagement::SetErrorProcessFunction(&ErrorProcessFunction);
|
|
||||||
|
|
||||||
printf("MARTe2 Debug Suite Integration Tests\n");
|
|
||||||
|
|
||||||
printf("\n--- Test 1: Registry Patching ---\n");
|
|
||||||
{
|
|
||||||
ObjectRegistryDatabase::Instance()->Purge();
|
|
||||||
DebugService service;
|
|
||||||
ConfigurationDatabase serviceData;
|
|
||||||
serviceData.Write("ControlPort", (uint32)9090);
|
|
||||||
service.Initialise(serviceData);
|
|
||||||
printf("DebugService initialized and Registry Patched.\n");
|
|
||||||
|
|
||||||
ClassRegistryItem *item =
|
|
||||||
ClassRegistryDatabase::Instance()->Find("MemoryMapInputBroker");
|
|
||||||
if (item != NULL_PTR(ClassRegistryItem *)) {
|
|
||||||
Object *obj = item->GetObjectBuilder()->Build(
|
|
||||||
GlobalObjectsDatabase::Instance()->GetStandardHeap());
|
|
||||||
if (obj != NULL_PTR(Object *)) {
|
|
||||||
printf("Instantiated Broker Class: %s\n",
|
|
||||||
obj->GetClassProperties()->GetName());
|
|
||||||
printf("Success: Broker patched and instantiated.\n");
|
|
||||||
} else {
|
|
||||||
printf("Failed to build broker\n");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printf("MemoryMapInputBroker not found in registry\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Sleep::MSec(1000);
|
|
||||||
|
|
||||||
printf("\n--- Test 2: Full Trace Pipeline ---\n");
|
|
||||||
TestFullTracePipeline();
|
|
||||||
Sleep::MSec(1000);
|
|
||||||
|
|
||||||
printf("\n--- Test 3: Scheduler Control ---\n");
|
|
||||||
TestSchedulerControl();
|
|
||||||
Sleep::MSec(1000);
|
|
||||||
|
|
||||||
printf("\n--- Test 4: 1kHz Lossless Trace Validation ---\n");
|
|
||||||
RunValidationTest();
|
|
||||||
Sleep::MSec(1000);
|
|
||||||
|
|
||||||
printf("\n--- Test 5: Config & Metadata Enrichment ---\n");
|
|
||||||
// TestConfigCommands(); // Skipping for now
|
|
||||||
Sleep::MSec(1000);
|
|
||||||
|
|
||||||
// printf("\n--- Test 6: GAM Signal Tracing ---\n");
|
|
||||||
// TestGAMSignalTracing();
|
|
||||||
// Sleep::MSec(1000);
|
|
||||||
|
|
||||||
printf("\nAll Integration Tests Finished.\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Test Implementation ---
|
|
||||||
|
|
||||||
const char8 * const debug_test_config =
|
|
||||||
"DebugService = {"
|
|
||||||
" Class = DebugService "
|
|
||||||
" ControlPort = 8095 "
|
|
||||||
" UdpPort = 8096 "
|
|
||||||
" StreamIP = \"127.0.0.1\" "
|
|
||||||
"}"
|
|
||||||
"App = {"
|
|
||||||
" Class = RealTimeApplication "
|
|
||||||
" +Functions = {"
|
|
||||||
" Class = ReferenceContainer "
|
|
||||||
" +GAM1 = {"
|
|
||||||
" Class = IOGAM "
|
|
||||||
" InputSignals = {"
|
|
||||||
" Counter = { DataSource = Timer Type = uint32 Frequency = 1000 }"
|
|
||||||
" }"
|
|
||||||
" OutputSignals = {"
|
|
||||||
" Counter = { DataSource = DDB Type = uint32 }"
|
|
||||||
" }"
|
|
||||||
" }"
|
|
||||||
" +GAM2 = {"
|
|
||||||
" Class = IOGAM "
|
|
||||||
" InputSignals = {"
|
|
||||||
" Counter = { DataSource = TimerSlow Type = uint32 Frequency = 10 }"
|
|
||||||
" }"
|
|
||||||
" OutputSignals = {"
|
|
||||||
" Counter = { DataSource = Logger Type = uint32 }"
|
|
||||||
" }"
|
|
||||||
" }"
|
|
||||||
" }"
|
|
||||||
" +Data = {"
|
|
||||||
" Class = ReferenceContainer "
|
|
||||||
" DefaultDataSource = DDB "
|
|
||||||
" +Timer = { Class = LinuxTimer SleepTime = 1000 Signals = { Counter = { Type = uint32 } } }"
|
|
||||||
" +TimerSlow = { Class = LinuxTimer SleepTime = 100000 Signals = { Counter = { Type = uint32 } } }"
|
|
||||||
" +Logger = { Class = LoggerDataSource Signals = { Counter = { Type = uint32 } } }"
|
|
||||||
" +DDB = { Class = GAMDataSource Signals = { Counter = { Type = uint32 } } }"
|
|
||||||
" +DAMS = { Class = TimingDataSource }"
|
|
||||||
" }"
|
|
||||||
" +States = {"
|
|
||||||
" Class = ReferenceContainer "
|
|
||||||
" +State1 = { Class = RealTimeState +Threads = { Class = ReferenceContainer +Thread1 = { Class = RealTimeThread Functions = {GAM1 GAM2} } } }"
|
|
||||||
" }"
|
|
||||||
" +Scheduler = { Class = GAMScheduler TimingDataSource = DAMS }"
|
|
||||||
"}";
|
|
||||||
|
|
||||||
bool SendCommandGAM(uint16 port, const char8* cmd, StreamString &reply) {
|
|
||||||
BasicTCPSocket client;
|
|
||||||
if (!client.Open()) return false;
|
|
||||||
if (!client.Connect("127.0.0.1", port)) return false;
|
|
||||||
|
|
||||||
uint32 s = StringHelper::Length(cmd);
|
|
||||||
if (!client.Write(cmd, s)) return false;
|
|
||||||
|
|
||||||
char buffer[4096];
|
|
||||||
uint32 size = 4096;
|
|
||||||
TimeoutType timeout(2000);
|
|
||||||
if (client.Read(buffer, size, timeout)) {
|
|
||||||
reply.Write(buffer, size);
|
|
||||||
client.Close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
client.Close();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestGAMSignalTracing() {
|
|
||||||
printf("--- Test: GAM Signal Tracing Issue ---\n");
|
|
||||||
|
|
||||||
ObjectRegistryDatabase::Instance()->Purge();
|
|
||||||
|
|
||||||
ConfigurationDatabase cdb;
|
|
||||||
StreamString ss = debug_test_config;
|
|
||||||
ss.Seek(0);
|
|
||||||
StandardParser parser(ss, cdb);
|
|
||||||
if (!parser.Parse()) {
|
|
||||||
printf("ERROR: Failed to parse config\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cdb.MoveToRoot();
|
|
||||||
uint32 n = cdb.GetNumberOfChildren();
|
|
||||||
for (uint32 i=0; i<n; i++) {
|
|
||||||
const char8* name = cdb.GetChildName(i);
|
|
||||||
ConfigurationDatabase child;
|
|
||||||
cdb.MoveRelative(name);
|
|
||||||
cdb.Copy(child);
|
|
||||||
cdb.MoveToAncestor(1u);
|
|
||||||
|
|
||||||
StreamString className;
|
|
||||||
child.Read("Class", className);
|
|
||||||
|
|
||||||
Reference ref(className.Buffer(), GlobalObjectsDatabase::Instance()->GetStandardHeap());
|
|
||||||
if (!ref.IsValid()) {
|
|
||||||
printf("ERROR: Could not create object %s of class %s\n", name, className.Buffer());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ref->SetName(name);
|
|
||||||
if (!ref->Initialise(child)) {
|
|
||||||
printf("ERROR: Failed to initialise object %s\n", name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ObjectRegistryDatabase::Instance()->Insert(ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReferenceT<DebugService> service = ObjectRegistryDatabase::Instance()->Find("DebugService");
|
|
||||||
if (!service.IsValid()) {
|
|
||||||
printf("ERROR: DebugService not found\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
service->SetFullConfig(cdb);
|
|
||||||
|
|
||||||
ReferenceT<RealTimeApplication> app = ObjectRegistryDatabase::Instance()->Find("App");
|
|
||||||
if (!app.IsValid()) {
|
|
||||||
printf("ERROR: App not found\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!app->ConfigureApplication()) {
|
|
||||||
printf("ERROR: ConfigureApplication failed.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (app->PrepareNextState("State1") != ErrorManagement::NoError) {
|
|
||||||
printf("ERROR: PrepareNextState failed.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (app->StartNextStateExecution() != ErrorManagement::NoError) {
|
|
||||||
printf("ERROR: StartNextStateExecution failed.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Application started.\n");
|
|
||||||
Sleep::MSec(1000);
|
|
||||||
|
|
||||||
// Step 1: Discover signals
|
|
||||||
{
|
|
||||||
StreamString reply;
|
|
||||||
if (SendCommandGAM(8095, "DISCOVER\n", reply)) {
|
|
||||||
printf("DISCOVER response received (len=%llu)\n", reply.Size());
|
|
||||||
} else {
|
|
||||||
printf("ERROR: DISCOVER failed\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Sleep::MSec(500);
|
|
||||||
|
|
||||||
// Step 2: Trace a DataSource signal (Timer.Counter)
|
|
||||||
printf("\n--- Step 1: Trace DataSource signal (Timer.Counter) ---\n");
|
|
||||||
{
|
|
||||||
StreamString reply;
|
|
||||||
if (SendCommandGAM(8095, "TRACE App.Data.Timer.Counter 1\n", reply)) {
|
|
||||||
printf("TRACE response: %s", reply.Buffer());
|
|
||||||
} else {
|
|
||||||
printf("ERROR: TRACE failed\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Sleep::MSec(500);
|
|
||||||
|
|
||||||
// Step 3: Trace a GAM input signal (GAM1.In.Counter)
|
|
||||||
printf("\n--- Step 2: Trace GAM input signal (GAM1.In.Counter) ---\n");
|
|
||||||
{
|
|
||||||
StreamString reply;
|
|
||||||
if (SendCommandGAM(8095, "TRACE App.Functions.GAM1.In.Counter 1\n", reply)) {
|
|
||||||
printf("TRACE response: %s", reply.Buffer());
|
|
||||||
} else {
|
|
||||||
printf("ERROR: TRACE failed\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Sleep::MSec(500);
|
|
||||||
|
|
||||||
// Step 4: Try to trace another DataSource signal (TimerSlow.Counter)
|
|
||||||
printf("\n--- Step 3: Try to trace another signal (TimerSlow.Counter) ---\n");
|
|
||||||
{
|
|
||||||
StreamString reply;
|
|
||||||
if (SendCommandGAM(8095, "TRACE App.Data.TimerSlow.Counter 1\n", reply)) {
|
|
||||||
printf("TRACE response: %s", reply.Buffer());
|
|
||||||
} else {
|
|
||||||
printf("ERROR: TRACE failed\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Sleep::MSec(500);
|
|
||||||
|
|
||||||
// Step 5: Check if we can still trace more signals
|
|
||||||
printf("\n--- Step 4: Try to trace Logger.Counter ---\n");
|
|
||||||
{
|
|
||||||
StreamString reply;
|
|
||||||
if (SendCommandGAM(8095, "TRACE App.Data.Logger.Counter 1\n", reply)) {
|
|
||||||
printf("TRACE response: %s", reply.Buffer());
|
|
||||||
} else {
|
|
||||||
printf("ERROR: TRACE failed\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Sleep::MSec(500);
|
|
||||||
|
|
||||||
// Verify UDP is still receiving data
|
|
||||||
BasicUDPSocket listener;
|
|
||||||
listener.Open();
|
|
||||||
listener.Listen(8096);
|
|
||||||
|
|
||||||
char buffer[1024];
|
|
||||||
uint32 size = 1024;
|
|
||||||
TimeoutType timeout(1000);
|
|
||||||
int packetCount = 0;
|
|
||||||
while (listener.Read(buffer, size, timeout)) {
|
|
||||||
packetCount++;
|
|
||||||
size = 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\n--- Results ---\n");
|
|
||||||
if (packetCount > 0) {
|
|
||||||
printf("SUCCESS: Received %d UDP packets.\n", packetCount);
|
|
||||||
} else {
|
|
||||||
printf("FAILURE: No UDP packets received. Possible deadlock or crash.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
app->StopCurrentStateExecution();
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
include Makefile.inc
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
OBJSX = SchedulerTest.x TraceTest.x ValidationTest.x ConfigCommandTest.x
|
|
||||||
|
|
||||||
PACKAGE = Test/Integration
|
|
||||||
|
|
||||||
ROOT_DIR = ../..
|
|
||||||
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
|
||||||
|
|
||||||
INCLUDES += -I$(ROOT_DIR)/Source/Core/Types/Result
|
|
||||||
INCLUDES += -I$(ROOT_DIR)/Source/Core/Types/Vec
|
|
||||||
INCLUDES += -I$(ROOT_DIR)/Source/Components/Interfaces/DebugService
|
|
||||||
INCLUDES += -I$(ROOT_DIR)/Source/Components/Interfaces/TCPLogger
|
|
||||||
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L0Types
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L1Portability
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L2Objects
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L3Streams
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Messages
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Logger
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Configuration
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L5GAMs
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L6App
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L1Portability
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L3Services
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4Messages
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4LoggerService
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L5GAMs
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L1Portability
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L3Streams
|
|
||||||
|
|
||||||
LIBRARIES += -L$(MARTe2_DIR)/Build/$(TARGET)/Core -lMARTe2
|
|
||||||
LIBRARIES += -L$(MARTe2_Components_DIR)/Build/$(TARGET)/Components/DataSources/LinuxTimer -lLinuxTimer
|
|
||||||
LIBRARIES += -L$(MARTe2_Components_DIR)/Build/$(TARGET)/Components/GAMs/IOGAM -lIOGAM
|
|
||||||
LIBRARIES += -L$(ROOT_DIR)/Build/$(TARGET)/Components/Interfaces/DebugService -lDebugService
|
|
||||||
LIBRARIES += -L$(ROOT_DIR)/Build/$(TARGET)/Components/Interfaces/TCPLogger -lTcpLogger
|
|
||||||
|
|
||||||
all: $(OBJS) $(BUILD_DIR)/IntegrationTests$(EXEEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
109
Test/Integration/PerformanceTest.cpp
Normal file
109
Test/Integration/PerformanceTest.cpp
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
#include "DebugService.h"
|
||||||
|
#include "DebugBrokerWrapper.h"
|
||||||
|
#include "MemoryMapInputBroker.h"
|
||||||
|
#include "HighResolutionTimer.h"
|
||||||
|
#include "ObjectRegistryDatabase.h"
|
||||||
|
#include "StandardParser.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
using namespace MARTe;
|
||||||
|
|
||||||
|
namespace MARTe {
|
||||||
|
void RunBenchmark() {
|
||||||
|
printf("--- MARTe2 Debug Performance Benchmark V5 (Wait-Free/Branchless) ---\n");
|
||||||
|
printf("Testing with 100 signals, 1,000,000 cycles per test.\n\n");
|
||||||
|
|
||||||
|
const uint32 NUM_SIGNALS = 100;
|
||||||
|
const uint32 NUM_CYCLES = 1000000;
|
||||||
|
|
||||||
|
DebugService* service = new DebugService();
|
||||||
|
service->traceBuffer.Init(128 * 1024 * 1024);
|
||||||
|
ConfigurationDatabase cfg;
|
||||||
|
cfg.Write("ControlPort", (uint32)0);
|
||||||
|
cfg.Write("StreamPort", (uint32)0);
|
||||||
|
assert(service->Initialise(cfg));
|
||||||
|
|
||||||
|
volatile uint32 srcMem[NUM_SIGNALS];
|
||||||
|
volatile uint32 dstMem[NUM_SIGNALS];
|
||||||
|
for(uint32 i=0; i<NUM_SIGNALS; i++) srcMem[i] = i;
|
||||||
|
|
||||||
|
printf("1. Baseline (Pure Copy): ");
|
||||||
|
uint64 start = HighResolutionTimer::Counter();
|
||||||
|
for(uint32 c=0; c<NUM_CYCLES; c++) {
|
||||||
|
for(uint32 i=0; i<NUM_SIGNALS; i++) {
|
||||||
|
dstMem[i] = srcMem[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uint64 end = HighResolutionTimer::Counter();
|
||||||
|
float64 baselineTime = (float64)(end - start) * HighResolutionTimer::Period();
|
||||||
|
float64 baselineNs = (baselineTime / NUM_CYCLES) * 1e9;
|
||||||
|
printf("%.3f ms (avg: %.3f ns)\n", baselineTime * 1000.0, baselineNs);
|
||||||
|
|
||||||
|
DebugMemoryMapInputBroker debugBroker;
|
||||||
|
debugBroker.service = service;
|
||||||
|
DebugSignalInfo** ptrs = new DebugSignalInfo*[NUM_SIGNALS];
|
||||||
|
for(uint32 i=0; i<NUM_SIGNALS; i++) {
|
||||||
|
StreamString name;
|
||||||
|
name = "Sig";
|
||||||
|
// Convert i to string without Printf
|
||||||
|
if (i < 10) { name += (char)('0' + i); }
|
||||||
|
else { name += (char)('0' + (i/10)); name += (char)('0' + (i%10)); }
|
||||||
|
|
||||||
|
ptrs[i] = service->RegisterSignal((void*)&srcMem[i], UnsignedInteger32Bit, name.Buffer());
|
||||||
|
}
|
||||||
|
volatile bool anyActiveFlag = false;
|
||||||
|
service->RegisterBroker(ptrs, NUM_SIGNALS, NULL_PTR(MemoryMapBroker*), &anyActiveFlag);
|
||||||
|
debugBroker.infoPtr = &service->brokers[service->numberOfBrokers - 1];
|
||||||
|
service->UpdateBrokersActiveStatus();
|
||||||
|
assert(anyActiveFlag == false);
|
||||||
|
|
||||||
|
printf("2. Debug Idle (Wait-Free Skip): ");
|
||||||
|
start = HighResolutionTimer::Counter();
|
||||||
|
for(uint32 c=0; c<NUM_CYCLES; c++) {
|
||||||
|
for(uint32 i=0; i<NUM_SIGNALS; i++) dstMem[i] = srcMem[i];
|
||||||
|
if (anyActiveFlag || service->IsPaused()) {
|
||||||
|
DebugBrokerHelper::Process(service, *debugBroker.infoPtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end = HighResolutionTimer::Counter();
|
||||||
|
float64 idleTime = (float64)(end - start) * HighResolutionTimer::Period();
|
||||||
|
float64 idleNs = (idleTime / NUM_CYCLES) * 1e9;
|
||||||
|
printf("%.3f ms (avg: %.3f ns) | Delta: +%.3f ns\n",
|
||||||
|
idleTime * 1000.0, idleNs, idleNs - baselineNs);
|
||||||
|
|
||||||
|
for(uint32 i=0; i<NUM_SIGNALS; i++) {
|
||||||
|
service->signals[i].isTracing = true;
|
||||||
|
}
|
||||||
|
service->UpdateBrokersActiveStatus();
|
||||||
|
assert(anyActiveFlag == true);
|
||||||
|
|
||||||
|
printf("3. Debug Load (100 signals branchless): ");
|
||||||
|
start = HighResolutionTimer::Counter();
|
||||||
|
for(uint32 c=0; c<NUM_CYCLES; c++) {
|
||||||
|
for(uint32 i=0; i<NUM_SIGNALS; i++) dstMem[i] = srcMem[i];
|
||||||
|
if (anyActiveFlag || service->IsPaused()) {
|
||||||
|
DebugBrokerHelper::Process(service, *debugBroker.infoPtr);
|
||||||
|
}
|
||||||
|
if ((c % 1000) == 0) {
|
||||||
|
uint32 tid, tsize; uint64 tts; uint8 tbuf[16];
|
||||||
|
while(service->traceBuffer.Pop(tid, tts, tbuf, tsize, 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end = HighResolutionTimer::Counter();
|
||||||
|
float64 loadTime = (float64)(end - start) * HighResolutionTimer::Period();
|
||||||
|
float64 loadNs = (loadTime / NUM_CYCLES) * 1e9;
|
||||||
|
printf("%.3f ms (avg: %.3f ns) | Delta: +%.3f ns (+%.3f ns/signal)\n",
|
||||||
|
loadTime * 1000.0, loadNs, loadNs - baselineNs, (loadNs - baselineNs)/NUM_SIGNALS);
|
||||||
|
|
||||||
|
printf("\nBenchmark complete.\n");
|
||||||
|
|
||||||
|
delete[] ptrs;
|
||||||
|
delete service;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
MARTe::RunBenchmark();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1,111 +1,95 @@
|
|||||||
#include "BasicTCPSocket.h"
|
|
||||||
#include "BasicUDPSocket.h"
|
|
||||||
#include "DebugService.h"
|
#include "DebugService.h"
|
||||||
|
#include "DebugCore.h"
|
||||||
#include "ObjectRegistryDatabase.h"
|
#include "ObjectRegistryDatabase.h"
|
||||||
#include "RealTimeApplication.h"
|
|
||||||
#include "StandardParser.h"
|
#include "StandardParser.h"
|
||||||
#include "StreamString.h"
|
#include "StreamString.h"
|
||||||
|
#include "BasicUDPSocket.h"
|
||||||
|
#include "BasicTCPSocket.h"
|
||||||
|
#include "RealTimeApplication.h"
|
||||||
#include "GlobalObjectsDatabase.h"
|
#include "GlobalObjectsDatabase.h"
|
||||||
|
#include "MessageI.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
|
|
||||||
const char8 * const scheduler_config_text =
|
const char8 * const config_text =
|
||||||
"DebugService = {"
|
"+DebugService = {"
|
||||||
" Class = DebugService "
|
" Class = DebugService "
|
||||||
" ControlPort = 8098 "
|
" ControlPort = 8080 "
|
||||||
" UdpPort = 8099 "
|
" UdpPort = 8081 "
|
||||||
" StreamIP = \"127.0.0.1\" "
|
" StreamIP = \"127.0.0.1\" "
|
||||||
"}"
|
"}"
|
||||||
"App = {"
|
"+App = {"
|
||||||
" Class = RealTimeApplication "
|
" Class = RealTimeApplication "
|
||||||
" +Functions = {"
|
" +Functions = {"
|
||||||
" Class = ReferenceContainer "
|
" Class = ReferenceContainer "
|
||||||
" +GAM1 = {"
|
" +GAM1 = {"
|
||||||
" Class = IOGAM "
|
" Class = IOGAM "
|
||||||
" InputSignals = {"
|
" InputSignals = {"
|
||||||
" Counter = { DataSource = Timer Type = uint32 Frequency = 1000 }"
|
" Counter = {"
|
||||||
" Time = { DataSource = Timer Type = uint32 }"
|
" DataSource = Timer "
|
||||||
|
" Type = uint32 "
|
||||||
|
" }"
|
||||||
" }"
|
" }"
|
||||||
" OutputSignals = {"
|
" OutputSignals = {"
|
||||||
" Counter = { DataSource = DDB Type = uint32 }"
|
" Counter = {"
|
||||||
" Time = { DataSource = DDB Type = uint32 }"
|
" DataSource = DDB "
|
||||||
|
" Type = uint32 "
|
||||||
|
" }"
|
||||||
" }"
|
" }"
|
||||||
" }"
|
" }"
|
||||||
" }"
|
" }"
|
||||||
" +Data = {"
|
" +Data = {"
|
||||||
" Class = ReferenceContainer "
|
" Class = ReferenceContainer "
|
||||||
" DefaultDataSource = DDB "
|
" DefaultDataSource = DDB "
|
||||||
" +Timer = { Class = LinuxTimer SleepTime = 1000 Signals = { Counter = { Type = uint32 } Time = { Type = uint32 } } }"
|
" +Timer = {"
|
||||||
" +DDB = { Class = GAMDataSource Signals = { Counter = { Type = uint32 } Time = { Type = uint32 } } }"
|
" Class = LinuxTimer "
|
||||||
|
" SleepTime = 100000 " // 100ms
|
||||||
|
" Signals = {"
|
||||||
|
" Counter = { Type = uint32 }"
|
||||||
|
" }"
|
||||||
|
" }"
|
||||||
|
" +DDB = {"
|
||||||
|
" Class = GAMDataSource "
|
||||||
|
" Signals = { Counter = { Type = uint32 } }"
|
||||||
|
" }"
|
||||||
" +DAMS = { Class = TimingDataSource }"
|
" +DAMS = { Class = TimingDataSource }"
|
||||||
" }"
|
" }"
|
||||||
" +States = {"
|
" +States = {"
|
||||||
" Class = ReferenceContainer "
|
" Class = ReferenceContainer "
|
||||||
" +State1 = { Class = RealTimeState +Threads = { Class = ReferenceContainer +Thread1 = { Class = RealTimeThread Functions = {GAM1} } } }"
|
" +State1 = {"
|
||||||
|
" Class = RealTimeState "
|
||||||
|
" +Threads = {"
|
||||||
|
" Class = ReferenceContainer "
|
||||||
|
" +Thread1 = {"
|
||||||
|
" Class = RealTimeThread "
|
||||||
|
" Functions = {GAM1} "
|
||||||
|
" }"
|
||||||
|
" }"
|
||||||
|
" }"
|
||||||
|
" }"
|
||||||
|
" +Scheduler = {"
|
||||||
|
" Class = FastScheduler "
|
||||||
|
" TimingDataSource = DAMS "
|
||||||
" }"
|
" }"
|
||||||
" +Scheduler = { Class = GAMScheduler TimingDataSource = DAMS }"
|
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
void TestSchedulerControl() {
|
void TestSchedulerControl() {
|
||||||
printf("--- MARTe2 Scheduler Control Test ---\n");
|
printf("--- MARTe2 Scheduler Control Test ---\n");
|
||||||
|
|
||||||
ObjectRegistryDatabase::Instance()->Purge();
|
|
||||||
|
|
||||||
ConfigurationDatabase cdb;
|
ConfigurationDatabase cdb;
|
||||||
StreamString ss = scheduler_config_text;
|
StreamString ss = config_text;
|
||||||
ss.Seek(0);
|
ss.Seek(0);
|
||||||
StandardParser parser(ss, cdb);
|
StandardParser parser(ss, cdb);
|
||||||
if (!parser.Parse()) {
|
assert(parser.Parse());
|
||||||
printf("ERROR: Failed to parse configuration\n");
|
assert(ObjectRegistryDatabase::Instance()->Initialise(cdb));
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cdb.MoveToRoot();
|
ReferenceT<DebugService> service = ObjectRegistryDatabase::Instance()->Find("DebugService");
|
||||||
uint32 n = cdb.GetNumberOfChildren();
|
assert(service.IsValid());
|
||||||
for (uint32 i=0; i<n; i++) {
|
|
||||||
const char8* name = cdb.GetChildName(i);
|
|
||||||
ConfigurationDatabase child;
|
|
||||||
cdb.MoveRelative(name);
|
|
||||||
cdb.Copy(child);
|
|
||||||
cdb.MoveToAncestor(1u);
|
|
||||||
|
|
||||||
StreamString className;
|
ReferenceT<RealTimeApplication> app = ObjectRegistryDatabase::Instance()->Find("App");
|
||||||
child.Read("Class", className);
|
assert(app.IsValid());
|
||||||
|
|
||||||
Reference ref(className.Buffer(), GlobalObjectsDatabase::Instance()->GetStandardHeap());
|
|
||||||
if (!ref.IsValid()) {
|
|
||||||
printf("ERROR: Could not create object %s of class %s\n", name, className.Buffer());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ref->SetName(name);
|
|
||||||
if (!ref->Initialise(child)) {
|
|
||||||
printf("ERROR: Failed to initialise object %s\n", name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ObjectRegistryDatabase::Instance()->Insert(ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReferenceT<DebugService> service =
|
|
||||||
ObjectRegistryDatabase::Instance()->Find("DebugService");
|
|
||||||
if (!service.IsValid()) {
|
|
||||||
printf("ERROR: DebugService not found in registry\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
service->SetFullConfig(cdb);
|
|
||||||
|
|
||||||
ReferenceT<RealTimeApplication> app =
|
|
||||||
ObjectRegistryDatabase::Instance()->Find("App");
|
|
||||||
if (!app.IsValid()) {
|
|
||||||
printf("ERROR: App not found in registry\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!app->ConfigureApplication()) {
|
|
||||||
printf("ERROR: ConfigureApplication failed.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (app->PrepareNextState("State1") != ErrorManagement::NoError) {
|
if (app->PrepareNextState("State1") != ErrorManagement::NoError) {
|
||||||
printf("ERROR: Failed to prepare State1\n");
|
printf("ERROR: Failed to prepare State1\n");
|
||||||
@@ -118,47 +102,33 @@ void TestSchedulerControl() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("Application started. Waiting for cycles...\n");
|
printf("Application started. Waiting for cycles...\n");
|
||||||
Sleep::MSec(2000);
|
Sleep::MSec(1000);
|
||||||
|
|
||||||
// Enable Trace First - with retry logic
|
// Enable Trace First
|
||||||
{
|
{
|
||||||
bool connected = false;
|
|
||||||
for (int retry=0; retry<10 && !connected; retry++) {
|
|
||||||
BasicTCPSocket tClient;
|
BasicTCPSocket tClient;
|
||||||
if (tClient.Open()) {
|
if (tClient.Connect("127.0.0.1", 8080)) {
|
||||||
if (tClient.Connect("127.0.0.1", 8098)) {
|
const char* cmd = "TRACE Root.App.Data.Timer.Counter 1\n";
|
||||||
connected = true;
|
|
||||||
const char *cmd = "TRACE App.Data.Timer.Counter 1\n";
|
|
||||||
uint32 s = StringHelper::Length(cmd);
|
uint32 s = StringHelper::Length(cmd);
|
||||||
tClient.Write(cmd, s);
|
tClient.Write(cmd, s);
|
||||||
tClient.Close();
|
tClient.Close();
|
||||||
} else {
|
} else {
|
||||||
printf("[SchedulerTest] Connect failed (retry %d)\n", retry);
|
|
||||||
Sleep::MSec(500);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printf("[SchedulerTest] Open failed (retry %d)\n", retry);
|
|
||||||
Sleep::MSec(500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!connected) {
|
|
||||||
printf("WARNING: Could not connect to DebugService to enable trace.\n");
|
printf("WARNING: Could not connect to DebugService to enable trace.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicUDPSocket listener;
|
BasicUDPSocket listener;
|
||||||
listener.Open();
|
listener.Open();
|
||||||
listener.Listen(8099);
|
listener.Listen(8081);
|
||||||
|
|
||||||
// Read current value
|
// Read current value
|
||||||
uint32 valBeforePause = 0;
|
uint32 valBeforePause = 0;
|
||||||
char buffer[2048];
|
char buffer[2048];
|
||||||
uint32 size = 2048;
|
uint32 size = 2048;
|
||||||
TimeoutType timeout(1000);
|
TimeoutType timeout(500);
|
||||||
if (listener.Read(buffer, size, timeout)) {
|
if (listener.Read(buffer, size, timeout)) {
|
||||||
// [Header][ID][Size][Value]
|
// [Header][ID][Size][Value]
|
||||||
valBeforePause = *(uint32 *)(&buffer[sizeof(TraceHeader) + 16]);
|
valBeforePause = *(uint32*)(&buffer[28]);
|
||||||
printf("Value before/at pause: %u\n", valBeforePause);
|
printf("Value before/at pause: %u\n", valBeforePause);
|
||||||
} else {
|
} else {
|
||||||
printf("WARNING: No data received before pause.\n");
|
printf("WARNING: No data received before pause.\n");
|
||||||
@@ -166,47 +136,31 @@ void TestSchedulerControl() {
|
|||||||
|
|
||||||
// Send PAUSE
|
// Send PAUSE
|
||||||
printf("Sending PAUSE command...\n");
|
printf("Sending PAUSE command...\n");
|
||||||
{
|
|
||||||
bool connected = false;
|
|
||||||
for (int retry=0; retry<10 && !connected; retry++) {
|
|
||||||
BasicTCPSocket client;
|
BasicTCPSocket client;
|
||||||
if (client.Open()) {
|
if (client.Connect("127.0.0.1", 8080)) {
|
||||||
if (client.Connect("127.0.0.1", 8098)) {
|
const char* cmd = "PAUSE\n";
|
||||||
connected = true;
|
|
||||||
const char *cmd = "PAUSE\n";
|
|
||||||
uint32 s = StringHelper::Length(cmd);
|
uint32 s = StringHelper::Length(cmd);
|
||||||
client.Write(cmd, s);
|
client.Write(cmd, s);
|
||||||
client.Close();
|
client.Close();
|
||||||
} else {
|
} else {
|
||||||
Sleep::MSec(200);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Sleep::MSec(200);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!connected) {
|
|
||||||
printf("ERROR: Could not connect to DebugService to send PAUSE.\n");
|
printf("ERROR: Could not connect to DebugService to send PAUSE.\n");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Sleep::MSec(2000); // Wait 2 seconds
|
Sleep::MSec(2000); // Wait 2 seconds
|
||||||
|
|
||||||
// Read again - should be same or very close if paused
|
// Read again - should be same or very close if paused
|
||||||
uint32 valAfterWait = 0;
|
uint32 valAfterWait = 0;
|
||||||
size = 2048; // Reset size
|
size = 2048; // Reset size
|
||||||
while (listener.Read(buffer, size, TimeoutType(100))) {
|
while(listener.Read(buffer, size, TimeoutType(10))) {
|
||||||
valAfterWait = *(uint32 *)(&buffer[sizeof(TraceHeader) + 16]);
|
valAfterWait = *(uint32*)(&buffer[28]);
|
||||||
size = 2048;
|
size = 2048;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Value after 2s wait (drained): %u\n", valAfterWait);
|
printf("Value after 2s wait (drained): %u\n", valAfterWait);
|
||||||
|
|
||||||
// Check if truly paused
|
// Check if truly paused
|
||||||
if (valAfterWait > valBeforePause + 10) {
|
if (valAfterWait > valBeforePause + 5) {
|
||||||
printf(
|
printf("FAILURE: Counter increased significantly while paused! (%u -> %u)\n", valBeforePause, valAfterWait);
|
||||||
"FAILURE: Counter increased significantly while paused! (%u -> %u)\n",
|
|
||||||
valBeforePause, valAfterWait);
|
|
||||||
} else {
|
} else {
|
||||||
printf("SUCCESS: Counter held steady (or close) during pause.\n");
|
printf("SUCCESS: Counter held steady (or close) during pause.\n");
|
||||||
}
|
}
|
||||||
@@ -214,22 +168,12 @@ void TestSchedulerControl() {
|
|||||||
// Resume
|
// Resume
|
||||||
printf("Sending RESUME command...\n");
|
printf("Sending RESUME command...\n");
|
||||||
{
|
{
|
||||||
bool connected = false;
|
|
||||||
for (int retry=0; retry<10 && !connected; retry++) {
|
|
||||||
BasicTCPSocket rClient;
|
BasicTCPSocket rClient;
|
||||||
if (rClient.Open()) {
|
if (rClient.Connect("127.0.0.1", 8080)) {
|
||||||
if (rClient.Connect("127.0.0.1", 8098)) {
|
const char* cmd = "RESUME\n";
|
||||||
connected = true;
|
|
||||||
const char *cmd = "RESUME\n";
|
|
||||||
uint32 s = StringHelper::Length(cmd);
|
uint32 s = StringHelper::Length(cmd);
|
||||||
rClient.Write(cmd, s);
|
rClient.Write(cmd, s);
|
||||||
rClient.Close();
|
rClient.Close();
|
||||||
} else {
|
|
||||||
Sleep::MSec(200);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Sleep::MSec(200);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +183,7 @@ void TestSchedulerControl() {
|
|||||||
uint32 valAfterResume = 0;
|
uint32 valAfterResume = 0;
|
||||||
size = 2048;
|
size = 2048;
|
||||||
if (listener.Read(buffer, size, timeout)) {
|
if (listener.Read(buffer, size, timeout)) {
|
||||||
valAfterResume = *(uint32 *)(&buffer[sizeof(TraceHeader) + 16]);
|
valAfterResume = *(uint32*)(&buffer[28]);
|
||||||
printf("Value after resume: %u\n", valAfterResume);
|
printf("Value after resume: %u\n", valAfterResume);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,3 +195,8 @@ void TestSchedulerControl() {
|
|||||||
|
|
||||||
app->StopCurrentStateExecution();
|
app->StopCurrentStateExecution();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
TestSchedulerControl();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "BasicTCPSocket.h"
|
|
||||||
#include "BasicUDPSocket.h"
|
|
||||||
#include "DebugService.h"
|
#include "DebugService.h"
|
||||||
|
#include "DebugCore.h"
|
||||||
#include "ObjectRegistryDatabase.h"
|
#include "ObjectRegistryDatabase.h"
|
||||||
#include "StandardParser.h"
|
#include "StandardParser.h"
|
||||||
#include "StreamString.h"
|
#include "StreamString.h"
|
||||||
|
#include "BasicUDPSocket.h"
|
||||||
#include "HighResolutionTimer.h"
|
#include "HighResolutionTimer.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -12,22 +12,20 @@ using namespace MARTe;
|
|||||||
|
|
||||||
void TestFullTracePipeline() {
|
void TestFullTracePipeline() {
|
||||||
printf("Starting Full Trace Pipeline Test...\n");
|
printf("Starting Full Trace Pipeline Test...\n");
|
||||||
|
printf("sizeof(TraceHeader) = %lu\n", sizeof(TraceHeader));
|
||||||
ObjectRegistryDatabase::Instance()->Purge();
|
|
||||||
|
|
||||||
// 1. Setup Service
|
// 1. Setup Service
|
||||||
DebugService service;
|
DebugService service;
|
||||||
ConfigurationDatabase config;
|
ConfigurationDatabase config;
|
||||||
config.Write("ControlPort", (uint16)8082);
|
config.Write("ControlPort", (uint16)8080);
|
||||||
config.Write("StreamPort", (uint16)8083);
|
config.Write("StreamPort", (uint16)8081);
|
||||||
config.Write("LogPort", (uint16)8084);
|
config.Write("LogPort", (uint16)8082);
|
||||||
config.Write("StreamIP", "127.0.0.1");
|
config.Write("StreamIP", "127.0.0.1");
|
||||||
assert(service.Initialise(config));
|
assert(service.Initialise(config));
|
||||||
Sleep::MSec(500);
|
|
||||||
|
|
||||||
// 2. Register a mock signal
|
// 2. Register a mock signal
|
||||||
uint32 mockValue = 0;
|
uint32 mockValue = 0;
|
||||||
DebugSignalInfo* sig = service.RegisterSignal(&mockValue, UnsignedInteger32Bit, "TraceTest.Signal");
|
DebugSignalInfo* sig = service.RegisterSignal(&mockValue, UnsignedInteger32Bit, "Test.Signal");
|
||||||
assert(sig != NULL_PTR(DebugSignalInfo*));
|
assert(sig != NULL_PTR(DebugSignalInfo*));
|
||||||
printf("Signal registered with ID: %u\n", sig->internalID);
|
printf("Signal registered with ID: %u\n", sig->internalID);
|
||||||
|
|
||||||
@@ -38,7 +36,7 @@ void TestFullTracePipeline() {
|
|||||||
// 4. Setup a local UDP listener
|
// 4. Setup a local UDP listener
|
||||||
BasicUDPSocket listener;
|
BasicUDPSocket listener;
|
||||||
assert(listener.Open());
|
assert(listener.Open());
|
||||||
assert(listener.Listen(8083));
|
assert(listener.Listen(8081));
|
||||||
|
|
||||||
// 5. Simulate cycles
|
// 5. Simulate cycles
|
||||||
printf("Simulating cycles...\n");
|
printf("Simulating cycles...\n");
|
||||||
@@ -55,6 +53,12 @@ void TestFullTracePipeline() {
|
|||||||
TimeoutType timeout(1000); // 1s
|
TimeoutType timeout(1000); // 1s
|
||||||
if (listener.Read(buffer, size, timeout)) {
|
if (listener.Read(buffer, size, timeout)) {
|
||||||
printf("SUCCESS: Received %u bytes over UDP!\n", size);
|
printf("SUCCESS: Received %u bytes over UDP!\n", size);
|
||||||
|
for(uint32 i=0; i<size; i++) {
|
||||||
|
printf("%02X ", (uint8)buffer[i]);
|
||||||
|
if((i+1)%4 == 0) printf("| ");
|
||||||
|
if((i+1)%16 == 0) printf("\n");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
TraceHeader *h = (TraceHeader*)buffer;
|
TraceHeader *h = (TraceHeader*)buffer;
|
||||||
printf("Header: Magic=0x%X, Count=%u, Seq=%u\n", h->magic, h->count, h->seq);
|
printf("Header: Magic=0x%X, Count=%u, Seq=%u\n", h->magic, h->count, h->seq);
|
||||||
@@ -64,7 +68,7 @@ void TestFullTracePipeline() {
|
|||||||
uint32 recId = *(uint32*)(&buffer[offset]);
|
uint32 recId = *(uint32*)(&buffer[offset]);
|
||||||
uint64 recTs = *(uint64*)(&buffer[offset + 4]);
|
uint64 recTs = *(uint64*)(&buffer[offset + 4]);
|
||||||
uint32 recSize = *(uint32*)(&buffer[offset + 12]);
|
uint32 recSize = *(uint32*)(&buffer[offset + 12]);
|
||||||
printf("Data: ID=%u, TS=%llu, Size=%u\n", recId, (unsigned long long)recTs, recSize);
|
printf("Data: ID=%u, TS=%lu, Size=%u\n", recId, recTs, recSize);
|
||||||
if (size >= offset + 16 + recSize) {
|
if (size >= offset + 16 + recSize) {
|
||||||
if (recSize == 4) {
|
if (recSize == 4) {
|
||||||
uint32 recVal = *(uint32*)(&buffer[offset + 16]);
|
uint32 recVal = *(uint32*)(&buffer[offset + 16]);
|
||||||
@@ -78,3 +82,8 @@ void TestFullTracePipeline() {
|
|||||||
|
|
||||||
listener.Close();
|
listener.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
TestFullTracePipeline();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,21 +1,25 @@
|
|||||||
#include "BasicTCPSocket.h"
|
|
||||||
#include "BasicUDPSocket.h"
|
|
||||||
#include "DebugService.h"
|
#include "DebugService.h"
|
||||||
|
#include "DebugCore.h"
|
||||||
#include "ObjectRegistryDatabase.h"
|
#include "ObjectRegistryDatabase.h"
|
||||||
#include "RealTimeApplication.h"
|
|
||||||
#include "StandardParser.h"
|
#include "StandardParser.h"
|
||||||
#include "StreamString.h"
|
#include "StreamString.h"
|
||||||
|
#include "BasicUDPSocket.h"
|
||||||
|
#include "BasicTCPSocket.h"
|
||||||
|
#include "RealTimeApplication.h"
|
||||||
#include "GlobalObjectsDatabase.h"
|
#include "GlobalObjectsDatabase.h"
|
||||||
|
#include "RealTimeLoader.h"
|
||||||
|
#include "HighResolutionTimer.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
|
|
||||||
const char8 * const validation_config =
|
// Removed '+' prefix from names for simpler lookup
|
||||||
|
const char8 * const simple_config =
|
||||||
"DebugService = {"
|
"DebugService = {"
|
||||||
" Class = DebugService "
|
" Class = DebugService "
|
||||||
" ControlPort = 8085 "
|
" ControlPort = 8080 "
|
||||||
" UdpPort = 8086 "
|
" UdpPort = 8081 "
|
||||||
" StreamIP = \"127.0.0.1\" "
|
" StreamIP = \"127.0.0.1\" "
|
||||||
"}"
|
"}"
|
||||||
"App = {"
|
"App = {"
|
||||||
@@ -54,7 +58,7 @@ void RunValidationTest() {
|
|||||||
ObjectRegistryDatabase::Instance()->Purge();
|
ObjectRegistryDatabase::Instance()->Purge();
|
||||||
|
|
||||||
ConfigurationDatabase cdb;
|
ConfigurationDatabase cdb;
|
||||||
StreamString ss = validation_config;
|
StreamString ss = simple_config;
|
||||||
ss.Seek(0);
|
ss.Seek(0);
|
||||||
StandardParser parser(ss, cdb);
|
StandardParser parser(ss, cdb);
|
||||||
assert(parser.Parse());
|
assert(parser.Parse());
|
||||||
@@ -81,7 +85,7 @@ void RunValidationTest() {
|
|||||||
Reference appGeneric = ObjectRegistryDatabase::Instance()->Find("App");
|
Reference appGeneric = ObjectRegistryDatabase::Instance()->Find("App");
|
||||||
|
|
||||||
if (!serviceGeneric.IsValid() || !appGeneric.IsValid()) {
|
if (!serviceGeneric.IsValid() || !appGeneric.IsValid()) {
|
||||||
printf("ERROR: Objects NOT FOUND in ValidationTest\n");
|
printf("ERROR: Objects NOT FOUND even without prefix\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,10 +95,8 @@ void RunValidationTest() {
|
|||||||
assert(service);
|
assert(service);
|
||||||
assert(app);
|
assert(app);
|
||||||
|
|
||||||
service->SetFullConfig(cdb);
|
|
||||||
|
|
||||||
if (!app->ConfigureApplication()) {
|
if (!app->ConfigureApplication()) {
|
||||||
printf("ERROR: ConfigureApplication failed in ValidationTest.\n");
|
printf("ERROR: ConfigureApplication failed.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,46 +104,58 @@ void RunValidationTest() {
|
|||||||
assert(app->StartNextStateExecution() == ErrorManagement::NoError);
|
assert(app->StartNextStateExecution() == ErrorManagement::NoError);
|
||||||
|
|
||||||
printf("Application started at 1kHz. Enabling Traces...\n");
|
printf("Application started at 1kHz. Enabling Traces...\n");
|
||||||
Sleep::MSec(1000);
|
Sleep::MSec(500);
|
||||||
|
|
||||||
if (service->TraceSignal("App.Data.Timer.Counter", true, 1) == 0) {
|
// The registered name in DebugBrokerWrapper depends on GetFullObjectName
|
||||||
printf("ERROR: Failed to enable trace for App.Data.Timer.Counter\n");
|
// With App as root, it should be App.Data.Timer.Counter
|
||||||
}
|
service->TraceSignal("App.Data.Timer.Counter", true, 1);
|
||||||
|
|
||||||
BasicUDPSocket listener;
|
BasicUDPSocket listener;
|
||||||
listener.Open();
|
listener.Open();
|
||||||
listener.Listen(8086);
|
listener.Listen(8081);
|
||||||
|
|
||||||
printf("Validating for 10 seconds...\n");
|
printf("Validating for 10 seconds...\n");
|
||||||
uint32 totalPackets = 0;
|
|
||||||
|
uint32 lastCounter = 0;
|
||||||
|
bool first = true;
|
||||||
uint32 totalSamples = 0;
|
uint32 totalSamples = 0;
|
||||||
uint32 discontinuities = 0;
|
uint32 discontinuities = 0;
|
||||||
uint32 lastValue = 0xFFFFFFFF;
|
uint32 totalPackets = 0;
|
||||||
|
|
||||||
uint64 start = HighResolutionTimer::Counter();
|
float64 startTest = HighResolutionTimer::Counter() * HighResolutionTimer::Period();
|
||||||
float64 elapsed = 0;
|
|
||||||
while (elapsed < 10.0) {
|
while ((HighResolutionTimer::Counter() * HighResolutionTimer::Period() - startTest) < 10.0) {
|
||||||
char buffer[2048];
|
char buffer[4096];
|
||||||
uint32 size = 2048;
|
uint32 size = 4096;
|
||||||
if (listener.Read(buffer, size, TimeoutType(100))) {
|
if (listener.Read(buffer, size, TimeoutType(100))) {
|
||||||
totalPackets++;
|
totalPackets++;
|
||||||
TraceHeader *h = (TraceHeader*)buffer;
|
TraceHeader *h = (TraceHeader*)buffer;
|
||||||
|
if (h->magic != 0xDA7A57AD) continue;
|
||||||
|
|
||||||
uint32 offset = sizeof(TraceHeader);
|
uint32 offset = sizeof(TraceHeader);
|
||||||
for (uint32 i=0; i<h->count; i++) {
|
for (uint32 i=0; i<h->count; i++) {
|
||||||
uint32 recId = *(uint32*)(&buffer[offset]);
|
if (offset + 16 > size) break;
|
||||||
uint32 recSize = *(uint32*)(&buffer[offset + 12]);
|
|
||||||
if (recSize == 4) {
|
uint32 sigId = *(uint32*)(&buffer[offset]);
|
||||||
|
uint32 sigSize = *(uint32*)(&buffer[offset + 12]);
|
||||||
|
|
||||||
|
if (offset + 16 + sigSize > size) break;
|
||||||
|
|
||||||
|
if (sigId == 0 && sigSize == 4) {
|
||||||
uint32 val = *(uint32*)(&buffer[offset + 16]);
|
uint32 val = *(uint32*)(&buffer[offset + 16]);
|
||||||
totalSamples++;
|
if (!first) {
|
||||||
if (lastValue != 0xFFFFFFFF && val != lastValue + 1) {
|
if (val != lastCounter + 1) {
|
||||||
discontinuities++;
|
discontinuities++;
|
||||||
}
|
}
|
||||||
lastValue = val;
|
|
||||||
}
|
}
|
||||||
offset += (16 + recSize);
|
lastCounter = val;
|
||||||
|
totalSamples++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
offset += (16 + sigSize);
|
||||||
|
}
|
||||||
|
first = false;
|
||||||
}
|
}
|
||||||
elapsed = (float64)(HighResolutionTimer::Counter() - start) * HighResolutionTimer::Period();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n--- Test Results ---\n");
|
printf("\n--- Test Results ---\n");
|
||||||
@@ -151,11 +165,17 @@ void RunValidationTest() {
|
|||||||
|
|
||||||
if (totalSamples < 9000) {
|
if (totalSamples < 9000) {
|
||||||
printf("FAILURE: Underflow - samples missing (%u).\n", totalSamples);
|
printf("FAILURE: Underflow - samples missing (%u).\n", totalSamples);
|
||||||
} else if (discontinuities > 50) {
|
} else if (discontinuities > 10) {
|
||||||
printf("FAILURE: Excessive discontinuities detected! (%u)\n", discontinuities);
|
printf("FAILURE: Excessive discontinuities detected! (%u)\n", discontinuities);
|
||||||
} else {
|
} else {
|
||||||
printf("VALIDATION SUCCESSFUL: 1kHz Lossless Tracing Verified.\n");
|
printf("VALIDATION SUCCESSFUL: 1kHz Lossless Tracing Verified.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
app->StopCurrentStateExecution();
|
app->StopCurrentStateExecution();
|
||||||
|
ObjectRegistryDatabase::Instance()->Purge();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
RunValidationTest();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
50
Test/Integration/main.cpp
Normal file
50
Test/Integration/main.cpp
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "DebugService.h"
|
||||||
|
#include "MemoryMapInputBroker.h"
|
||||||
|
#include "ConfigurationDatabase.h"
|
||||||
|
#include "ObjectRegistryDatabase.h"
|
||||||
|
#include "ClassRegistryDatabase.h"
|
||||||
|
|
||||||
|
using namespace MARTe;
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
void timeout_handler(int sig) {
|
||||||
|
printf("Test timed out!\n");
|
||||||
|
_exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
signal(SIGALRM, timeout_handler);
|
||||||
|
alarm(5); // 5 seconds timeout
|
||||||
|
printf("MARTe2 Debug Suite Integration Test\n");
|
||||||
|
|
||||||
|
{
|
||||||
|
// 1. Manually trigger Registry Patching
|
||||||
|
DebugService service;
|
||||||
|
ConfigurationDatabase serviceData;
|
||||||
|
serviceData.Write("ControlPort", (uint16)9090);
|
||||||
|
service.Initialise(serviceData);
|
||||||
|
|
||||||
|
printf("DebugService initialized and Registry Patched.\n");
|
||||||
|
|
||||||
|
// 2. Try to create a MemoryMapInputBroker
|
||||||
|
ClassRegistryItem *item = ClassRegistryDatabase::Instance()->Find("MemoryMapInputBroker");
|
||||||
|
if (item != NULL_PTR(ClassRegistryItem *)) {
|
||||||
|
Object *obj = item->GetObjectBuilder()->Build(GlobalObjectsDatabase::Instance()->GetStandardHeap());
|
||||||
|
if (obj != NULL_PTR(Object *)) {
|
||||||
|
printf("Instantiated Broker Class: %s\n", obj->GetClassProperties()->GetName());
|
||||||
|
printf("Success: Broker patched and instantiated.\n");
|
||||||
|
// delete obj;
|
||||||
|
} else {
|
||||||
|
printf("Failed to build broker\n");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("MemoryMapInputBroker not found in registry\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("DebugService scope finished.\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
include Makefile.inc
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
SPB = UnitTests.x Integration.x
|
|
||||||
|
|
||||||
PACKAGE = Test
|
|
||||||
|
|
||||||
ROOT_DIR = ..
|
|
||||||
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
|
||||||
|
|
||||||
all: $(SUBPROJ)
|
|
||||||
echo $(SUBPROJ)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
33
Test/UnitTests/CMakeLists.txt
Normal file
33
Test/UnitTests/CMakeLists.txt
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
include_directories(
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L0Types
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L1Portability
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L2Objects
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L3Streams
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L4Configuration
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L4Events
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L4Logger
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L4Messages
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L5FILES
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L5GAMs
|
||||||
|
${MARTe2_DIR}/Source/Core/BareMetal/L6App
|
||||||
|
${MARTe2_DIR}/Source/Core/Scheduler/L1Portability
|
||||||
|
${MARTe2_DIR}/Source/Core/Scheduler/L3Services
|
||||||
|
${MARTe2_DIR}/Source/Core/Scheduler/L4LoggerService
|
||||||
|
${MARTe2_DIR}/Source/Core/FileSystem/L1Portability
|
||||||
|
${MARTe2_DIR}/Source/Core/FileSystem/L3Streams
|
||||||
|
${MARTe2_DIR}/Source/Core/Scheduler/L5GAMs
|
||||||
|
${MARTe2_Components_DIR}/Source/Components/DataSources/EpicsDataSource
|
||||||
|
${MARTe2_Components_DIR}/Source/Components/DataSources/FileDataSource
|
||||||
|
${MARTe2_Components_DIR}/Source/Components/GAMs/IOGAM
|
||||||
|
../../Source
|
||||||
|
../../Headers
|
||||||
|
)
|
||||||
|
|
||||||
|
file(GLOB SOURCES "*.cpp")
|
||||||
|
|
||||||
|
add_executable(UnitTests ${SOURCES})
|
||||||
|
|
||||||
|
target_link_libraries(UnitTests
|
||||||
|
marte_dev
|
||||||
|
${MARTe2_DIR}/Build/${TARGET}/Core/libMARTe2.so
|
||||||
|
)
|
||||||
@@ -1 +0,0 @@
|
|||||||
include Makefile.inc
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
OBJSX =
|
|
||||||
|
|
||||||
PACKAGE = Test/UnitTests
|
|
||||||
|
|
||||||
ROOT_DIR = ../..
|
|
||||||
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
|
||||||
|
|
||||||
INCLUDES += -I$(ROOT_DIR)/Source/Core/Types/Result
|
|
||||||
INCLUDES += -I$(ROOT_DIR)/Source/Core/Types/Vec
|
|
||||||
INCLUDES += -I$(ROOT_DIR)/Source/Components/Interfaces/DebugService
|
|
||||||
INCLUDES += -I$(ROOT_DIR)/Source/Components/Interfaces/TCPLogger
|
|
||||||
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L0Types
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L1Portability
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L2Objects
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L3Streams
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Messages
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Logger
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Configuration
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L5GAMs
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L1Portability
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L3Services
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4Messages
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4LoggerService
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L5GAMs
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L1Portability
|
|
||||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L3Streams
|
|
||||||
|
|
||||||
LIBRARIES += -L$(MARTe2_DIR)/Build/$(TARGET)/Core -lMARTe2
|
|
||||||
LIBRARIES += -L$(ROOT_DIR)/Build/$(TARGET)/Components/Interfaces/DebugService -lDebugService
|
|
||||||
LIBRARIES += -L$(ROOT_DIR)/Build/$(TARGET)/Components/Interfaces/TCPLogger -lTcpLogger
|
|
||||||
|
|
||||||
all: $(OBJS) $(BUILD_DIR)/UnitTests$(EXEEXT)
|
|
||||||
echo $(OBJS)
|
|
||||||
|
|
||||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
|
||||||
@@ -9,23 +9,20 @@
|
|||||||
#include "TcpLogger.h"
|
#include "TcpLogger.h"
|
||||||
#include "ConfigurationDatabase.h"
|
#include "ConfigurationDatabase.h"
|
||||||
#include "ObjectRegistryDatabase.h"
|
#include "ObjectRegistryDatabase.h"
|
||||||
#include "GlobalObjectsDatabase.h"
|
#include "StandardParser.h"
|
||||||
|
#include "MemoryMapInputBroker.h"
|
||||||
|
#include "Sleep.h"
|
||||||
|
#include "BasicTCPSocket.h"
|
||||||
|
#include "HighResolutionTimer.h"
|
||||||
|
|
||||||
|
using namespace MARTe;
|
||||||
|
|
||||||
namespace MARTe {
|
namespace MARTe {
|
||||||
|
|
||||||
void TestTcpLogger() {
|
|
||||||
printf("Stability Logger Tests...\n");
|
|
||||||
TcpLogger logger;
|
|
||||||
ConfigurationDatabase config;
|
|
||||||
config.Write("Port", (uint32)0); // Random port
|
|
||||||
assert(logger.Initialise(config));
|
|
||||||
}
|
|
||||||
|
|
||||||
class DebugServiceTest {
|
class DebugServiceTest {
|
||||||
public:
|
public:
|
||||||
static void TestAll() {
|
static void TestAll() {
|
||||||
printf("Stability Logic Tests...\n");
|
printf("Stability Logic Tests...\n");
|
||||||
ObjectRegistryDatabase::Instance()->Purge();
|
|
||||||
|
|
||||||
DebugService service;
|
DebugService service;
|
||||||
assert(service.traceBuffer.Init(1024 * 1024));
|
assert(service.traceBuffer.Init(1024 * 1024));
|
||||||
@@ -43,48 +40,59 @@ public:
|
|||||||
assert(service.ForceSignal("Z", "123") == 1);
|
assert(service.ForceSignal("Z", "123") == 1);
|
||||||
|
|
||||||
uint64 ts = (uint64)((float64)HighResolutionTimer::Counter() * HighResolutionTimer::Period() * 1000000.0);
|
uint64 ts = (uint64)((float64)HighResolutionTimer::Counter() * HighResolutionTimer::Period() * 1000000.0);
|
||||||
service.ProcessSignal(service.signals[0], 4, ts);
|
service.ProcessSignal(&service.signals[0], 4, ts);
|
||||||
assert(val == 123);
|
assert(val == 123);
|
||||||
service.UnforceSignal("Z");
|
service.UnforceSignal("Z");
|
||||||
|
|
||||||
// 2. Commands
|
// 2. Commands
|
||||||
service.HandleCommand("TREE", NULL_PTR(BasicTCPSocket*));
|
service.HandleCommand("TREE", NULL_PTR(BasicTCPSocket*));
|
||||||
service.HandleCommand("DISCOVER", NULL_PTR(BasicTCPSocket*));
|
service.HandleCommand("DISCOVER", NULL_PTR(BasicTCPSocket*));
|
||||||
service.HandleCommand("CONFIG", NULL_PTR(BasicTCPSocket*));
|
|
||||||
service.HandleCommand("PAUSE", NULL_PTR(BasicTCPSocket*));
|
service.HandleCommand("PAUSE", NULL_PTR(BasicTCPSocket*));
|
||||||
service.HandleCommand("RESUME", NULL_PTR(BasicTCPSocket*));
|
service.HandleCommand("RESUME", NULL_PTR(BasicTCPSocket*));
|
||||||
service.HandleCommand("LS /", NULL_PTR(BasicTCPSocket*));
|
service.HandleCommand("LS /", NULL_PTR(BasicTCPSocket*));
|
||||||
service.HandleCommand("INFO X.Y.Z", NULL_PTR(BasicTCPSocket*));
|
|
||||||
|
|
||||||
// 3. Broker Active Status
|
// 3. Broker Active Status (Wait-Free)
|
||||||
volatile bool active = false;
|
volatile bool active = false;
|
||||||
Vec<uint32> indices;
|
DebugSignalInfo* ptrs[1] = { &service.signals[0] };
|
||||||
Vec<uint32> sizes;
|
service.RegisterBroker(ptrs, 1, NULL_PTR(MemoryMapBroker*), &active);
|
||||||
FastPollingMutexSem mutex;
|
|
||||||
DebugSignalInfo* ptrs[1] = { service.signals[0] };
|
|
||||||
service.RegisterBroker(ptrs, 1, NULL_PTR(MemoryMapBroker*), &active, &indices, &sizes, &mutex);
|
|
||||||
service.UpdateBrokersActiveStatus();
|
service.UpdateBrokersActiveStatus();
|
||||||
assert(active == true);
|
assert(active == true);
|
||||||
assert(indices.Size() == 1);
|
|
||||||
assert(indices[0] == 0);
|
|
||||||
|
|
||||||
// Helper Process
|
// Helper Process
|
||||||
DebugBrokerHelper::Process(&service, ptrs, indices, sizes, mutex);
|
DebugBrokerHelper::Process(&service, service.brokers[0]);
|
||||||
|
|
||||||
|
// 4. Object Hierarchy branches
|
||||||
|
service.HandleCommand("INFO X.Y.Z", NULL_PTR(BasicTCPSocket*));
|
||||||
|
|
||||||
|
StreamString fullPath;
|
||||||
|
DebugService::GetFullObjectName(service, fullPath);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void TestTcpLogger() {
|
||||||
|
printf("Stability Logger Tests...\n");
|
||||||
|
TcpLogger logger;
|
||||||
|
ConfigurationDatabase cfg;
|
||||||
|
cfg.Write("Port", (uint16)0);
|
||||||
|
if (logger.Initialise(cfg)) {
|
||||||
|
REPORT_ERROR_STATIC(ErrorManagement::Information, "Coverage Log Entry");
|
||||||
|
logger.ConsumeLogMessage(NULL_PTR(LoggerPage*));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <signal.h>
|
void TestRingBuffer() {
|
||||||
|
printf("Stability RingBuffer Tests...\n");
|
||||||
void timeout_handler(int sig) {
|
TraceRingBuffer rb;
|
||||||
printf("Test timed out!\n");
|
rb.Init(1024);
|
||||||
_exit(1);
|
uint32 val = 0;
|
||||||
|
rb.Push(1, 100, &val, 4);
|
||||||
|
uint32 id, size; uint64 ts;
|
||||||
|
rb.Pop(id, ts, &val, size, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
}
|
||||||
signal(SIGALRM, timeout_handler);
|
|
||||||
alarm(10);
|
int main(int argc, char **argv) {
|
||||||
printf("--- MARTe2 Debug Suite COVERAGE V29 ---\n");
|
printf("--- MARTe2 Debug Suite COVERAGE V29 ---\n");
|
||||||
MARTe::TestTcpLogger();
|
MARTe::TestTcpLogger();
|
||||||
MARTe::DebugServiceTest::TestAll();
|
MARTe::DebugServiceTest::TestAll();
|
||||||
File diff suppressed because it is too large
Load Diff
431
Tools/pipeline_validator/Cargo.lock
generated
Normal file
431
Tools/pipeline_validator/Cargo.lock
generated
Normal file
@@ -0,0 +1,431 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "android_system_properties"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bumpalo"
|
||||||
|
version = "3.20.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.2.56"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2"
|
||||||
|
dependencies = [
|
||||||
|
"find-msvc-tools",
|
||||||
|
"shlex",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chrono"
|
||||||
|
version = "0.4.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0"
|
||||||
|
dependencies = [
|
||||||
|
"iana-time-zone",
|
||||||
|
"js-sys",
|
||||||
|
"num-traits",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation-sys"
|
||||||
|
version = "0.8.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "find-msvc-tools"
|
||||||
|
version = "0.1.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone"
|
||||||
|
version = "0.1.65"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470"
|
||||||
|
dependencies = [
|
||||||
|
"android_system_properties",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"iana-time-zone-haiku",
|
||||||
|
"js-sys",
|
||||||
|
"log",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone-haiku"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itoa"
|
||||||
|
version = "1.0.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "js-sys"
|
||||||
|
version = "0.3.90"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "14dc6f6450b3f6d4ed5b16327f38fed626d375a886159ca555bd7822c0c3a5a6"
|
||||||
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.182"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-traits"
|
||||||
|
version = "0.2.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.21.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pipeline_validator"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"chrono",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"socket2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.106"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustversion"
|
||||||
|
version = "1.0.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.228"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
||||||
|
dependencies = [
|
||||||
|
"serde_core",
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_core"
|
||||||
|
version = "1.0.228"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||||
|
dependencies = [
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
version = "1.0.228"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_json"
|
||||||
|
version = "1.0.149"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
|
||||||
|
dependencies = [
|
||||||
|
"itoa",
|
||||||
|
"memchr",
|
||||||
|
"serde",
|
||||||
|
"serde_core",
|
||||||
|
"zmij",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shlex"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "socket2"
|
||||||
|
version = "0.5.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.117"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.24"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen"
|
||||||
|
version = "0.2.113"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "60722a937f594b7fde9adb894d7c092fc1bb6612897c46368d18e7a20208eff2"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"once_cell",
|
||||||
|
"rustversion",
|
||||||
|
"wasm-bindgen-macro",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro"
|
||||||
|
version = "0.2.113"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fac8c6395094b6b91c4af293f4c79371c163f9a6f56184d2c9a85f5a95f3950"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"wasm-bindgen-macro-support",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-macro-support"
|
||||||
|
version = "0.2.113"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ab3fabce6159dc20728033842636887e4877688ae94382766e00b180abac9d60"
|
||||||
|
dependencies = [
|
||||||
|
"bumpalo",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-shared"
|
||||||
|
version = "0.2.113"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "de0e091bdb824da87dc01d967388880d017a0a9bc4f3bdc0d86ee9f9336e3bb5"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-core"
|
||||||
|
version = "0.62.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
|
||||||
|
dependencies = [
|
||||||
|
"windows-implement",
|
||||||
|
"windows-interface",
|
||||||
|
"windows-link",
|
||||||
|
"windows-result",
|
||||||
|
"windows-strings",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-implement"
|
||||||
|
version = "0.60.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-interface"
|
||||||
|
version = "0.59.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-link"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-result"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
|
||||||
|
dependencies = [
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-strings"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
|
||||||
|
dependencies = [
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.52.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm",
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_gnullvm",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_gnullvm",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zmij"
|
||||||
|
version = "1.0.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
|
||||||
10
Tools/pipeline_validator/Cargo.toml
Normal file
10
Tools/pipeline_validator/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[package]
|
||||||
|
name = "pipeline_validator"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
serde_json = "1.0"
|
||||||
|
socket2 = "0.5"
|
||||||
|
chrono = "0.4"
|
||||||
135
Tools/pipeline_validator/src/main.rs
Normal file
135
Tools/pipeline_validator/src/main.rs
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
use std::io::{Read, Write};
|
||||||
|
use std::net::{TcpStream, UdpSocket};
|
||||||
|
use std::time::{Duration, Instant};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
struct Signal {
|
||||||
|
name: String,
|
||||||
|
id: u32,
|
||||||
|
#[serde(rename = "type")]
|
||||||
|
sig_type: String,
|
||||||
|
ready: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug)]
|
||||||
|
struct DiscoverResponse {
|
||||||
|
#[serde(rename = "Signals")]
|
||||||
|
signals: Vec<Signal>,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println!("--- MARTe2 Debug Pipeline Validator ---");
|
||||||
|
|
||||||
|
// 1. Connect to TCP Control Port
|
||||||
|
let mut stream = match TcpStream::connect("127.0.0.1:8080") {
|
||||||
|
Ok(s) => {
|
||||||
|
println!("[TCP] Connected to DebugService on 8080");
|
||||||
|
s
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
println!("[TCP] FAILED to connect: {}", e);
|
||||||
|
println!("Check if 'run_debug_app.sh' is running.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
stream.set_read_timeout(Some(Duration::from_secs(2))).unwrap();
|
||||||
|
|
||||||
|
// 2. DISCOVER signals
|
||||||
|
println!("[TCP] Sending DISCOVER...");
|
||||||
|
stream.write_all(b"DISCOVER\n").unwrap();
|
||||||
|
|
||||||
|
let mut buf = [0u8; 8192];
|
||||||
|
let n = stream.read(&mut buf).unwrap();
|
||||||
|
let resp = String::from_utf8_lossy(&buf[..n]);
|
||||||
|
|
||||||
|
// Split JSON from OK DISCOVER terminator
|
||||||
|
let json_part = resp.split("OK DISCOVER").next().unwrap_or("").trim();
|
||||||
|
let discovery: DiscoverResponse = match serde_json::from_str(json_part) {
|
||||||
|
Ok(d) => d,
|
||||||
|
Err(e) => {
|
||||||
|
println!("[TCP] Discovery Parse Error: {}", e);
|
||||||
|
println!("Raw Response: {}", resp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
println!("[TCP] Found {} signals.", discovery.signals.len());
|
||||||
|
let mut counter_id = None;
|
||||||
|
for s in &discovery.signals {
|
||||||
|
println!("[TCP] Signal: {} (ID={}, Ready={})", s.name, s.id, s.ready);
|
||||||
|
if s.name.contains("Timer.Counter") {
|
||||||
|
println!("[TCP] Target found: {} (ID={})", s.name, s.id);
|
||||||
|
counter_id = Some(s.id);
|
||||||
|
|
||||||
|
// 3. Enable TRACE
|
||||||
|
println!("[TCP] Enabling TRACE for {}...", s.name);
|
||||||
|
stream.write_all(format!("TRACE {} 1\n", s.name).as_bytes()).unwrap();
|
||||||
|
let mut t_buf = [0u8; 1024];
|
||||||
|
let tn = stream.read(&mut t_buf).unwrap();
|
||||||
|
println!("[TCP] TRACE Response: {}", String::from_utf8_lossy(&t_buf[..tn]).trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if counter_id.is_none() {
|
||||||
|
println!("[TCP] ERROR: Counter signal not found in discovery.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Listen for UDP Telemetry
|
||||||
|
let socket = UdpSocket::bind("0.0.0.0:8081").expect("Could not bind UDP socket");
|
||||||
|
socket.set_read_timeout(Some(Duration::from_secs(5))).unwrap();
|
||||||
|
println!("[UDP] Listening for telemetry on 8081...");
|
||||||
|
|
||||||
|
let mut samples_received = 0;
|
||||||
|
let mut last_val: Option<u32> = None;
|
||||||
|
let mut last_ts: Option<u64> = None;
|
||||||
|
let start_wait = Instant::now();
|
||||||
|
|
||||||
|
while samples_received < 20 && start_wait.elapsed().as_secs() < 10 {
|
||||||
|
let mut u_buf = [0u8; 4096];
|
||||||
|
if let Ok(n) = socket.recv(&mut u_buf) {
|
||||||
|
if n < 20 { continue; }
|
||||||
|
|
||||||
|
// Validate Header
|
||||||
|
let magic = u32::from_le_bytes(u_buf[0..4].try_into().unwrap());
|
||||||
|
if magic != 0xDA7A57AD { continue; }
|
||||||
|
|
||||||
|
let count = u32::from_le_bytes(u_buf[16..20].try_into().unwrap());
|
||||||
|
let mut offset = 20;
|
||||||
|
|
||||||
|
for _ in 0..count {
|
||||||
|
if offset + 16 > n { break; }
|
||||||
|
let id = u32::from_le_bytes(u_buf[offset..offset+4].try_into().unwrap());
|
||||||
|
let ts = u64::from_le_bytes(u_buf[offset+4..offset+12].try_into().unwrap());
|
||||||
|
let size = u32::from_le_bytes(u_buf[offset+12..offset+16].try_into().unwrap());
|
||||||
|
offset += 16;
|
||||||
|
|
||||||
|
if offset + size as usize > n { break; }
|
||||||
|
|
||||||
|
if id == counter_id.unwrap() && size == 4 {
|
||||||
|
let val = u32::from_le_bytes(u_buf[offset..offset+4].try_into().unwrap());
|
||||||
|
println!("[UDP] Match! ID={} TS={} VAL={}", id, ts, val);
|
||||||
|
|
||||||
|
if let Some(lt) = last_ts {
|
||||||
|
if ts <= lt { println!("[UDP] WARNING: Non-monotonic timestamp!"); }
|
||||||
|
}
|
||||||
|
if let Some(lv) = last_val {
|
||||||
|
if val == lv { println!("[UDP] WARNING: Stale value detected."); }
|
||||||
|
}
|
||||||
|
|
||||||
|
last_ts = Some(ts);
|
||||||
|
last_val = Some(val);
|
||||||
|
samples_received += 1;
|
||||||
|
}
|
||||||
|
offset += size as usize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if samples_received >= 20 {
|
||||||
|
println!("\n[RESULT] SUCCESS: Telemetry pipeline is fully functional!");
|
||||||
|
} else {
|
||||||
|
println!("\n[RESULT] FAILURE: Received only {} samples.", samples_received);
|
||||||
|
}
|
||||||
|
}
|
||||||
394
app_output.log
Normal file
394
app_output.log
Normal file
@@ -0,0 +1,394 @@
|
|||||||
|
MARTe2 Environment Set (MARTe2_DIR=/home/martino/Projects/marte_debug/dependency/MARTe2)
|
||||||
|
MARTe2 Components Environment Set (MARTe2_Components_DIR=/home/martino/Projects/marte_debug/dependency/MARTe2-components)
|
||||||
|
Cleaning up lingering processes...
|
||||||
|
Launching standard MARTeApp.ex with debug_test.cfg...
|
||||||
|
[Debug - Bootstrap.cpp:79]: Arguments:
|
||||||
|
-f = "Test/Configurations/debug_test.cfg"
|
||||||
|
-l = "RealTimeLoader"
|
||||||
|
-s = "State1"
|
||||||
|
|
||||||
|
[Information - Bootstrap.cpp:207]: Loader parameters:
|
||||||
|
-f = "Test/Configurations/debug_test.cfg"
|
||||||
|
-l = "RealTimeLoader"
|
||||||
|
-s = "State1"
|
||||||
|
Loader = "RealTimeLoader"
|
||||||
|
Filename = "Test/Configurations/debug_
|
||||||
|
[Information - Loader.cpp:67]: DefaultCPUs set to 1
|
||||||
|
[Information - Loader.cpp:74]: SchedulerGranularity is 10000
|
||||||
|
[Debug - Loader.cpp:189]: Purging ObjectRegistryDatabase with 0 objects
|
||||||
|
[Debug - Loader.cpp:192]: Purge ObjectRegistryDatabase. Number of objects left: 0
|
||||||
|
[DebugService] TCP Server listening on port 8080
|
||||||
|
[DebugService] UDP Streamer socket opened
|
||||||
|
[ParametersError - StringHelper.cpp:60]: Error: invalid input arguments
|
||||||
|
[Warning - Threads.cpp:173]: Requested a thread priority that is higher than the one supported by the selected policy - clipping to the maximum value supported by the policy.
|
||||||
|
[Warning - Threads.cpp:173]: Requested a thread priority that is higher than the one supported by the selected policy - clipping to the maximum value supported by the policy.
|
||||||
|
[ParametersError - StringHelper.cpp:60]: Error: invalid input arguments
|
||||||
|
[Warning - Threads.cpp:173]: Requested a thread priority that is higher than the one supported by the selected policy - clipping to the maximum value supported by the policy.
|
||||||
|
[Warning - Threads.cpp:173]: Requested a thread priority that is higher than the one supported by the selected policy - clipping to the maximum value supported by the policy.
|
||||||
|
[DebugService] Worker threads started.
|
||||||
|
[TcpLogger] Listening on port 8082
|
||||||
|
[ParametersError - StringHelper.cpp:60]: Error: invalid input arguments
|
||||||
|
[Warning - Threads.cpp:173]: Requested a thread priority that is higher than the one supported by the selected policy - clipping to the maximum value supported by the policy.
|
||||||
|
[Warning - Threads.cpp:173]: Requested a thread priority that is higher than the one supported by the selected policy - clipping to the maximum value supported by the policy.
|
||||||
|
[Warning] Requested a thread priority that is higher than the one supported by the selected policy - clipping to the maximum value supported by the policy.
|
||||||
|
[Warning] Requested a thread priority that is higher than the one supported by the selected policy - clipping to the maximum value supported by the policy.
|
||||||
|
[Information] SleepNature was not set. Using Default.
|
||||||
|
[Information] Phase was not configured, using default 0
|
||||||
|
[Warning] ExecutionMode not specified using: IndependentThread
|
||||||
|
[Warning] CPUMask not specified using: 255
|
||||||
|
[Warning] StackSize not specified using: 262144
|
||||||
|
[Information] No timer provider specified. Falling back to HighResolutionTimeProvider
|
||||||
|
[Information] Sleep nature was not specified, falling back to default (Sleep::NoMore mode)
|
||||||
|
[Information] Inner initialization succeeded
|
||||||
|
[Information] Backward compatibility parameters injection unnecessary
|
||||||
|
[Information] SleepNature was not set. Using Default.
|
||||||
|
[Information] Phase was not configured, using default 0
|
||||||
|
[Warning] ExecutionMode not specified using: IndependentThread
|
||||||
|
[Warning] CPUMask not specified using: 255
|
||||||
|
[Warning] StackSize not specified using: 262144
|
||||||
|
[Information] No timer provider specified. Falling back to HighResolutionTimeProvider
|
||||||
|
[Information] Sleep nature was not specified, falling back to default (Sleep::NoMore mode)
|
||||||
|
[Information] Inner initialization succeeded
|
||||||
|
[Information] Backward compatibility parameters injection unnecessary
|
||||||
|
[Information] No CPUs defined for the RealTimeThread Thread1
|
||||||
|
[Information] No StackSize defined for the RealTimeThread Thread1
|
||||||
|
[Information] No CPUs defined for the RealTimeThread Thread2
|
||||||
|
[Information] No StackSize defined for the RealTimeThread Thread2
|
||||||
|
[Information] LoaderPostInit not set
|
||||||
|
[Debug] Finished updating the signal database
|
||||||
|
[Information] Going to rtAppBuilder.ConfigureAfterInitialisation()
|
||||||
|
[Information] Going to InitialiseSignalsDatabase
|
||||||
|
[Debug] Updating the signal database
|
||||||
|
[Debug] Finished updating the signal database
|
||||||
|
[Information] Going to FlattenSignalsDatabases
|
||||||
|
[Information] Caching introspection signals
|
||||||
|
[Information] Flattening functions input signals
|
||||||
|
[Debug] Updating the signal database
|
||||||
|
[Debug] Finished updating the signal database
|
||||||
|
[Debug] Updating the signal database
|
||||||
|
[Debug] Updating the signal database
|
||||||
|
[Debug] Finished updating the signal database
|
||||||
|
[Debug] Finished updating the signal database
|
||||||
|
[Information] Flattening functions output signals
|
||||||
|
[Debug] Updating the signal database
|
||||||
|
[Debug] Finished updating the signal database
|
||||||
|
[Debug] Updating the signal database
|
||||||
|
[Debug] Finished updating the signal database
|
||||||
|
[Debug] Updating the signal database
|
||||||
|
[Debug] Finished updating the signal database
|
||||||
|
[Information] Flattening data sources signals
|
||||||
|
[Debug] Updating the signal database
|
||||||
|
[Debug] Finished updating the signal database
|
||||||
|
[Debug] Updating the signal database
|
||||||
|
[Information] Going to ResolveStates
|
||||||
|
[Information] Resolving state State1
|
||||||
|
[Information] Resolving thread container Threads
|
||||||
|
[Information] Resolving thread State1.Thread1
|
||||||
|
[Information] Resolving GAM1
|
||||||
|
[Information] Resolving thread State1.Thread2
|
||||||
|
[Information] Resolving GAM2
|
||||||
|
[Information] Going to ResolveDataSources
|
||||||
|
[Information] Resolving for function GAM1 [idx: 0]
|
||||||
|
[Information] Resolving 2 signals
|
||||||
|
[Information] Resolving 2 signals
|
||||||
|
[Information] Resolving for function GAM2 [idx: 1]
|
||||||
|
[Information] Resolving 2 signals
|
||||||
|
[Information] Resolving 2 signals
|
||||||
|
[DebugBrokerBuilder] Built MemoryMapSynchronisedInputBroker
|
||||||
|
[DebugBrokerBuilder] Built MemoryMapInputBroker
|
||||||
|
[Information] Going to VerifyDataSourcesSignals
|
||||||
|
[Information] Verifying signals for Timer
|
||||||
|
[Information] Verifying signals for TimerSlow
|
||||||
|
[Information] Verifying signals for Logger
|
||||||
|
[Information] Verifying signals for DDB
|
||||||
|
[Information] Verifying signals for DAMS
|
||||||
|
[Information] Going to VerifyConsumersAndProducers
|
||||||
|
[Information] Verifying consumers and producers for Timer
|
||||||
|
[Information] Verifying consumers and producers for TimerSlow
|
||||||
|
[Information] Verifying consumers and producers for Logger
|
||||||
|
[Information] Verifying consumers and producers for DDB
|
||||||
|
[Information] Verifying consumers and producers for DAMS
|
||||||
|
[Information] Going to CleanCaches
|
||||||
|
[Information] Creating broker MemoryMapSynchronisedInputBroker for GAM2 and signal Counter(0)
|
||||||
|
[DebugBrokerBuilder] Built MemoryMapSynchronisedInputBroker
|
||||||
|
[Debug] Purging dataSourcesIndexesCache. Number of children:4
|
||||||
|
[Debug] Purging functionsIndexesCache. Number of children:2
|
||||||
|
[Debug] Purging dataSourcesSignalIndexCache. Number of children:4
|
||||||
|
[Debug] Purging dataSourcesFunctionIndexesCache. Number of children:1
|
||||||
|
[Debug] Purging functionsMemoryIndexesCache. Number of children:1
|
||||||
|
[Debug] Purged functionsMemoryIndexesCache. Number of children:0
|
||||||
|
[Debug] Purged cachedIntrospections. Number of children:0
|
||||||
|
[Information] Going to rtAppBuilder.PostConfigureDataSources()
|
||||||
|
[Information] Going to rtAppBuilder.PostConfigureFunctions()
|
||||||
|
[Information] Going to rtAppBuilder.Copy()
|
||||||
|
[Information] Going to AllocateGAMMemory
|
||||||
|
[Information] Going to AllocateDataSourceMemory()
|
||||||
|
[Information] Going to AddBrokersToFunctions
|
||||||
|
[Information] Creating broker MemoryMapSynchronisedInputBroker for GAM1 and signal Counter(0)
|
||||||
|
[Information] Creating broker MemoryMapInputBroker for GAM1 and signal Time(1)
|
||||||
|
[Information] Getting input brokers for Timer
|
||||||
|
[Information] Getting output brokers for Timer
|
||||||
|
[DebugBrokerBuilder] Built MemoryMapInputBroker
|
||||||
|
[DebugBrokerBuilder] Built MemoryMapOutputBroker
|
||||||
|
[Information] Creating broker MemoryMapInputBroker for GAM2 and signal Time(1)
|
||||||
|
[Information] Getting input brokers for TimerSlow
|
||||||
|
[Information] Getting output brokers for TimerSlow
|
||||||
|
[Information] Getting input brokers for Logger
|
||||||
|
[Information] Getting output brokers for Logger
|
||||||
|
[Information] Getting input brokers for DDB
|
||||||
|
[Information] Getting output brokers for DDB
|
||||||
|
[Information] Getting input brokers for DAMS
|
||||||
|
[Information] Getting output brokers for DAMS
|
||||||
|
[Information] Going to FindStatefulDataSources
|
||||||
|
[Information] Going to configure scheduler
|
||||||
|
[Information] Preparing state State1
|
||||||
|
[Information] Frequency found = 1000.000000
|
||||||
|
[Information] Frequency found = 1000.000000
|
||||||
|
[Information] The timer will be set using a frequency of 1000.000000 Hz
|
||||||
|
[ParametersError] Error: invalid input arguments
|
||||||
|
[Warning] Requested a thread priority that is higher than the one supported by the selected policy - clipping to the maximum value supported by the policy.
|
||||||
|
[Warning] Failed to change the thread priority (likely due to insufficient permissions)
|
||||||
|
[Information] LinuxTimer::Prepared = true
|
||||||
|
[Information] Frequency found = 10.000000
|
||||||
|
[Information] Frequency found = 10.000000
|
||||||
|
[Information] The timer will be set using a frequency of 10.000000 Hz
|
||||||
|
[ParametersError] Error: invalid input arguments
|
||||||
|
[Warning] Requested a thread priority that is higher than the one supported by the selected policy - clipping to the maximum value supported by the policy.
|
||||||
|
[Warning] Failed to change the thread priority (likely due to insufficient permissions)
|
||||||
|
[Information] LinuxTimer::Prepared = true
|
||||||
|
[Warning] Requested a thread priority that is higher than the one supported by the selected policy - clipping to the maximum value supported by the policy.
|
||||||
|
[Warning] Failed to change the thread priority (likely due to insufficient permissions)
|
||||||
|
[Warning] Requested a thread priority that is higher than the one supported by the selected policy - clipping to the maximum value supported by the policy.
|
||||||
|
[Warning] Failed to change the thread priority (likely due to insufficient permissions)
|
||||||
|
[Information] Started application in state State1
|
||||||
|
[Information] Application starting
|
||||||
|
[Information] Counter [0:0]:1
|
||||||
|
[Information] Time [0:0]:0
|
||||||
|
[Information] Counter [0:0]:2
|
||||||
|
[Information] Time [0:0]:200000
|
||||||
|
[Information] Counter [0:0]:3
|
||||||
|
[Information] Time [0:0]:300000
|
||||||
|
[Information] Counter [0:0]:4
|
||||||
|
[Information] Time [0:0]:400000
|
||||||
|
[DebugService] Discover called. Instance: 0x7fd54d967010
|
||||||
|
[DebugService] Found existing broker: GAM1.InputBroker.MemoryMapSynchronisedInputBroker (MemoryMapSynchronisedInputBroker)
|
||||||
|
[DebugService] Found existing broker: GAM1.InputBroker.MemoryMapInputBroker (MemoryMapInputBroker)
|
||||||
|
[DebugService] Found existing broker: GAM2.InputBroker.MemoryMapSynchronisedInputBroker (MemoryMapSynchronisedInputBroker)
|
||||||
|
[DebugService] Found existing broker: GAM2.InputBroker.MemoryMapInputBroker (MemoryMapInputBroker)
|
||||||
|
[DebugService] Found existing broker: (null) (MemoryMapOutputBroker)
|
||||||
|
[DebugService] Registry Scan: Current Signals=19, Brokers=0
|
||||||
|
[Debug] Tracing state for App.Data.Timer.Counter (ID: 0, Mem: (nil)) set to 1
|
||||||
|
[Debug] WARNING: Signal App.Data.Timer.Counter is NOT associated with any active broker!
|
||||||
|
[Information] Counter [0:0]:5
|
||||||
|
[Information] Time [0:0]:500000
|
||||||
|
[Information] Counter [0:0]:6
|
||||||
|
[Information] Time [0:0]:600000
|
||||||
|
[Information] Counter [0:0]:7
|
||||||
|
[Information] Time [0:0]:700000
|
||||||
|
[Information] Counter [0:0]:8
|
||||||
|
[Information] Time [0:0]:800000
|
||||||
|
[Information] Counter [0:0]:9
|
||||||
|
[Information] Time [0:0]:900000
|
||||||
|
[Information] Counter [0:0]:10
|
||||||
|
[Information] Time [0:0]:1000000
|
||||||
|
[Information] Counter [0:0]:11
|
||||||
|
[Information] Time [0:0]:1100000
|
||||||
|
[Information] Counter [0:0]:12
|
||||||
|
[Information] Time [0:0]:1200000
|
||||||
|
[Information] Counter [0:0]:13
|
||||||
|
[Information] Time [0:0]:1300000
|
||||||
|
[Information] Counter [0:0]:14
|
||||||
|
[Information] Time [0:0]:1400000
|
||||||
|
[Information] Counter [0:0]:15
|
||||||
|
[Information] Time [0:0]:1500000
|
||||||
|
[Information] Counter [0:0]:16
|
||||||
|
[Information] Time [0:0]:1600000
|
||||||
|
[Information] Counter [0:0]:17
|
||||||
|
[Information] Time [0:0]:1700000
|
||||||
|
[Information] Counter [0:0]:18
|
||||||
|
[Information] Time [0:0]:1800000
|
||||||
|
[Information] Counter [0:0]:19
|
||||||
|
[Information] Time [0:0]:1900000
|
||||||
|
[Information] Counter [0:0]:20
|
||||||
|
[Information] Time [0:0]:2000000
|
||||||
|
[Information] Counter [0:0]:21
|
||||||
|
[Information] Time [0:0]:2100000
|
||||||
|
[Information] Counter [0:0]:22
|
||||||
|
[Information] Time [0:0]:2200000
|
||||||
|
[Information] Counter [0:0]:23
|
||||||
|
[Information] Time [0:0]:2300000
|
||||||
|
[Information] Counter [0:0]:24
|
||||||
|
[Information] Time [0:0]:2400000
|
||||||
|
[Information] Counter [0:0]:25
|
||||||
|
[Information] Time [0:0]:2500000
|
||||||
|
[Information] Counter [0:0]:26
|
||||||
|
[Information] Time [0:0]:2600000
|
||||||
|
[Information] Counter [0:0]:27
|
||||||
|
[Information] Time [0:0]:2700000
|
||||||
|
[Information] Counter [0:0]:28
|
||||||
|
[Information] Time [0:0]:2800000
|
||||||
|
[Information] Counter [0:0]:29
|
||||||
|
[Information] Time [0:0]:2900000
|
||||||
|
[Information] Counter [0:0]:30
|
||||||
|
[Information] Time [0:0]:3000000
|
||||||
|
[Information] Counter [0:0]:31
|
||||||
|
[Information] Time [0:0]:3100000
|
||||||
|
[Information] Counter [0:0]:32
|
||||||
|
[Information] Time [0:0]:3200000
|
||||||
|
[Information] Counter [0:0]:33
|
||||||
|
[Information] Time [0:0]:3300000
|
||||||
|
[Information] Counter [0:0]:34
|
||||||
|
[Information] Time [0:0]:3400000
|
||||||
|
[Information] Counter [0:0]:35
|
||||||
|
[Information] Time [0:0]:3500000
|
||||||
|
[Information] Counter [0:0]:36
|
||||||
|
[Information] Time [0:0]:3600000
|
||||||
|
[Information] Counter [0:0]:37
|
||||||
|
[Information] Time [0:0]:3700000
|
||||||
|
[Information] Counter [0:0]:38
|
||||||
|
[Information] Time [0:0]:3800000
|
||||||
|
[Information] Counter [0:0]:39
|
||||||
|
[Information] Time [0:0]:3900000
|
||||||
|
[Information] Counter [0:0]:40
|
||||||
|
[Information] Time [0:0]:4000000
|
||||||
|
[Information] Counter [0:0]:41
|
||||||
|
[Information] Time [0:0]:4100000
|
||||||
|
[Information] Counter [0:0]:42
|
||||||
|
[Information] Time [0:0]:4200000
|
||||||
|
[Information] Counter [0:0]:43
|
||||||
|
[Information] Time [0:0]:4300000
|
||||||
|
[Information] Counter [0:0]:44
|
||||||
|
[Information] Time [0:0]:4400000
|
||||||
|
[Information] Counter [0:0]:45
|
||||||
|
[Information] Time [0:0]:4500000
|
||||||
|
[Information] Counter [0:0]:46
|
||||||
|
[Information] Time [0:0]:4600000
|
||||||
|
[Information] Counter [0:0]:47
|
||||||
|
[Information] Time [0:0]:4700000
|
||||||
|
[Information] Counter [0:0]:48
|
||||||
|
[Information] Time [0:0]:4800000
|
||||||
|
[Information] Counter [0:0]:49
|
||||||
|
[Information] Time [0:0]:4900000
|
||||||
|
[Information] Counter [0:0]:50
|
||||||
|
[Information] Time [0:0]:5000000
|
||||||
|
[Information] Counter [0:0]:51
|
||||||
|
[Information] Time [0:0]:5100000
|
||||||
|
[Information] Counter [0:0]:52
|
||||||
|
[Information] Time [0:0]:5200000
|
||||||
|
[Information] Counter [0:0]:53
|
||||||
|
[Information] Time [0:0]:5300000
|
||||||
|
[Information] Counter [0:0]:54
|
||||||
|
[Information] Time [0:0]:5400000
|
||||||
|
[Information] Counter [0:0]:55
|
||||||
|
[Information] Time [0:0]:5500000
|
||||||
|
[Information] Counter [0:0]:56
|
||||||
|
[Information] Time [0:0]:5600000
|
||||||
|
[Information] Counter [0:0]:57
|
||||||
|
[Information] Time [0:0]:5700000
|
||||||
|
[Information] Counter [0:0]:58
|
||||||
|
[Information] Time [0:0]:5800000
|
||||||
|
[Information] Counter [0:0]:59
|
||||||
|
[Information] Time [0:0]:5900000
|
||||||
|
[Information] Counter [0:0]:60
|
||||||
|
[Information] Time [0:0]:6000000
|
||||||
|
[Information] Counter [0:0]:61
|
||||||
|
[Information] Time [0:0]:6100000
|
||||||
|
[Information] Counter [0:0]:62
|
||||||
|
[Information] Time [0:0]:6200000
|
||||||
|
[Information] Counter [0:0]:63
|
||||||
|
[Information] Time [0:0]:6300000
|
||||||
|
[Information] Counter [0:0]:64
|
||||||
|
[Information] Time [0:0]:6400000
|
||||||
|
[Information] Counter [0:0]:65
|
||||||
|
[Information] Time [0:0]:6500000
|
||||||
|
[Information] Counter [0:0]:66
|
||||||
|
[Information] Time [0:0]:6600000
|
||||||
|
[Information] Counter [0:0]:67
|
||||||
|
[Information] Time [0:0]:6700000
|
||||||
|
[Information] Counter [0:0]:68
|
||||||
|
[Information] Time [0:0]:6800000
|
||||||
|
[Information] Counter [0:0]:69
|
||||||
|
[Information] Time [0:0]:6900000
|
||||||
|
[Information] Counter [0:0]:70
|
||||||
|
[Information] Time [0:0]:7000000
|
||||||
|
[Information] Counter [0:0]:71
|
||||||
|
[Information] Time [0:0]:7100000
|
||||||
|
[Information] Counter [0:0]:72
|
||||||
|
[Information] Time [0:0]:7200000
|
||||||
|
[Information] Counter [0:0]:73
|
||||||
|
[Information] Time [0:0]:7300000
|
||||||
|
[Information] Counter [0:0]:74
|
||||||
|
[Information] Time [0:0]:7400000
|
||||||
|
[Information] Counter [0:0]:75
|
||||||
|
[Information] Time [0:0]:7500000
|
||||||
|
[Information] Counter [0:0]:76
|
||||||
|
[Information] Time [0:0]:7600000
|
||||||
|
[Information] Counter [0:0]:77
|
||||||
|
[Information] Time [0:0]:7700000
|
||||||
|
[Information] Counter [0:0]:78
|
||||||
|
[Information] Time [0:0]:7800000
|
||||||
|
[Information] Counter [0:0]:79
|
||||||
|
[Information] Time [0:0]:7900000
|
||||||
|
[Information] Counter [0:0]:80
|
||||||
|
[Information] Time [0:0]:8000000
|
||||||
|
[Information] Counter [0:0]:81
|
||||||
|
[Information] Time [0:0]:8100000
|
||||||
|
[Information] Counter [0:0]:82
|
||||||
|
[Information] Time [0:0]:8200000
|
||||||
|
[Information] Counter [0:0]:83
|
||||||
|
[Information] Time [0:0]:8300000
|
||||||
|
[Information] Counter [0:0]:84
|
||||||
|
[Information] Time [0:0]:8400000
|
||||||
|
[Information] Counter [0:0]:85
|
||||||
|
[Information] Time [0:0]:8500000
|
||||||
|
[Information] Counter [0:0]:86
|
||||||
|
[Information] Time [0:0]:8600000
|
||||||
|
[Information] Counter [0:0]:87
|
||||||
|
[Information] Time [0:0]:8700000
|
||||||
|
[Information] Counter [0:0]:88
|
||||||
|
[Information] Time [0:0]:8800000
|
||||||
|
[Information] Counter [0:0]:89
|
||||||
|
[Information] Time [0:0]:8900000
|
||||||
|
[Information] Counter [0:0]:90
|
||||||
|
[Information] Time [0:0]:9000000
|
||||||
|
[Information] Counter [0:0]:91
|
||||||
|
[Information] Time [0:0]:9100000
|
||||||
|
[Information] Counter [0:0]:92
|
||||||
|
[Information] Time [0:0]:9200000
|
||||||
|
[Information] Counter [0:0]:93
|
||||||
|
[Information] Time [0:0]:9300000
|
||||||
|
[Information] Counter [0:0]:94
|
||||||
|
[Information] Time [0:0]:9400000
|
||||||
|
[Information] Counter [0:0]:95
|
||||||
|
[Information] Time [0:0]:9500000
|
||||||
|
[Information] Counter [0:0]:96
|
||||||
|
[Information] Time [0:0]:9600000
|
||||||
|
[Information] Counter [0:0]:97
|
||||||
|
[Information] Time [0:0]:9700000
|
||||||
|
[Information] Counter [0:0]:98
|
||||||
|
[Information] Time [0:0]:9800000
|
||||||
|
[Information] Counter [0:0]:99
|
||||||
|
[Information] Time [0:0]:9900000
|
||||||
|
[Information] Counter [0:0]:100
|
||||||
|
[Information] Time [0:0]:10000000
|
||||||
|
[Information] Counter [0:0]:101
|
||||||
|
[Information] Time [0:0]:10100000
|
||||||
|
[Information] Counter [0:0]:102
|
||||||
|
[Information] Time [0:0]:10200000
|
||||||
|
[Information] Counter [0:0]:103
|
||||||
|
[Information] Time [0:0]:10300000
|
||||||
|
[Information] Counter [0:0]:104
|
||||||
|
[Information] Time [0:0]:10400000
|
||||||
|
[Information] Counter [0:0]:105
|
||||||
|
[Information] Time [0:0]:10500000
|
||||||
|
[Information] Counter [0:0]:106
|
||||||
|
[Information] Time [0:0]:10600000
|
||||||
|
[Information] Counter [0:0]:107
|
||||||
|
[Information] Time [0:0]:10700000
|
||||||
|
[Information] Counter [0:0]:108
|
||||||
|
[Information] Time [0:0]:10800000
|
||||||
|
[Information] Counter [0:0]:109
|
||||||
|
[Information] Time [0:0]:10900000
|
||||||
|
[Information] Counter [0:0]:110
|
||||||
|
[Information] Time [0:0]:11000000
|
||||||
|
./run_debug_app.sh: line 40: 325075 Killed "$MARTE_EX" -f Test/Configurations/debug_test.cfg -l RealTimeLoader -s State1
|
||||||
@@ -1,386 +1,412 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"file": "TcpLogger.cpp",
|
"file": "CMakeCCompilerId.c",
|
||||||
"arguments": [
|
"arguments": [
|
||||||
"g++",
|
"cc",
|
||||||
"-c",
|
"CMakeCCompilerId.c"
|
||||||
"-I.",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
|
||||||
"-fPIC",
|
|
||||||
"-Wall",
|
|
||||||
"-std=c++98",
|
|
||||||
"-Werror",
|
|
||||||
"-Wno-invalid-offsetof",
|
|
||||||
"-Wno-unused-variable",
|
|
||||||
"-fno-strict-aliasing",
|
|
||||||
"-frtti",
|
|
||||||
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
|
||||||
"-DARCHITECTURE=x86_gcc",
|
|
||||||
"-DENVIRONMENT=Linux",
|
|
||||||
"-DUSE_PTHREAD",
|
|
||||||
"-pthread",
|
|
||||||
"-Wno-deprecated-declarations",
|
|
||||||
"-Wno-unused-value",
|
|
||||||
"-g",
|
|
||||||
"-ggdb",
|
|
||||||
"TcpLogger.cpp",
|
|
||||||
"-o",
|
|
||||||
"../../../..//Build/x86-linux/Components/Interfaces/TCPLogger/TcpLogger.o"
|
|
||||||
],
|
],
|
||||||
"directory": "/home/martino/Projects/marte_debug/Source/Components/Interfaces/TCPLogger",
|
"directory": "/home/martino/Projects/marte_debug/Build/CMakeFiles/4.2.3/CompilerIdC"
|
||||||
"output": "../../../..//Build/x86-linux/Components/Interfaces/TCPLogger/TcpLogger.o"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "DebugService.cpp",
|
"file": "CMakeCXXCompilerId.cpp",
|
||||||
"arguments": [
|
"arguments": [
|
||||||
"g++",
|
"c++",
|
||||||
"-c",
|
"CMakeCXXCompilerId.cpp"
|
||||||
"-I../../../..//Source/Core/Types/Result",
|
|
||||||
"-I../../../..//Source/Core/Types/Vec",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
|
||||||
"-fPIC",
|
|
||||||
"-Wall",
|
|
||||||
"-std=c++98",
|
|
||||||
"-Werror",
|
|
||||||
"-Wno-invalid-offsetof",
|
|
||||||
"-Wno-unused-variable",
|
|
||||||
"-fno-strict-aliasing",
|
|
||||||
"-frtti",
|
|
||||||
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
|
||||||
"-DARCHITECTURE=x86_gcc",
|
|
||||||
"-DENVIRONMENT=Linux",
|
|
||||||
"-DUSE_PTHREAD",
|
|
||||||
"-pthread",
|
|
||||||
"-Wno-deprecated-declarations",
|
|
||||||
"-Wno-unused-value",
|
|
||||||
"-g",
|
|
||||||
"-ggdb",
|
|
||||||
"DebugService.cpp",
|
|
||||||
"-o",
|
|
||||||
"../../../..//Build/x86-linux/Components/Interfaces/DebugService/DebugService.o"
|
|
||||||
],
|
],
|
||||||
"directory": "/home/martino/Projects/marte_debug/Source/Components/Interfaces/DebugService",
|
"directory": "/home/martino/Projects/marte_debug/Build/CMakeFiles/4.2.3/CompilerIdCXX"
|
||||||
"output": "../../../..//Build/x86-linux/Components/Interfaces/DebugService/DebugService.o"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "UnitTests.cpp",
|
"file": "/usr/share/cmake/Modules/CMakeCCompilerABI.c",
|
||||||
"arguments": [
|
"arguments": [
|
||||||
"g++",
|
"cc",
|
||||||
"-c",
|
"-v",
|
||||||
"-I../../Source/Core/Types/Result",
|
|
||||||
"-I../../Source/Core/Types/Vec",
|
|
||||||
"-I../../Source/Components/Interfaces/DebugService",
|
|
||||||
"-I../../Source/Components/Interfaces/TCPLogger",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
|
||||||
"-fPIC",
|
|
||||||
"-Wall",
|
|
||||||
"-std=c++98",
|
|
||||||
"-Werror",
|
|
||||||
"-Wno-invalid-offsetof",
|
|
||||||
"-Wno-unused-variable",
|
|
||||||
"-fno-strict-aliasing",
|
|
||||||
"-frtti",
|
|
||||||
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
|
||||||
"-DARCHITECTURE=x86_gcc",
|
|
||||||
"-DENVIRONMENT=Linux",
|
|
||||||
"-DUSE_PTHREAD",
|
|
||||||
"-pthread",
|
|
||||||
"-Wno-deprecated-declarations",
|
|
||||||
"-Wno-unused-value",
|
|
||||||
"-g",
|
|
||||||
"-ggdb",
|
|
||||||
"UnitTests.cpp",
|
|
||||||
"-o",
|
"-o",
|
||||||
"../../Build/x86-linux/Test/UnitTests/UnitTests/UnitTests.o"
|
"CMakeFiles/cmTC_a4cfb.dir/CMakeCCompilerABI.c.o",
|
||||||
|
"-c",
|
||||||
|
"/usr/share/cmake/Modules/CMakeCCompilerABI.c"
|
||||||
],
|
],
|
||||||
"directory": "/home/martino/Projects/marte_debug/Test/UnitTests",
|
"directory": "/home/martino/Projects/marte_debug/Build/CMakeFiles/CMakeScratch/TryCompile-xo4CnB",
|
||||||
"output": "../../Build/x86-linux/Test/UnitTests/UnitTests/UnitTests.o"
|
"output": "CMakeFiles/cmTC_a4cfb.dir/CMakeCCompilerABI.c.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "SchedulerTest.cpp",
|
"file": "/usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp",
|
||||||
"arguments": [
|
"arguments": [
|
||||||
"g++",
|
"c++",
|
||||||
|
"-v",
|
||||||
|
"-o",
|
||||||
|
"CMakeFiles/cmTC_f4fc4.dir/CMakeCXXCompilerABI.cpp.o",
|
||||||
"-c",
|
"-c",
|
||||||
"-I../../Source/Core/Types/Result",
|
"/usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp"
|
||||||
"-I../../Source/Core/Types/Vec",
|
],
|
||||||
"-I../../Source/Components/Interfaces/DebugService",
|
"directory": "/home/martino/Projects/marte_debug/Build/CMakeFiles/CMakeScratch/TryCompile-tgsqrG",
|
||||||
"-I../../Source/Components/Interfaces/TCPLogger",
|
"output": "CMakeFiles/cmTC_f4fc4.dir/CMakeCXXCompilerABI.cpp.o"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "/home/martino/Projects/marte_debug/Source/DebugFastScheduler.cpp",
|
||||||
|
"arguments": [
|
||||||
|
"c++",
|
||||||
|
"-DARCHITECTURE=x86_gcc",
|
||||||
|
"-DENVIRONMENT=Linux",
|
||||||
|
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
||||||
|
"-DUSE_PTHREAD",
|
||||||
|
"-Dmarte_dev_EXPORTS",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Events",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5FILES",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L6App",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L6App",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
||||||
"-fPIC",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
||||||
"-Wall",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/EpicsDataSource",
|
||||||
"-std=c++98",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/FileDataSource",
|
||||||
"-Werror",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/GAMs/IOGAM",
|
||||||
"-Wno-invalid-offsetof",
|
"-I/home/martino/Projects/marte_debug/Source",
|
||||||
"-Wno-unused-variable",
|
"-I/home/martino/Projects/marte_debug/Headers",
|
||||||
"-fno-strict-aliasing",
|
|
||||||
"-frtti",
|
|
||||||
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
|
||||||
"-DARCHITECTURE=x86_gcc",
|
|
||||||
"-DENVIRONMENT=Linux",
|
|
||||||
"-DUSE_PTHREAD",
|
|
||||||
"-pthread",
|
"-pthread",
|
||||||
"-Wno-deprecated-declarations",
|
|
||||||
"-Wno-unused-value",
|
|
||||||
"-g",
|
"-g",
|
||||||
"-ggdb",
|
"-fPIC",
|
||||||
"SchedulerTest.cpp",
|
"-MD",
|
||||||
|
"-MT",
|
||||||
|
"CMakeFiles/marte_dev.dir/Source/DebugFastScheduler.cpp.o",
|
||||||
|
"-MF",
|
||||||
|
"CMakeFiles/marte_dev.dir/Source/DebugFastScheduler.cpp.o.d",
|
||||||
"-o",
|
"-o",
|
||||||
"../../Build/x86-linux/Test/Integration/Integration/SchedulerTest.o"
|
"CMakeFiles/marte_dev.dir/Source/DebugFastScheduler.cpp.o",
|
||||||
|
"-c",
|
||||||
|
"/home/martino/Projects/marte_debug/Source/DebugFastScheduler.cpp"
|
||||||
],
|
],
|
||||||
"directory": "/home/martino/Projects/marte_debug/Test/Integration",
|
"directory": "/home/martino/Projects/marte_debug/Build",
|
||||||
"output": "../../Build/x86-linux/Test/Integration/Integration/SchedulerTest.o"
|
"output": "CMakeFiles/marte_dev.dir/Source/DebugFastScheduler.cpp.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "TraceTest.cpp",
|
"file": "/home/martino/Projects/marte_debug/Source/DebugService.cpp",
|
||||||
"arguments": [
|
"arguments": [
|
||||||
"g++",
|
"c++",
|
||||||
"-c",
|
"-DARCHITECTURE=x86_gcc",
|
||||||
"-I../../Source/Core/Types/Result",
|
"-DENVIRONMENT=Linux",
|
||||||
"-I../../Source/Core/Types/Vec",
|
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
||||||
"-I../../Source/Components/Interfaces/DebugService",
|
"-DUSE_PTHREAD",
|
||||||
"-I../../Source/Components/Interfaces/TCPLogger",
|
"-Dmarte_dev_EXPORTS",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Events",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5FILES",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L6App",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L6App",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
||||||
"-fPIC",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
||||||
"-Wall",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/EpicsDataSource",
|
||||||
"-std=c++98",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/FileDataSource",
|
||||||
"-Werror",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/GAMs/IOGAM",
|
||||||
"-Wno-invalid-offsetof",
|
"-I/home/martino/Projects/marte_debug/Source",
|
||||||
"-Wno-unused-variable",
|
"-I/home/martino/Projects/marte_debug/Headers",
|
||||||
"-fno-strict-aliasing",
|
|
||||||
"-frtti",
|
|
||||||
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
|
||||||
"-DARCHITECTURE=x86_gcc",
|
|
||||||
"-DENVIRONMENT=Linux",
|
|
||||||
"-DUSE_PTHREAD",
|
|
||||||
"-pthread",
|
"-pthread",
|
||||||
"-Wno-deprecated-declarations",
|
|
||||||
"-Wno-unused-value",
|
|
||||||
"-g",
|
"-g",
|
||||||
"-ggdb",
|
"-fPIC",
|
||||||
"TraceTest.cpp",
|
"-MD",
|
||||||
|
"-MT",
|
||||||
|
"CMakeFiles/marte_dev.dir/Source/DebugService.cpp.o",
|
||||||
|
"-MF",
|
||||||
|
"CMakeFiles/marte_dev.dir/Source/DebugService.cpp.o.d",
|
||||||
"-o",
|
"-o",
|
||||||
"../../Build/x86-linux/Test/Integration/Integration/TraceTest.o"
|
"CMakeFiles/marte_dev.dir/Source/DebugService.cpp.o",
|
||||||
|
"-c",
|
||||||
|
"/home/martino/Projects/marte_debug/Source/DebugService.cpp"
|
||||||
],
|
],
|
||||||
"directory": "/home/martino/Projects/marte_debug/Test/Integration",
|
"directory": "/home/martino/Projects/marte_debug/Build",
|
||||||
"output": "../../Build/x86-linux/Test/Integration/Integration/TraceTest.o"
|
"output": "CMakeFiles/marte_dev.dir/Source/DebugService.cpp.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "ValidationTest.cpp",
|
"file": "/home/martino/Projects/marte_debug/Source/TcpLogger.cpp",
|
||||||
"arguments": [
|
"arguments": [
|
||||||
"g++",
|
"c++",
|
||||||
"-c",
|
"-DARCHITECTURE=x86_gcc",
|
||||||
"-I../../Source/Core/Types/Result",
|
"-DENVIRONMENT=Linux",
|
||||||
"-I../../Source/Core/Types/Vec",
|
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
||||||
"-I../../Source/Components/Interfaces/DebugService",
|
"-DUSE_PTHREAD",
|
||||||
"-I../../Source/Components/Interfaces/TCPLogger",
|
"-Dmarte_dev_EXPORTS",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Events",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5FILES",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L6App",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L6App",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
||||||
"-fPIC",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
||||||
"-Wall",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/EpicsDataSource",
|
||||||
"-std=c++98",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/FileDataSource",
|
||||||
"-Werror",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/GAMs/IOGAM",
|
||||||
"-Wno-invalid-offsetof",
|
"-I/home/martino/Projects/marte_debug/Source",
|
||||||
"-Wno-unused-variable",
|
"-I/home/martino/Projects/marte_debug/Headers",
|
||||||
"-fno-strict-aliasing",
|
|
||||||
"-frtti",
|
|
||||||
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
|
||||||
"-DARCHITECTURE=x86_gcc",
|
|
||||||
"-DENVIRONMENT=Linux",
|
|
||||||
"-DUSE_PTHREAD",
|
|
||||||
"-pthread",
|
"-pthread",
|
||||||
"-Wno-deprecated-declarations",
|
|
||||||
"-Wno-unused-value",
|
|
||||||
"-g",
|
"-g",
|
||||||
"-ggdb",
|
"-fPIC",
|
||||||
"ValidationTest.cpp",
|
"-MD",
|
||||||
|
"-MT",
|
||||||
|
"CMakeFiles/marte_dev.dir/Source/TcpLogger.cpp.o",
|
||||||
|
"-MF",
|
||||||
|
"CMakeFiles/marte_dev.dir/Source/TcpLogger.cpp.o.d",
|
||||||
"-o",
|
"-o",
|
||||||
"../../Build/x86-linux/Test/Integration/Integration/ValidationTest.o"
|
"CMakeFiles/marte_dev.dir/Source/TcpLogger.cpp.o",
|
||||||
|
"-c",
|
||||||
|
"/home/martino/Projects/marte_debug/Source/TcpLogger.cpp"
|
||||||
],
|
],
|
||||||
"directory": "/home/martino/Projects/marte_debug/Test/Integration",
|
"directory": "/home/martino/Projects/marte_debug/Build",
|
||||||
"output": "../../Build/x86-linux/Test/Integration/Integration/ValidationTest.o"
|
"output": "CMakeFiles/marte_dev.dir/Source/TcpLogger.cpp.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "ConfigCommandTest.cpp",
|
"file": "/home/martino/Projects/marte_debug/Test/UnitTests/main.cpp",
|
||||||
"arguments": [
|
"arguments": [
|
||||||
"g++",
|
"c++",
|
||||||
"-c",
|
"-DARCHITECTURE=x86_gcc",
|
||||||
"-I../../Source/Core/Types/Result",
|
"-DENVIRONMENT=Linux",
|
||||||
"-I../../Source/Core/Types/Vec",
|
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
||||||
"-I../../Source/Components/Interfaces/DebugService",
|
"-DUSE_PTHREAD",
|
||||||
"-I../../Source/Components/Interfaces/TCPLogger",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Events",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5FILES",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L6App",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L6App",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
||||||
"-fPIC",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
||||||
"-Wall",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/EpicsDataSource",
|
||||||
"-std=c++98",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/FileDataSource",
|
||||||
"-Werror",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/GAMs/IOGAM",
|
||||||
"-Wno-invalid-offsetof",
|
"-I/home/martino/Projects/marte_debug/Source",
|
||||||
"-Wno-unused-variable",
|
"-I/home/martino/Projects/marte_debug/Headers",
|
||||||
"-fno-strict-aliasing",
|
"-I/home/martino/Projects/marte_debug/Test/UnitTests/../../Source",
|
||||||
"-frtti",
|
"-I/home/martino/Projects/marte_debug/Test/UnitTests/../../Headers",
|
||||||
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
|
||||||
"-DARCHITECTURE=x86_gcc",
|
|
||||||
"-DENVIRONMENT=Linux",
|
|
||||||
"-DUSE_PTHREAD",
|
|
||||||
"-pthread",
|
"-pthread",
|
||||||
"-Wno-deprecated-declarations",
|
|
||||||
"-Wno-unused-value",
|
|
||||||
"-g",
|
"-g",
|
||||||
"-ggdb",
|
"-MD",
|
||||||
"ConfigCommandTest.cpp",
|
"-MT",
|
||||||
|
"Test/UnitTests/CMakeFiles/UnitTests.dir/main.cpp.o",
|
||||||
|
"-MF",
|
||||||
|
"CMakeFiles/UnitTests.dir/main.cpp.o.d",
|
||||||
"-o",
|
"-o",
|
||||||
"../../Build/x86-linux/Test/Integration/Integration/ConfigCommandTest.o"
|
"CMakeFiles/UnitTests.dir/main.cpp.o",
|
||||||
|
"-c",
|
||||||
|
"/home/martino/Projects/marte_debug/Test/UnitTests/main.cpp"
|
||||||
],
|
],
|
||||||
"directory": "/home/martino/Projects/marte_debug/Test/Integration",
|
"directory": "/home/martino/Projects/marte_debug/Build/Test/UnitTests",
|
||||||
"output": "../../Build/x86-linux/Test/Integration/Integration/ConfigCommandTest.o"
|
"output": "CMakeFiles/UnitTests.dir/main.cpp.o"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "IntegrationTests.cpp",
|
"file": "/home/martino/Projects/marte_debug/Test/Integration/main.cpp",
|
||||||
"arguments": [
|
"arguments": [
|
||||||
"g++",
|
"c++",
|
||||||
"-c",
|
"-DARCHITECTURE=x86_gcc",
|
||||||
"-I../../Source/Core/Types/Result",
|
"-DENVIRONMENT=Linux",
|
||||||
"-I../../Source/Core/Types/Vec",
|
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
||||||
"-I../../Source/Components/Interfaces/DebugService",
|
"-DUSE_PTHREAD",
|
||||||
"-I../../Source/Components/Interfaces/TCPLogger",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Events",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5FILES",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L6App",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L6App",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4Messages",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
||||||
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
||||||
"-fPIC",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
||||||
"-Wall",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/EpicsDataSource",
|
||||||
"-std=c++98",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/FileDataSource",
|
||||||
"-Werror",
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/GAMs/IOGAM",
|
||||||
"-Wno-invalid-offsetof",
|
"-I/home/martino/Projects/marte_debug/Source",
|
||||||
"-Wno-unused-variable",
|
"-I/home/martino/Projects/marte_debug/Headers",
|
||||||
"-fno-strict-aliasing",
|
"-pthread",
|
||||||
"-frtti",
|
"-g",
|
||||||
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
"-MD",
|
||||||
|
"-MT",
|
||||||
|
"Test/Integration/CMakeFiles/IntegrationTest.dir/main.cpp.o",
|
||||||
|
"-MF",
|
||||||
|
"CMakeFiles/IntegrationTest.dir/main.cpp.o.d",
|
||||||
|
"-o",
|
||||||
|
"CMakeFiles/IntegrationTest.dir/main.cpp.o",
|
||||||
|
"-c",
|
||||||
|
"/home/martino/Projects/marte_debug/Test/Integration/main.cpp"
|
||||||
|
],
|
||||||
|
"directory": "/home/martino/Projects/marte_debug/Build/Test/Integration",
|
||||||
|
"output": "CMakeFiles/IntegrationTest.dir/main.cpp.o"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "/home/martino/Projects/marte_debug/Test/Integration/TraceTest.cpp",
|
||||||
|
"arguments": [
|
||||||
|
"c++",
|
||||||
"-DARCHITECTURE=x86_gcc",
|
"-DARCHITECTURE=x86_gcc",
|
||||||
"-DENVIRONMENT=Linux",
|
"-DENVIRONMENT=Linux",
|
||||||
|
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
||||||
"-DUSE_PTHREAD",
|
"-DUSE_PTHREAD",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Events",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5FILES",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L6App",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/EpicsDataSource",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/FileDataSource",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/GAMs/IOGAM",
|
||||||
|
"-I/home/martino/Projects/marte_debug/Source",
|
||||||
|
"-I/home/martino/Projects/marte_debug/Headers",
|
||||||
"-pthread",
|
"-pthread",
|
||||||
"-Wno-deprecated-declarations",
|
|
||||||
"-Wno-unused-value",
|
|
||||||
"-g",
|
"-g",
|
||||||
"-ggdb",
|
"-MD",
|
||||||
"IntegrationTests.cpp",
|
"-MT",
|
||||||
|
"Test/Integration/CMakeFiles/TraceTest.dir/TraceTest.cpp.o",
|
||||||
|
"-MF",
|
||||||
|
"CMakeFiles/TraceTest.dir/TraceTest.cpp.o.d",
|
||||||
"-o",
|
"-o",
|
||||||
"../../Build/x86-linux/Test/Integration/Integration/IntegrationTests.o"
|
"CMakeFiles/TraceTest.dir/TraceTest.cpp.o",
|
||||||
|
"-c",
|
||||||
|
"/home/martino/Projects/marte_debug/Test/Integration/TraceTest.cpp"
|
||||||
],
|
],
|
||||||
"directory": "/home/martino/Projects/marte_debug/Test/Integration",
|
"directory": "/home/martino/Projects/marte_debug/Build/Test/Integration",
|
||||||
"output": "../../Build/x86-linux/Test/Integration/Integration/IntegrationTests.o"
|
"output": "CMakeFiles/TraceTest.dir/TraceTest.cpp.o"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "/home/martino/Projects/marte_debug/Test/Integration/ValidationTest.cpp",
|
||||||
|
"arguments": [
|
||||||
|
"c++",
|
||||||
|
"-DARCHITECTURE=x86_gcc",
|
||||||
|
"-DENVIRONMENT=Linux",
|
||||||
|
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
||||||
|
"-DUSE_PTHREAD",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Events",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5FILES",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L6App",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/EpicsDataSource",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/FileDataSource",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/GAMs/IOGAM",
|
||||||
|
"-I/home/martino/Projects/marte_debug/Source",
|
||||||
|
"-I/home/martino/Projects/marte_debug/Headers",
|
||||||
|
"-pthread",
|
||||||
|
"-g",
|
||||||
|
"-MD",
|
||||||
|
"-MT",
|
||||||
|
"Test/Integration/CMakeFiles/ValidationTest.dir/ValidationTest.cpp.o",
|
||||||
|
"-MF",
|
||||||
|
"CMakeFiles/ValidationTest.dir/ValidationTest.cpp.o.d",
|
||||||
|
"-o",
|
||||||
|
"CMakeFiles/ValidationTest.dir/ValidationTest.cpp.o",
|
||||||
|
"-c",
|
||||||
|
"/home/martino/Projects/marte_debug/Test/Integration/ValidationTest.cpp"
|
||||||
|
],
|
||||||
|
"directory": "/home/martino/Projects/marte_debug/Build/Test/Integration",
|
||||||
|
"output": "CMakeFiles/ValidationTest.dir/ValidationTest.cpp.o"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "/home/martino/Projects/marte_debug/Test/Integration/SchedulerTest.cpp",
|
||||||
|
"arguments": [
|
||||||
|
"c++",
|
||||||
|
"-DARCHITECTURE=x86_gcc",
|
||||||
|
"-DENVIRONMENT=Linux",
|
||||||
|
"-DMARTe2_TEST_ENVIRONMENT=GTest",
|
||||||
|
"-DUSE_PTHREAD",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L0Types",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L1Portability",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L2Objects",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L3Streams",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Configuration",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Events",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Logger",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L4Messages",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5FILES",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L5GAMs",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/BareMetal/L6App",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L1Portability",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L3Services",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L4LoggerService",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L1Portability",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/FileSystem/L3Streams",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2/Source/Core/Scheduler/L5GAMs",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/EpicsDataSource",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/DataSources/FileDataSource",
|
||||||
|
"-I/home/martino/Projects/marte_debug/dependency/MARTe2-components/Source/Components/GAMs/IOGAM",
|
||||||
|
"-I/home/martino/Projects/marte_debug/Source",
|
||||||
|
"-I/home/martino/Projects/marte_debug/Headers",
|
||||||
|
"-pthread",
|
||||||
|
"-g",
|
||||||
|
"-MD",
|
||||||
|
"-MT",
|
||||||
|
"Test/Integration/CMakeFiles/SchedulerTest.dir/SchedulerTest.cpp.o",
|
||||||
|
"-MF",
|
||||||
|
"CMakeFiles/SchedulerTest.dir/SchedulerTest.cpp.o.d",
|
||||||
|
"-o",
|
||||||
|
"CMakeFiles/SchedulerTest.dir/SchedulerTest.cpp.o",
|
||||||
|
"-c",
|
||||||
|
"/home/martino/Projects/marte_debug/Test/Integration/SchedulerTest.cpp"
|
||||||
|
],
|
||||||
|
"directory": "/home/martino/Projects/marte_debug/Build/Test/Integration",
|
||||||
|
"output": "CMakeFiles/SchedulerTest.dir/SchedulerTest.cpp.o"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
22
env.fish
22
env.fish
@@ -1,22 +0,0 @@
|
|||||||
# Get the directory of this script
|
|
||||||
set -l DIR (dirname (realpath (status -f)))
|
|
||||||
|
|
||||||
set -gx MARTe2_DIR $DIR/dependency/MARTe2
|
|
||||||
set -gx MARTe2_Components_DIR $DIR/dependency/MARTe2-components
|
|
||||||
set -gx TARGET x86-linux
|
|
||||||
|
|
||||||
# Update LD_LIBRARY_PATH
|
|
||||||
if not set -q LD_LIBRARY_PATH
|
|
||||||
set -gx LD_LIBRARY_PATH ""
|
|
||||||
end
|
|
||||||
|
|
||||||
set -gx LD_LIBRARY_PATH "$LD_LIBRARY_PATH:$MARTe2_DIR/Build/$TARGET/Core"
|
|
||||||
set -gx LD_LIBRARY_PATH "$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/$TARGET/Components"
|
|
||||||
set -gx LD_LIBRARY_PATH "$LD_LIBRARY_PATH:$DIR/Build/$TARGET/Components/Interfaces/DebugService"
|
|
||||||
set -gx LD_LIBRARY_PATH "$LD_LIBRARY_PATH:$DIR/Build/$TARGET/Components/Interfaces/TCPLogger"
|
|
||||||
set -gx LD_LIBRARY_PATH "$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/$TARGET/Components/DataSources/LinuxTimer"
|
|
||||||
set -gx LD_LIBRARY_PATH "$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/$TARGET/Components/DataSources/LoggerDataSource"
|
|
||||||
set -gx LD_LIBRARY_PATH "$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/$TARGET/Components/GAMs/IOGAM"
|
|
||||||
|
|
||||||
echo "MARTe2 Environment Set (MARTe2_DIR=$MARTe2_DIR)"
|
|
||||||
echo "MARTe2 Components Environment Set (MARTe2_Components_DIR=$MARTe2_Components_DIR)"
|
|
||||||
5
env.sh
5
env.sh
@@ -7,10 +7,5 @@ export MARTe2_Components_DIR=$DIR/dependency/MARTe2-components
|
|||||||
export TARGET=x86-linux
|
export TARGET=x86-linux
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_DIR/Build/$TARGET/Core
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_DIR/Build/$TARGET/Core
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/$TARGET/Components
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/$TARGET/Components
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DIR/Build/$TARGET/Components/Interfaces/DebugService
|
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DIR/Build/$TARGET/Components/Interfaces/TCPLogger
|
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/$TARGET/Components/DataSources/LinuxTimer
|
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/$TARGET/Components/DataSources/LoggerDataSource
|
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/$TARGET/Components/GAMs/IOGAM
|
|
||||||
echo "MARTe2 Environment Set (MARTe2_DIR=$MARTe2_DIR)"
|
echo "MARTe2 Environment Set (MARTe2_DIR=$MARTe2_DIR)"
|
||||||
echo "MARTe2 Components Environment Set (MARTe2_Components_DIR=$MARTe2_Components_DIR)"
|
echo "MARTe2 Components Environment Set (MARTe2_Components_DIR=$MARTe2_Components_DIR)"
|
||||||
|
|||||||
30
run_coverage.sh
Executable file
30
run_coverage.sh
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Load environment
|
||||||
|
. ./env.sh
|
||||||
|
|
||||||
|
# Clean build directory
|
||||||
|
rm -rf Build_Coverage
|
||||||
|
|
||||||
|
# Build with coverage
|
||||||
|
mkdir -p Build_Coverage
|
||||||
|
cd Build_Coverage
|
||||||
|
cmake .. -DENABLE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug
|
||||||
|
make -j$(nproc)
|
||||||
|
|
||||||
|
# Reset coverage data
|
||||||
|
lcov --directory . --zerocounters
|
||||||
|
|
||||||
|
# Run unit tests
|
||||||
|
./Test/UnitTests/UnitTests
|
||||||
|
|
||||||
|
# Capture coverage data
|
||||||
|
lcov --directory . --capture --output-file coverage.info --ignore-errors inconsistent
|
||||||
|
|
||||||
|
# Filter out system and MARTe2 internal headers
|
||||||
|
lcov --remove coverage.info '/usr/*' '*/dependency/*' '*/Test/*' --output-file coverage_filtered.info --ignore-errors inconsistent
|
||||||
|
|
||||||
|
# Generate report
|
||||||
|
genhtml coverage_filtered.info --output-directory out --ignore-errors inconsistent
|
||||||
|
|
||||||
|
# Display summary
|
||||||
|
lcov --list coverage_filtered.info --ignore-errors inconsistent
|
||||||
@@ -26,7 +26,7 @@ for dir in $ALL_COMPONENT_DIRS; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Ensure our build dir and core dir are included
|
# Ensure our build dir and core dir are included
|
||||||
export LD_LIBRARY_PATH="$(pwd)/Build:${MARTe2_DIR}/Build/${TARGET}/Core:${LD_LIBRARY_PATH}"
|
export LD_LIBRARY_PATH="$(pwd)/Build:${LD_LIBRARY_PATH}"
|
||||||
|
|
||||||
# 3. Cleanup
|
# 3. Cleanup
|
||||||
echo "Cleaning up lingering processes..."
|
echo "Cleaning up lingering processes..."
|
||||||
@@ -36,5 +36,5 @@ sleep 1
|
|||||||
# 4. Launch Application
|
# 4. Launch Application
|
||||||
echo "Launching standard MARTeApp.ex with debug_test.cfg..."
|
echo "Launching standard MARTeApp.ex with debug_test.cfg..."
|
||||||
# PRELOAD ensures our DebugService class is available to the registry early
|
# PRELOAD ensures our DebugService class is available to the registry early
|
||||||
export LD_PRELOAD="${DEBUG_LIB}"
|
export LD_PRELOAD="$(pwd)/Build/libmarte_dev.so"
|
||||||
"$MARTE_EX" -f Test/Configurations/debug_test.cfg -l RealTimeLoader -s State1
|
"$MARTE_EX" -f Test/Configurations/debug_test.cfg -l RealTimeLoader -s State1
|
||||||
|
|||||||
20
run_test.sh
20
run_test.sh
@@ -1,16 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Get the directory of this script
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
export MARTe2_DIR=/home/martino/Projects/marte_debug/dependency/MARTe2
|
||||||
source $DIR/env.sh
|
export TARGET=x86-linux
|
||||||
|
|
||||||
echo "Cleaning up old instances..."
|
echo "Cleaning up old instances..."
|
||||||
pkill -9 IntegrationTests
|
pkill -9 IntegrationTest
|
||||||
pkill -9 UnitTests
|
pkill -9 ValidationTest
|
||||||
sleep 1
|
pkill -9 SchedulerTest
|
||||||
|
pkill -9 main
|
||||||
|
sleep 2
|
||||||
|
|
||||||
echo "Starting MARTe2 Unit Tests..."
|
|
||||||
$DIR/Build/$TARGET/Test/UnitTests/UnitTests/UnitTests.ex
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Starting MARTe2 Integration Tests..."
|
echo "Starting MARTe2 Integration Tests..."
|
||||||
$DIR/Build/$TARGET/Test/Integration/Integration/IntegrationTests.ex
|
./Build/Test/Integration/ValidationTest
|
||||||
|
|||||||
41
specs.md
Normal file
41
specs.md
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
Project Specification: MARTe2 Universal Observability & Debugging Suite
|
||||||
|
|
||||||
|
Version: 1.1
|
||||||
|
|
||||||
|
Date: 2023-10-27
|
||||||
|
|
||||||
|
Status: Active / Implemented
|
||||||
|
|
||||||
|
1. Executive Summary
|
||||||
|
|
||||||
|
This project implements a "Zero-Code-Change" observability and debugging layer for the MARTe2 real-time framework. The system allows developers to Trace, Force, and Monitor any signal in a running MARTe2 application without modifying existing source code.
|
||||||
|
|
||||||
|
2. System Architecture
|
||||||
|
|
||||||
|
- The Universal Debug Service (C++ Core): A singleton MARTe2 Object that patches the registry and manages communication.
|
||||||
|
- The Broker Injection Layer (C++ Templates): Templated wrappers that intercept Copy() calls for tracing, forcing, and execution control.
|
||||||
|
- The Remote Analyser (Rust/egui): A high-performance, multi-threaded GUI for visualization and control.
|
||||||
|
|
||||||
|
3. Functional Requirements
|
||||||
|
|
||||||
|
3.1 Execution Control
|
||||||
|
- REQ-25: Execution Control (Pause/Resume): The system SHALL provide a mechanism to pause and resume the execution of all patched real-time threads (via Brokers), allowing for static inspection of the system state.
|
||||||
|
|
||||||
|
3.2 Discovery
|
||||||
|
- REQ-24: Tree Exploration: The GUI client SHALL request the full application tree upon connection and display it in a hierarchical tree view.
|
||||||
|
- TREE Command: Returns a recursive JSON structure representing the entire application tree, including signal metadata (Type, Dimensions, Elements).
|
||||||
|
|
||||||
|
3.3 Multi-Threaded Client (REQ-23)
|
||||||
|
- Port 8080 (TCP): Commands and Metadata.
|
||||||
|
- Port 8082 (TCP): Independent Real-Time Log Stream.
|
||||||
|
- Port 8081 (UDP): High-Speed Telemetry for Oscilloscope.
|
||||||
|
|
||||||
|
4. Communication Protocol
|
||||||
|
|
||||||
|
- LS [Path]: List nodes.
|
||||||
|
- TREE: Full recursive JSON application map.
|
||||||
|
- PAUSE / RESUME: Execution control.
|
||||||
|
- TRACE <Signal> <1/0> [Decimation]: Telemetry control.
|
||||||
|
- FORCE <Signal> <Value>: Persistent signal override.
|
||||||
|
- UNFORCE <Signal>: Remove override.
|
||||||
|
- LOG <Level> <Msg>: Port 8082 streaming format.
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import socket
|
|
||||||
import time
|
|
||||||
import subprocess
|
|
||||||
import os
|
|
||||||
import signal
|
|
||||||
|
|
||||||
# Start server
|
|
||||||
print("Starting server...")
|
|
||||||
proc = subprocess.Popen(
|
|
||||||
["./run_debug_app.sh"],
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.PIPE,
|
|
||||||
cwd="/home/martino/Projects/marte_debug",
|
|
||||||
env=os.environ,
|
|
||||||
)
|
|
||||||
|
|
||||||
time.sleep(5) # Wait for server to start
|
|
||||||
|
|
||||||
print("Connecting to server...")
|
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
||||||
s.settimeout(3)
|
|
||||||
s.connect(("127.0.0.1", 8080))
|
|
||||||
|
|
||||||
# Send TREE
|
|
||||||
s.sendall(b"TREE\n")
|
|
||||||
print("Sent TREE")
|
|
||||||
|
|
||||||
# Send DISCOVER immediately (like GUI does)
|
|
||||||
s.sendall(b"DISCOVER\n")
|
|
||||||
print("Sent DISCOVER")
|
|
||||||
|
|
||||||
# Wait and read
|
|
||||||
time.sleep(1)
|
|
||||||
data = b""
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
chunk = s.recv(4096)
|
|
||||||
if not chunk:
|
|
||||||
break
|
|
||||||
data += chunk
|
|
||||||
except:
|
|
||||||
break
|
|
||||||
|
|
||||||
print(f"Got {len(data)} bytes")
|
|
||||||
print("Contains OK TREE:", b"OK TREE" in data)
|
|
||||||
print("Contains OK DISCOVER:", b"OK DISCOVER" in data)
|
|
||||||
|
|
||||||
s.close()
|
|
||||||
proc.terminate()
|
|
||||||
proc.wait()
|
|
||||||
print("Done")
|
|
||||||
Reference in New Issue
Block a user