Fixed issues with config and tracing

This commit is contained in:
Martino Ferrari
2026-04-08 23:44:01 +02:00
parent 7adbecdb6e
commit b86ede99b9
5 changed files with 174 additions and 49 deletions
@@ -26,6 +26,30 @@
namespace MARTe {
// Recursive search for any object with a given name anywhere in the registry.
// Used to find GAMs regardless of nesting level.
static Reference FindByNameRecursive(ReferenceContainer *container,
const char8 *name) {
if (container == NULL_PTR(ReferenceContainer *))
return Reference();
uint32 n = container->Size();
for (uint32 i = 0; i < n; i++) {
Reference child = container->Get(i);
if (!child.IsValid())
continue;
if (StringHelper::Compare(child->GetName(), name) == 0)
return child;
ReferenceContainer *sub =
dynamic_cast<ReferenceContainer *>(child.operator->());
if (sub != NULL_PTR(ReferenceContainer *)) {
Reference found = FindByNameRecursive(sub, name);
if (found.IsValid())
return found;
}
}
return Reference();
}
/**
* @brief Helper for optimized signal processing within brokers.
*/
@@ -126,21 +150,14 @@ public:
(direction == InputSignals) ? "InputSignals" : "OutputSignals";
const char8 *dirStrShort = (direction == InputSignals) ? "In" : "Out";
// Try to find the GAM with different path variations
// Search recursively through the entire registry for the GAM by name.
// Direct Find("GAM1") only checks top-level; the GAM may be nested
// several levels deep inside a RealTimeApplication container.
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());
}
FindByNameRecursive(ObjectRegistryDatabase::Instance(),
functionName);
fprintf(stderr, ">> GAM lookup '%s': %s\n", functionName,
gamRef.IsValid() ? "FOUND" : "NOT FOUND");
if (gamRef.IsValid()) {
StreamString absGamPath;