r/AerospaceEngineering • • 3d ago

Personal Projects Built an open-source DO-178C structural coverage and object-code browser in Rust — looking for feedback on audit & review workflows

I've been building an open-source tool called Butterfly for verifying safety-critical software the kind of work you do under DO-178C, ISO 26262, or IEC 62304 where you need to show an auditor exactly which instructions ran, which MC/DC conditions were covered, and what changed since the last review. It reads compiler output (llvm-cov, gcov, DWARF, .su files, object code) and produces a single JSON evidence file that you can browse in an interactive viewer or export as a standalone SVR report.

What it does: Coverage down to the instruction: source lines mapped to disassembled object code with projected coverage overlay MC/DC: executed test vectors and independence pairs per decision (from Clang's -fcoverage-mcdc) Stack analysis: worst-case call chains from .su files, with dynamic frame detection (alloca/VLA) Data coupling: which functions read and write each global Change impact: git history per function — what commits touched it and what re-verification they oblige Per-test attribution: which test entered which function and line Requirements traceability: requirement text beside the code, with a claims gate that checks your project's own traceability rules Dead-code candidates in the linked image Gap resolutions: a reviewer records why a gap is acceptable, stored in a sidecar file, never mutating the underlying evidence What it supports: Languages & constructs: C, C++, Rust (19 C constructs, 15 C++, 15 Rust — including templates, generics, static inlines across TUs, jump tables, recursion, and function-pointer dispatch) Toolchains: Clang/llvm-cov, GCC/gcov, rustc nightly condition coverage Targets & build systems: AArch64 and x86-64 (Mach-O and ELF); CMake, Make, Bazel Verification: 91 items in the support matrix, each backed by a worked example that CI builds and a test that reads it (~38k lines of Rust across 5 crates, 1,500+ tests, MIT / Apache-2.0) RISC-V, PE/COFF, and stable Rust MC/DC are on the roadmap, alongside some avionics runtime work I'm not ready to share yet. For those of you dealing with DER/auditor reviews on flight software:

  1. How are you currently handling source-to-object code coverage traceability for Level A, and does storing reviewer gap justifications in a separate sidecar file fit how your QA team packages evidence?
  2. Which legacy embedded compilers or target formats (e.g., Green Hills, Wind River/Diab, Tasking, or specific RTOS ELF variants) would be most critical to support next? If you work on safety-critical systems and have opinions on what modern verification tooling should look like, I'd genuinely like to hear them.
17 Upvotes

3 comments sorted by

2

u/tonyarkles 3d ago

I don’t strictly need to meet any of the DO/ISO/IEC standards you listed, but I’m super curious. I’ve used https://github.com/hbehrens/puncover to get some of the info I’ve been looking for but it has a few limitations that I’m thinking your tool might cover. One of the big ones was callbacks via function pointers (set once at boot, never changed). Puncover can’t see those and underestimates stack depth.

Edit: GCC on Zephyr if that helps you

3

u/Honey_Badger_94 3d ago

Butterfly does see those. Every indirect call (function pointer, vtable, callback) is classified at the object-code level and shows up in the stack and call-graph views. Where Puncover silently misses them, Butterfly flags the chain as unbounded,1 indirect call(s): callee set unknown" so you'll never get a silent underestimate.

For pointers held in static data (your "set once at boot" case), it goes further: it reads the table entries from the linked ELF image relocations included and lists the candidate targets in the call graph, drawn as dashed edges labelled "hypothesis". So you can see exactly which functions the table holds. The stack view still reports unbounded through the indirect call though, because resolving the candidates into a bounded total is a reviewer judgement the tool won't make for you. That said, "trust the static candidates" mode is good feedback and I'll follow it.

You can see it in the repo right now:

On GCC/Zephyr: GCC (gcov, .su files), ARM32/Thumb instruction classification, and ELF relocation reading are implemented. The ARM32 path doesn't have a worked example in the repo yet (AArch64 and x86-64 are the tested ones today), so I'd want to try it on a real Zephyr image before promising it works end to end. If you're up for it, I'd welcome the feedback.

1

u/tonyarkles 3d ago

Dope! Let’s see if I get a minute to breathe tomorrow to try it out :D