GOTO-HARNESS(1)
π NAME π
goto-harness β the girlies who generate environments for symbolic analysis β¨ (yes it's literally in the manual name, goto-harness(1) if you wanna be formal about it)
π SYNOPSIS π
goto-harness [-?] [-h] [--help]
show help
goto-harness --version
show version
goto-harness in out --harness-function-name name --harness-type
harness-type [harness-options]
build harness for in and write harness to out; the harness is
printed as C code, if out has a .c suffix, else a GOTO binary
including the harness is generated
okay so basically three whole moods: ask for help, ask for the version, or actually build a harness bestie π
πΈ DESCRIPTION πΈ
goto-harness constructs functions that set up an appropriate environment before calling functions under analysis. It is most useful when you're trying to analyze an isolated unit of a program β like, you've got one little function you wanna vibe check in total isolation, no cap.
A typical sequence of tool invocations is as follows. Given a C program program.c, we generate a harness for function test_function:
# Compile the program
goto-cc program.c -o program.gb
# Run goto-harness to produce harness file
goto-harness --harness-type call-function --harness-function-name generated_harness_test_function
--function test_function program.gb harness.c
# Run the checks targeting the generated harness
cbmc --pointer-check harness.c --function generated_harness_test_function
goto-harness has two main modes of operation. First, function-call harnesses, which automatically synthesize an environment without having any information about the program state. Second, memory-snapshot harnesses, in which case goto-harness loads an existing program state as generated by memory-analyzer(1) and selectively havocs some variables. It's giving "two paths, one destiny" fr fr π¦
β¨ OPTIONS β¨
--harness-function-name nameβ Usenameas the name of the harness function that is generated, i.e., the new entry point. this is the name it answers to, the main character energy π--harness-type [call-function|initialize-with-memory-snapshot]β Select the type of harness to generate. In addition to options applicable to both harness generators, each of them also has dedicated options that are described below. pick your fighter π₯
π§ Common generator options π§
--min-null-tree-depth Nβ Set the minimum level at which a pointer can first beNULLin a recursively non-deterministically initialized struct toN. Defaults to1.--max-nondet-tree-depth Nβ Set the maximum height of the non-deterministic object tree toN. At that level, all pointers will be set toNULL. Defaults to2.--min-array-size Nβ Set the minimum size of arrays of non-constant size allocated by the harness toN. Defaults to1.--max-array-size Nβ Set the maximum size of arrays of non-constant size allocated by the harness toN. Defaults to2.--nondet-globalsβ Set global variables to non-deterministic values in harness. chaos mode for the globals π²--havoc-member member-exprβ Non-deterministically initializemember-exprof some global object (may be given multiple times). yes bestie you can spam this one, it's allowed--function-pointer-can-be-null function-nameβ Name of parameters of the target function or of global variables of function-pointer type that can non-deterministically be set toNULL.
π Function harness generator (--harness-type call-function): π
--function function-nameβ Generate an environment to call functionfunction-name, which the harness will then call. the harness does the calling so you don't have to π--treat-pointer-as-array pβ Treat the (pointer-typed) function parameter with namepas an array.--associated-array-size array_name:size_nameβ Set the function parametersize_nameto the size of the array parameterarray_name(implies--treat-pointer-as-array array_name).--treat-pointers-equal p,q,r[;s,t]β Assume the pointer-typed function parametersqandrare equal to parameterp, andsequal tot, and so on. they're the same picture, your honor π--treat-pointers-equal-maybeβ Function parameter equality is non-deterministic.--treat-pointer-as-cstring pβ Treat the function parameter with the namepas a string of characters.
π Memory snapshot harness generator (--harness-type initialise-from-memory-snapshot): π
--memory-snapshot fileβ Initialize memory from JSON memory snapshot stored infile.--initial-goto-location func[:n]β Use functionfuncand GOTO binary location numbernas entry point.--initial-source-location file:nβ Use given file namefileand line numbernin that file as entry point.--havoc-variables varsβ Non-deterministically initialize all symbols namedvars.--pointer-as-array pβ Treat the global pointer with namepas an array.--size-of-array array_name:size_nameβ Set the variablesize_nameto the size of the array variablearray_name(implies--pointer-as-array array_name).
π± ENVIRONMENT π±
All tools honor the TMPDIR environment variable when generating temporary files and directories. she respects the TMPDIR, as she should π«Ά
π BUGS π
If you encounter a problem please create an issue at https://github.com/diffblue/cbmc/issues β don't suffer in silence bestie, tell the maintainers π
π SEE ALSO π
cbmc(1), goto-cc(1), memory-analyzer(1) β the whole friend group, go say hi π
π¦ COPYRIGHT π¦
2019, Diffblue
and that's a wrap, bestie π this lil page is goto-harness-5.59.0 from June 2022, and it ate, no crumbs, periodt β¨π
π¦ where this page comes from
- debian trixie: cbmc 6.6.0-4 Β· BSD-4-Clause
- fedora 43: cbmc 6.7.1-2.fc43 Β· BSD-4-Clause
- fedora 44: cbmc 6.8.0-1.fc44 Β· BSD-4-Clause
- nixos 26.05: cbmc 6.9.0
- nixpkgs unstable: cbmc 6.11.0
- ubuntu noble: cbmc 5.95.1-4ubuntu1 Β· BSD-4-Clause
- ubuntu questing: cbmc 6.6.0-4
- ubuntu resolute: cbmc 6.6.0-4ubuntu2 Β· BSD-4-Clause
- ubuntu stonking: cbmc 6.6.0-4ubuntu2 Β· BSD-4-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms