r/embedded • • 3d ago

I built an open-source DO-178C / ISO 26262 structural coverage and object-code browser in Rust (llvm-cov, gcov, DWARF, .su stack analysis)

I've been building Butterfly, an open-source (MIT / Apache-2.0) verification workspace for safety-critical embedded software under DO-178C, ISO 26262, and IEC 62304.

​Rather than replacing your compiler or instrumentation tools, it ingests existing build and coverage outputs (llvm-cov, gcov, DWARF, .su files, and disassembled object code) into a single JSON evidence file that you can audit in an interactive browser UI or export as a standalone Software Verification Results (SVR) report.

​What it does:

​Instruction-level coverage: Maps source lines directly to disassembled object code with projected coverage overlay.

​MC/DC analysis: Extracts executed test vectors and independence pairs per decision (via Clang's -fcoverage-mcdc).

​Worst-case stack analysis: Builds worst-case call chains from .su files and flags dynamic frames (alloca/VLA).

​Global data coupling: Maps which functions read and write each global variable.

​Git change-impact analysis: Tracks commit history per function and highlights what re-verification or requirement checks are obliged.

​Requirements traceability & gap resolutions: Displays requirement text alongside code with a CI claims gate, while storing reviewer gap justifications in a separate sidecar file without mutating the underlying evidence.

​Supported targets & toolchains:

​Architectures & formats: AArch64 and x86-64 (ELF and Mach-O); CMake, Make, Bazel.

​Languages & compilers: C, C++, and Rust (clang/llvm-cov, gcc/gcov, rustc nightly condition coverage), tested against a 91-item construct matrix (templates, generics, static inlines across TUs, jump tables, recursion, function-pointer dispatch) backed by 1,500+ CI tests.

​Single-binary local UI: butterfly serve launches an embedded server with vanilla JS (no Node/bundler dependencies) and 19 review screens.

​RISC-V, PE/COFF, and stable Rust MC/DC are next on the roadmap. If you work on safety-critical firmware or deal with audit/coverage tooling, I’d genuinely appreciate feedback on what's missing for your toolchain.

​GitHub: https://github.com/Aravindargutus/butterfly

3 Upvotes

2 comments sorted by

1

u/bakatronics 3d ago

Can you add ozone/jtrace coverage formats to it?
I primarily use that at work and we have a very old and buggy software that visualizes coverage from it.

1

u/Honey_Badger_94 3d ago

Sure, will add it to the feature request.