Skip to main navigation Skip to search Skip to main content

Integration standardisierter Code-Coverage-Mechanismen in einen LLVM-basierten IEC-61131-3-Compiler

  • Daniel Gierlinger

    Student thesis: Master's Thesis

    Abstract

    Code coverage metrics support the assessment of software tests by showing which source
    code 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 Award2026
    Original languageGerman (Austria)
    Awarding Institution
    • FH OÖ
    SupervisorFranz Leopold Wiesinger (Supervisor)

    Studyprogram

    • Embedded Systems Design

    Cite this

    '