E-ACSL-GCC.SH(1)

πŸ“¦
version 20220511-manganese Β· 2 versions
, in debian bookworm, ubuntu noble

E-ACSL-GCC.SH πŸ’… the group-chat guide to instrumenting + compiling C with E-ACSL

ok bestie, welcome to the General Commands Manual page for e-acsl-gcc.sh β€” yes it's a real manual, from the General Commands Manual section, and yes I'm about to make it make sense for you. sit down, grab a snack πŸ“, we're doing this.


✨ NAME ✨

e-acsl-gcc.sh β€” instrument and compile C files with E-ACSL πŸ¦‹


✨ SYNOPSIS ✨

e-acsl-gcc.sh [ options ] files

✨ DESCRIPTION ✨

so like, e-acsl-gcc.sh is a convenience wrapper β€” it's giving "I'll handle the boring parts for you, queen". It does two things for your C programs:

  1. it instruments them using the E-ACSL Frama-C plugin πŸ’–
  2. and then it compiles the result using the GNU compiler collection (GCC) πŸ‘‘

basically it's the middlewoman between Frama-C and GCC and she is booked and thriving. no cap.


✨ OPTIONS ✨

okay this is the long part but every single one matters, do not skip, I will know πŸ™ˆ

  • -h, --help β€” show a help page. literally just help. slay.
  • -c, --compile β€” compile the generated sources and the original (supplied) sources. By default no compilation is performed β€” so if you don't pass this, nothing gets compiled, periodt.
  • -D, --rt-debug β€” enable runtime debug features, i.e. compile an unoptimized executable with assertions and extra checks. it's giving "I want to see everything" energy πŸ”
  • --no-trace β€” disable stack trace reporting in debug mode. bye traces πŸ‘‹
  • -V, --rt-verbose β€” output extra messages when executing generated code. yapper mode: on πŸ—£οΈ
  • -X, --instrumented-only β€” do not compile original code. ⚠️ Has effect only in the presence of the -c flag. so like, it does nothing on its own, bestie, it needs -c to have a purpose.
  • -C, --compile-only β€” compile the input files as if they were generated by E-ACSL. no instrumentation, just vibes and compiling.
  • -d, --debug=<N> β€” pass a value to the Frama-C -debug option. By default the -debug flag is unused.
  • -v, --verbose=<N> β€” pass a value to the Frama-C -verbose option. By default the -verbose flag is unused.
  • --check β€” check integrity of the generated AST (mostly useful for developers). devs only, iykyk πŸ§‘β€πŸ’»
  • -o, --ocode=<FILE> β€” output the E-ACSL instrumented code to <FILE>. Defaults to a.out.frama.c.
  • -O, --oexec=<FILE> β€” output the code compiled from the uninstrumented sources to <FILE>. The executable compiled from the files generated by E-ACSL is appended the .e.acsl suffix. Unless specified, the names of the executables generated from the original and the modified programs are a.out and a.out.e-acsl respectively.
  • --oexec-e-acsl=<FILE> β€” name of the executable file generated from the E-ACSL-instrumented file. Unless specified, the executable is named as indicated by the --oexec option.
  • -f, --frama-c-only β€” run input source files through Frama-C without E-ACSL instrumentations. Frama-C only, no E-ACSL, no notes βœ‹
  • -E, --extra-cpp-args=<FLAGS> β€” pass additional arguments to the Frama-C pre-processor.
  • -L, --frama-c-stdlib β€” use the Frama-C standard library instead of a system-wide one.
  • -M, --full-mtracking β€” maximize memory-related instrumentation. maximum memory tracking, no crumbs left 🧹
  • --concurrency β€” enable concurrency support. threads said hi πŸ‘‹
  • --temporal β€” enable checking for temporal memory errors in \valid and \valid_read predicates.
  • --weak-validity β€” enable notion of weak validity. so here's the tea: By default expression (p+i), where p is a pointer and i is an integer offset, is deemed valid if both addresses p and (p+i) belong to the same allocated block. With weak validity (p+i) is valid if the memory location which address is given by expression (p+i) is allocated. different rules, different game πŸ’…
  • --validate-format-strings β€” enable built-in detection of format-string vulnerabilities. safety first bestie πŸ›‘οΈ
  • --libc-replacements β€” replace some of the unsafe LIBC functions (e.g., strcpy, memcpy) with RTL alternatives that include internal runtime error checking. out with the unsafe, in with the checked ✨
  • -g, --gmp β€” always use GMP integers instead of C integral types. By default the GMP integers are used on as-needed basis.
  • --mbits=<BITS> β€” architecture to compile to. Valid arguments are 16, 32 or 64. Default to the architecture of the current environment. This option is used to select the machdep when calling Frama-C, and to pass the corresponding -m16, -m32 or -m64 flag to the compiler.
  • -l, --ld-flags=<FLAGS> β€” pass the specified flags to the linker. πŸ”—
  • -e, --cpp-flags=<FLAGS> β€” pass the specified flags to the pre-processor at compile-time. For instrumentation-time pre-processor flags see the --extra-cpp-args option. (yes those are two different things, don't mix them up πŸ™ˆ)
  • -q, --quiet β€” suppress any output except for errors and warnings. shhh 🀫
  • -s, --logfile=<FILE> β€” redirect all output to a given file. everything goes in the file, journaling era πŸ““
  • -F, --frama-c-extra=<FLAGS> β€” pass an extra option to a Frama-C invocation.
  • -a, --rte=<OPTSTRING> β€” annotate a source program with assertions using a run of an RTE plugin prior to E-ACSL. OPTSTRING is a comma-separated string that specifies the types of generated assertions. Valid arguments are:
    • signed-overflow β€” signed integer overflows.
    • unsigned-overflow β€” unsigned integer overflows.
    • signed-downcast β€” signed downcast exceeding destination range.
    • unsigned-downcast β€” unsigned downcast exceeding destination range.
    • mem β€” pointer or array accesses.
    • float-to-int β€” casts from floating-point to integer.
    • div β€” division by zero.
    • shift β€” left and right shifts by a value out of bounds.
    • pointer-call β€” annotate functions calls through pointers.
    • all β€” all of the above. (the "give me everything" option, iconic πŸ‘‘)
  • -A, --rte-select=<OPTSTRING> β€” restrict annotations to a given list of functions. OPTSTRING is a comma-separated string comprising function names.
  • --zone-sizes=<NAME1:SIZE1,...,NAMEN:SIZEN> β€” set the size (in MB) of the given zones. Valid zone names are:
    • stack β€” stack shadow space
    • heap β€” heap shadow space
    • tls β€” TLS shadow space
    • thread-stack β€” thread stack shadow space
  • -k, --keep-going β€” continue execution after an assertion failure. we do not stop, we keep going πŸ’ͺ
  • --free-valid-address β€” trigger failure if a NULL-pointer is used as an input to free function.
  • --fail-with-code=<NUMBER> β€” on assertion failure exit with the given integer code instead of raising an abort signal.
  • --assert-print-data β€” print data contributing to the failed assertion along with the runtime error message. receipts, printed πŸ“„
  • --no-assert-print-data β€” do not print data contributing to the failed assertion along with the runtime error message.
  • --external-assert=<FILE> β€” the filename that contains your own implementation of __e_acsl_assert. DIY era πŸ”¨
  • --external-print-value=<FILE> β€” the filename that contains your own implementation of __e_acsl_print_value.
  • -m, --memory-model=<model> β€” memory model (i.e., a runtime library for checking memory related annotations) to be linked against the instrumented file. Valid arguments are:
    • bittree β€” memory modelling using a Patricia trie.
    • segment β€” shadow based segment model.

By default the Patricia trie memory model is used.

  • --print-mmodels β€” print the names of the supported memory models.
  • -I, --frama-c=<FILE> β€” the name of the Frama-C executable. By default the first frama-c executable found in the system path is used.
  • --e-acsl-share=<DIR> β€” the name of the E-ACSL share directory. If not provided, it is computed from your setting.
  • -G, --gcc=<FILE> β€” the name of the GCC executable. By default the first gcc executable found in the system path is used.
  • --then β€” separate with a -then the first Frama-C options from the actual launch of the E-ACSL plugin.
  • --e-acsl-extra=<OPTS> β€” add <OPTS> to the list of options that will be given to the E-ACSL analysis. Only useful when --then is in use, in which case <OPTS> will be placed after the -then on Frama-C's command-line. Otherwise, equivalent to --frama-c-extra.
  • --ar=<FILE> β€” the name of the AR executable. Only relevant with --dlmalloc-from-sources. By default the first ar executable found in the system path is used.
  • --ranlib=<FILE> β€” the name of the RANLIB executable. Only relevant with --dlmalloc-from-sources. By default the first ranlib executable found in the system path is used.
  • --with-dlmalloc=<FILE> β€” use <FILE> instead of distributed dlmalloc library.
  • --dlmalloc-from-sources β€” compile and use dlmalloc library from sources instead of using the distributed library. ⚠️ Incompatible with --with-dlmalloc.
  • --dlmalloc-compile-only β€” do not instrument or compile code, only compile dlmalloc library from sources. Implies --dlmalloc-from-sources and incompatible with --with-dlmalloc. dlmalloc only, nothing else, focus mode 🎯
  • --dlmalloc-compile-flags=<FLAGS> β€” compile dlmalloc library with <FLAGS> compile flags. Default to -O2 -g3. Unused if --dlmalloc-from-sources or --dlmalloc-compile-only isn't used.
  • --odlmalloc=<FILE> β€” output compiled dlmalloc library to <FILE>. Unused if --dlmalloc-from-sources or --dlmalloc-compile-only isn't used.

✨ EXIT STATUS ✨

  • 0 β€” successful execution. we ate and left no crumbs πŸ’…
  • 1 β€” invalid user input. bestie... the input was not it 😭
  • Frama-C or GCC error code β€” instrumentation- or compile-time error. not us, that's them, fr fr πŸ’€

✨ EXAMPLES ✨

1. the simplest one πŸ¦‹

e-acsl-gcc.sh foo.c

instrument foo.c and output the instrumented code to a.out.frama.c.

2. the "I want custom names" one ✨

e-acsl-gcc.sh -c -ogen_foo.c -Ofoo foo.c

instrument foo.c, output the instrumented code to gen_foo.c and compile foo.c into foo and gen_foo.c into foo.e-acsl. look at all those beautiful names 😌

3. the "already instrumented, just compile it" one πŸ‘‘

e-acsl-gcc.sh --memory-model=bittree -C gen_foo.c

assume gen_foo.c has been instrumented by E-ACSL and compile it into a.out.e-acsl using the bittree memory model.


✨ SEE ALSO ✨

gcc(1), cpp(1), ld(1), frama-c(1) β€” go read their manual pages too, they're the supporting cast and honestly they deserve their flowers 🌸


and that's the whole page, bestie!! πŸ’œ this was E-ACSL-GCC.SH(1) from the General Commands Manual, dated 2016-02-02 β€” so like, it's been around, it's vintage, it's classic. mwah. now go instrument something and slay πŸŽ€πŸ’–πŸ«Ά

πŸ“¦ where this page comes from