interface added and web ui created

This commit is contained in:
Martino Ferrari
2026-05-07 10:49:24 +02:00
parent 340b024ae4
commit 774808a054
21 changed files with 4986 additions and 362 deletions
+87 -25
View File
@@ -1,48 +1,110 @@
# MARTe2 Debug Suite
An interactive observability and debugging suite for the MARTe2 real-time framework.
An interactive observability and debugging suite for the MARTe2 real-time framework. Instruments any running application **without modifying its source code**, providing real-time signal tracing, forced-value injection, breakpoints, execution stepping, and log forwarding.
---
## Quick Start
### 1. Build the project
### 1. Build
```bash
. ./env.sh
source env.sh
make -f Makefile.gcc
```
### 2. Run Integration Tests
```bash
./Build/x86-linux/Test/Integration/Integration/IntegrationTests.ex # Runs all tests
source env.sh
./Build/x86-linux/Test/Integration/Integration/IntegrationTests.ex
```
### 3. Launch GUI
### 3. Choose Your Client
**Option A — Web UI (no install required)**
Add `WebDebugService` to your application config and open `http://localhost:8090` in any browser:
```text
+WebDebugService = {
Class = WebDebugService
HttpPort = 8090
}
```
**Option B — Rust Native GUI**
Add `DebugService` to your application config, then launch the GUI:
```bash
cd Tools/gui_client
cargo run --release
```
## Features
- **Live Tree:** Explore the MARTe2 object database in real-time.
- **Oscilloscope:** Trace any signal at high frequency (100Hz+) with automatic scaling.
- **Signal Forcing:** Inject values directly into the real-time memory map.
- **Log Forwarding:** Integrated framework log viewer with regex filtering.
- **Execution Control:** Global pause/resume via scheduler-level hooks.
## Usage
To enable debugging in your application, add the following to your `.cfg`:
```text
+DebugService = {
Class = DebugService
Class = DebugService
ControlPort = 8080
UdpPort = 8081
}
+LoggerService = {
Class = LoggerService
+DebugConsumer = {
Class = TcpLogger
Port = 8082
}
UdpPort = 8081
LogPort = 8082
}
```
The suite automatically patches the registry to instrument your existing Brokers and Schedulers.
---
## Features
| Feature | Description |
|---|---|
| **Zero-code-change** | Registry patching replaces standard brokers at runtime — no application changes needed |
| **Signal tracing** | Stream any signal at full RT rate over UDP (DebugService) or SSE (WebDebugService) |
| **Signal forcing** | Persistent value injection directly into the RT memory map |
| **Breakpoints** | Halt execution when a signal crosses a threshold (`> < == >= <= !=`) |
| **Execution stepping** | Step N RT cycles then pause; optionally filter by thread |
| **Live object tree** | Browse the full `ObjectRegistryDatabase` hierarchy with signal metadata |
| **Config serving** | Retrieve the complete application CDB as JSON |
| **Log forwarding** | All `REPORT_ERROR` events forwarded to the client in real time |
| **Signal monitoring** | Poll any `DataSourceI` signal at a configurable period |
| **MARTe2 messaging** | Send `Message` objects to any ORD object from the debug client |
---
## Transports at a Glance
| | `DebugService` | `WebDebugService` |
|---|---|---|
| **Client** | Rust native GUI or any TCP tool | Any web browser |
| **Commands** | Text over TCP (port 8080) | HTTP POST `/api/command` |
| **Telemetry** | Binary UDP (port 8081) | Server-Sent Events `/api/events` |
| **Logs** | TcpLogger TCP (port 8082) | SSE event stream |
| **Install** | Rust + Cargo | None |
Both transports implement the same `DebugServiceI` interface and register themselves as the global singleton — they are mutually exclusive (one per application).
---
## Repository Layout
```
Source/
Core/Types/
Vec/ — RT-safe dynamic array (no STL)
Result/ — Error-carrying return type
Components/Interfaces/
DebugService/
DebugCore.h — DebugSignalInfo, TraceRingBuffer, break op codes
DebugServiceI.h — Abstract interface + SignalAlias, BrokerInfo structs
DebugBrokerWrapper.h — Broker wrapper templates + registry builder helpers
DebugService.h/.cpp — TCP/UDP implementation
WebDebugService/
WebUI.h — Embedded single-page HTML/CSS/JS application
WebDebugService.h/.cpp — HTTP/SSE implementation
TCPLogger/
TcpLogger.h/.cpp — LoggerConsumerI forwarding logs to TCP clients
Test/
Integration/ — Integration test suite (180 s SIGALRM guard)
UnitTests/ — Unit test suite (COVERAGE V34)
Tools/
gui_client/ — Rust/egui native GUI (DebugService transport only)
```