@@ -646,7 +646,13 @@ bool SkeletonMemoryManager::CreateSharedMemoryForData(
646646 }
647647
648648 const auto path = shm_path_builder_.GetDataChannelShmName (lola_instance_id_);
649+ #ifdef REQUIRE_TYPED_MEMORY
650+ // We only use "typed memory", if REQUIRE_TYPED_MEMORY (set by the GTL) and IPC tracing is enabled/configured, which
651+ // we can deduce from register_shm_object_trace_callback being set.
649652 const bool use_typed_memory = register_shm_object_trace_callback.has_value ();
653+ #else
654+ constexpr bool use_typed_memory = false ;
655+ #endif
650656 const memory::shared::SharedMemoryFactory::UserPermissions user_permissions =
651657 ((permissions.empty ()) && (!lola_service_instance_deployment.strict_permissions_ ))
652658 ? memory::shared::SharedMemoryFactory::WorldReadable{}
@@ -664,17 +670,17 @@ bool SkeletonMemoryManager::CreateSharedMemoryForData(
664670 return false ;
665671 }
666672 data_storage_path_ = path;
667- if (register_shm_object_trace_callback.has_value () && memory_resource->IsShmInTypedMemory ())
673+ const auto is_tracing_enabled_for_shm_object = register_shm_object_trace_callback.has_value ();
674+ const auto is_typed_memory_required_and_successful_allocated =
675+ use_typed_memory && memory_resource->IsShmInTypedMemory ();
676+ if (is_tracing_enabled_for_shm_object && (is_typed_memory_required_and_successful_allocated || !use_typed_memory))
668677 {
669- // only if the memory_resource could be successfully allocated in typed-memory, we call back the
670- // register_shm_object_trace_callback, because only then the shm-object can be accessed by tracing
671- // subsystem.
672678 // Since LoLa creates shm-objects on the granularity of whole service-instances (including ALL its service
673679 // elements), we call register_shm_object_trace_callback once and hand over a dummy element name/type!
674680 // Other bindings, which might create shm-objects per service-element would call
675681 // register_shm_object_trace_callback for each service-element and then use their "real" name and type ...
676- // Suppress "AUTOSAR C++14 A15-4-2" rule finding. This rule states: "I a function is declared to be
677- // , (true) or (<true condition>), then it shall not exit with an exception"
682+ // Suppress "AUTOSAR C++14 A15-4-2" rule finding. This rule states: "If a function is declared to be
683+ // noexcept, noexcept (true) or noexcept (<true condition>), then it shall not exit with an exception"
678684 // we can't add to score::cpp::callback signature.
679685 // coverity[autosar_cpp14_a15_4_2_violation]
680686 register_shm_object_trace_callback.value ()(
0 commit comments