AGENTS.md — how to modify this module
Invariants, conventions and change recipes for contributors — and for AI coding assistants, which load this file automatically when editing the module. Largely derived from the source and verified against it.
Mirrored from subprojects/xcfa/xcfa-cli/AGENTS.md — edit it there, not here.
xcfa/xcfa-cli — notes for editing this module
Gradle module: :theta-xcfa-cli, main class hu.bme.mit.theta.xcfa.cli.XcfaCli. This is the user-facing verifier: option parsing, the frontend and its fallbacks, checker construction, portfolios, witnesses, and the SV-COMP and CHC-COMP distributions (the archivePackaging variants in build.gradle.kts). Usage and the config object model: README.md.
Build and test
./gradlew :theta-xcfa-cli:testruns the unit and end-to-end tests. A test that needs an SMT-LIB solver skips itself when the solver cannot be installed, and the rootverifySolverInstallationstask then fails the build.- The canary gate is kept out of
test.:theta-xcfa-cli:fixtureTestruns the feature-guard fixtures,-Ptheta.fixture.jobsat once (default 4), in about ten minutes.:theta-xcfa-cli:canaryTestruns the sv-benchmarks sample incanaries.tsvand depends onfixtureTest. Both buildbuildArchiveTheta-svcompfirst and need an sv-benchmarks checkout:../sv-benchmarksbeside the repository, or-Ptheta.canary.svBenchmarks=<dir>. Modes, and how to add a fixture: canaries/README.md. - One fixture per issue. A potential bug is guarded once: by one program that must hold (
SAFE/PARSE-OK) and at most one that must fail (UNSAFE/FRONTEND-FAIL). Before adding a fixture, searchfixtures.tsvfor the mechanism. If one exists, extend it or leave it, rather than adding another syntax for the same thing (p++/++p/p += 1,break/continue/goto,mallocthrough a wrapper or directly). Only a different memory model (multi,flat,bytes) is a different issue. A row with no--memory-modelrepeats themultirow unless the program falls back. - Each fixture finishes within 60 s (the suite's timeout). A program that needs longer is too large to be a fixture; shrink it or drop it.
- The suites re-extract
build/distributions/Theta-svcomp.zipintoTheta-svcomp/when that directory is missing or older than the zip.
Layout
Paths are relative to src/main/java/hu/bme/mit/theta/xcfa/cli/.
XcfaCli.ktcallsrunConfiginExecuteConfig.kt, which validates the input, runsfrontendandbackend, maps the result and writes the witness.params/:XcfaConfig.kt(the config tree, with oneSpecBackendConfigper backend),ParamValues.kt(theBackend,Domain,Refinement,POR, ... enums, which carry their factories),ExitCodes.kt.checkers/:ConfigToChecker.ktdispatches onBackendto aConfigTo<X>Checker.kt.ConfigToPortfolio.ktmaps--portfolionames toportfolio/(STABLEiscomplex27; SV-LIB inputs getcomplex27svlib, which drops BMC and k-induction).utils/XcfaParser.kt(one parser per input type),witnesstransformation/(trace concretization, witness application),utils/*WitnessWriter.kt.
Invariants / gotchas
- The frontend fallbacks rebuild in-process. They apply only when no
--memory-modelwas given.UnsupportedPointerSplitExceptionrebuilds underflatandRequiresByteAddressedMemoryExceptionunderbytes. An arithmetic the frontend chose itself is retried as bitvector. A fallback pins its model in the config, because the portfolio re-runs the frontend from that config. Thebytesmodel requires bitvector arithmetic; if it cannot represent the input, restore the requested arithmetic before falling back toflat. - New backend: add it to
Backend. The exhaustivewhens inBackendConfig.createSpecConfigandgetSafetyCheckerthen need a spec config and aConfigTo<X>Checkerfor it. - Invalid domain/refinement combinations are rejected while the checker is built:
UNSAT_COREneeds aDomainwith avarsPrecRefiner(currently only EXPL). ConfigToAsgCegarCheckerpassestraceEnricher = ::threadWriteTriplesso that lassos see pointer writes. Any new consumer of paths needs the same enrichment (xcfa-analysis AGENTS.md).- Frontend failures normally log and exit. Re-throw only the specific typed limitations that the caller can recover from; do not turn unrelated frontend failures into fallback attempts.
- An Unsafe result that depends on an over-approximated value becomes Unknown (
utils/OverApproximationGuard.kt, called in the result mapping ofExecuteConfig.kt). The check slices the counterexample backward from its assumptions overXCFA.overApproximatedVars; a data race also from the guards and addresses of the edges enabled in its last state. The trace names per-process instances of the variables, so it maps them through the states'varLookupand compares names, with an OC trace's per-thread copyT<pid>::_::xstanding forx. It runs only where the real checker ran (not forPORTFOLIOor an in-process parent), because the parent sees only the child's printed result. Without an XCFA trace, any recorded havoc left in the model counts. In a portfolio step it exits withUNRELIABLE_UNSAFEinstead, so that the portfolio tries its next config;ConfigToPortfolioreports Unknown if none gives a reliable verdict. utils/CInvariantExport.ktexports loop invariants only over names declared once at file scope and in the function (FunctionVisitor.variablesInScope). This is a workaround, not a C rule: Goblint binds a re-declared name to another declaration, so it confirms false invariants and refutes true ones (goblint#747). The cost is that validators which resolve these names correctly get no invariant for those loops. Remove the restriction when Goblint resolves such names correctly.