When a real-time loop misses a deadline on QNX Neutrino 8.0, the evidence is usually split across four files: a binary tracelogger .kev trace, an mkifs .build file, a pidin thread dump, and slog2info logs.

This hands-on codelab walks through diagnosing three QNX 8.0 failures using NeutrinoLens, a zero-dependency ES module suite that runs in the browser, CLI, and stdio MCP server.

You can follow every step in the terminal (Node.js 20+, zero npm install) or open the live browser studio on GitHub Pages.

Setup

Clone the repository and run the automated test suite:

git clone https://github.com/khanglvm/neutrinolens.git cd neutrinolens node --test test/*.test.mjs 

All 36 tests pass in under 300 ms, verifying the binary .kev codec, 32-bit ClockCycles() rollover reconstruction, priority-inversion detector, 16-rule mkifs auditor, and pidin/slog2 deadlock correlator.

Step 1: Catch an IPC priority inversion in a binary .kev file

QNX Neutrino boosts a server thread's priority to match the calling client during MsgSend() unless the channel was created with _NTO_CHF_FIXED_PRIORITY. Mutexes likewise default to PTHREAD_PRIO_INHERIT unless downgraded to PTHREAD_PRIO_NONE.

Run the trace analyzer on the bundled automotive braking ECU capture (9,369 kernel events over 249.9 ms on 4 CPUs):

node cli/neutrinolens.mjs trace fixtures/ecu-braking-inversion/trace.kev 

The top NL-T001 finding isolates the exact inversion window:

  • High-priority waiter: brake_ctrl/2 brake_loop (priority 50) blocked in SEND/REPLY on canbus-mgr/1.
  • Low-priority holder: canbus-mgr/1 stayed at priority 10 instead of inheriting 50.
  • Medium-priority preemptor: diag_logger/1 preempted canbus-mgr/1, stalling brake_loop for 4198.84 us and blowing its 1500 us control-loop budget (NL-T005).

Fix the QNX channel creation in C:

/* Before: disables QNX IPC priority inheritance */ int chid = ChannelCreate(_NTO_CHF_FIXED_PRIORITY); /* After: server inherits the highest waiting client priority */ int chid = ChannelCreate(0); 

For mutexes (PTHREAD_PRIO_NONE), restore PTHREAD_PRIO_INHERIT:

pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); pthread_mutex_init(&state_lock, &attr); 

Step 2: Audit QNX 7.1 to 8.0 mkifs migrations

QNX SDP 8.0 replaces io-pkt (devnp-*, lsm-*, npm-*) with io-sock (devs-*, mods-*), requires procnto-smp-instr for kernel tracing, and benefits from bounding tracelogger -S so /dev/shmem does not exhaust memory.

Audit the broken ECU buildfile:

node cli/neutrinolens.mjs audit fixtures/ecu-braking-inversion/image.build 

Then compare against the clean QNX 8.0 Raspberry Pi 4 reference buildfile:

node cli/neutrinolens.mjs audit qnx-probe/qnx8-rpi4-nlens.build 

The clean reference returns zero errors and zero warnings. You can also edit .build text live in the NeutrinoLens Web Studio under the QNX 8.0 Buildfile Auditor tab and watch rules clear as you type.

Step 3: Correlate pidin deadlocks with slog2info bursts

When a target stalls without tracelogger running, pidin and slog2info are often the only snapshots captured. Run the correlator on the medical infusion pump bundle:

node cli/neutrinolens.mjs snapshot \ fixtures/infusion-pump-isr/pidin.txt \ fixtures/infusion-pump-isr/slog2.txt 

NeutrinoLens builds a directed thread/process wait-for graph from pidin states and flags the circular REPLY/MUTEX deadlock between pump_ctrl/4, alarm_mgr/1, and pump_ctrl/5, paired with the slog2 dose-loop overrun burst.

Step 4: Cross-artifact diagnosis and clock alignment

Run doctor across all four files at once:

node cli/neutrinolens.mjs doctor fixtures/ecu-braking-inversion 

doctor aligns slog2 wall-clock timestamps to monotonic .kev ClockCycles() using NLENS_SYNC user events emitted by qnx-probe/nlens_probe.c (0.002 ms spread on the ECU fixture), and catches mismatches such as pairing a .kev trace with a buildfile that boots non-instrumented procnto-smp.

Step 5: Capture on a real QNX 8.0 target

With QNX SDP 8.0 sourced (source ~/qnx800/qnxsdp-env.sh):

cd qnx-probe make ARCH=aarch64le 

Copy nlens_probe and nlens-capture.sh to your QNX 8.0 QEMU or Raspberry Pi 4 target, run ./nlens-capture.sh, and drop the resulting .kev, .build, pidin.txt, and slog2.txt files directly into the browser studio or CLI.

Full source code, fixtures, MCP server (mcp/server.mjs), and the complete printable codelab live at github.com/khanglvm/neutrinolens.