CRANGLER(1)
π CRANGLER(1) β the crangler manual, bestie edition β¨
okay so. crangler. say it with me. it's a User Commands page, it lives in section 1, and it's literally about transforming C source. let's get into it π«Ά
β¨ NAME β¨
crangler β C source transformation. that's it, that's the whole vibe π
πΈ SYNOPSIS πΈ
crangler [-?] [-h] [--help]
crangler file.json
two whole moods: ask for help, or hand it a JSON file and let it cook π
π¦ DESCRIPTION π¦
so crangler is a command-line utility, right? and what it does is it takes a preprocessed C file and makes changes to it β and those changes are prescribed in a JSON configuration file. you tell it what to do in JSON, it does the thing. no cap β¨
the supported transformations are:
- Add a contract (pre / post / assigns) to a named C function. π
- Add a loop contract to a loop identified by the name of the function containing the loop and a loop number. π
- Remove the static storage classifier from a function or a variable. bye bestie π
- Replace a function call by a call to a stub. glow-up fr fr π
and the resulting source file? it gets written to standard output, or to a file specified in the JSON configuration. your call, main character π
π₯ EXAMPLE π₯
okay this is the fun part. the following JSON configuration file makes crangler preprocess remove_static1.c. while processing this file to produce a preprocessed result, no non-standard include paths or defines are required (yes, "reqired" β we don't gatekeep typos here, the original said it, we say it π₯°).
the transformations configured here are:
- removing the static storage classifier from all functions matching the regular expression
foobar[12] - replacing calls to
barby calls to a function calledbar_stub
no objects are listed that require transformation. and the result is written to standard output. iconic. periodt.
{
"sources": [
"remove_static1.c"
],
"includes": [],
"defines": [],
"functions": [
{
"foobar[12]": [
"remove static"
],
"bar": [
"stub bar_stub"
]
}
],
"objects": [],
"output": "stdout"
}
π± ENVIRONMENT π±
TMPDIRβ all tools honor this environment variable when generating temporary files and directories. yes girl, you can move your temp files wherever you want, she'll respect it π
π BUGS π
if you encounter a problem β and bestie, sometimes you will π β please create an issue at:
https://github.com/diffblue/cbmc/issues
they will literally help you. go go go π«Ά
π COPYRIGHT π
2021, Daniel Kroening
and that's the whole page!! slay β¨
this was crangler-5.59.0, dated June 2022 β thanks for reading my little manual moment, ily, go transform some C πππ¦
π¦ 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