Abstract
Code coverage metrics support the assessment of software tests by showing which sourcecode regions and control-flow decisions were executed during a test run. The existing
coverage solution of the considered KEBA IEC 61131-3 compiler is based on proprietary
instrumentation, mapping, and output formats. The migration of the compiler backend
to LLVM creates the opportunity to reuse standardized mechanisms for counter gener
ation and coverage evaluation.
This thesis evaluates LLVM InstrProf, Sanitizer Coverage, and post-compilation
binary instrumentation of already generated ELF shared objects. Based on this evalua
tion, a hybrid architecture is developed that combines LLVM InstrProf as a standardized
counter infrastructure with an IEC-specific coverage mapping. The implemented proto
type embeds the static mapping data in the generated shared object and exports the
runtime counter values through a controlled firmware interface into a .kcov file. The
kcov2coveragejson tool combines the runtime values with the embedded mapping and
generates an LLVM-aligned JSON file. A custom Visual Studio Code extension visual
izes executed, unexecuted, and partially covered regions as well as branch counter values
directly in the IEC source code.
The solution was evaluated using functional test cases and a production-oriented IEC
project containing 256,999 lines of source code and 66 Functional Units. In compari
son with the previous solution, the prototype requires 19.18% fewer physical coverage
counters. Enabling coverage increases the build time by 2.59% and the total size of the
shared objects by 8.19%. The runtime experiments revealed neither task overruns nor a
systematic increase in net execution-time overhead with a growing number of counters.
The results demonstrate that essential parts of the LLVM coverage infrastructure
can be reused for an IEC 61131-3 compiler. However, the Clang coverage workflow
cannot be adopted without modification, because IEC-specific source mapping, runtime
integration, and visualization require additional custom components.
| Date of Award | 2026 |
|---|---|
| Original language | German (Austria) |
| Awarding Institution |
|
| Supervisor | Franz Leopold Wiesinger (Supervisor) |
Studyprogram
- Embedded Systems Design
Cite this
- Standard