Prerequisites
Instrumentation for C and C++ is packaged with the C++ SDK. Instrumentation is supported by the header fileantithesis_instrumentation.h. This file must be included in one, and only one translation unit at link time. Coverage instrumentation requires Clang 13 or higher, and either C++ 11 or higher or C89 or higher.
We recommended that you include the instrumentation header in the file where you define the main function, as follows:
If you are unable to meet the requirements of our C/C++ instrumentation, perhaps because you use an older version of Clang or are unable to include a header file, then you can try our legacy instrumentation approach. This approach does not require a modern Clang or a header file, but it will instead require you to provide a shared object at link-time.
Build Requirements
Your instrumented binary must be built with libraries and dependencies that it will use at runtime. Add the following compile flag:LLVM-instrumented binaries must have GNU build ids for symbolization to work. As long as you use the —build-id link flag above, you’ll be fine.
We recommend the use of
-g but it is not necessary. It will provide more detailed information when bugs are found, which may make debugging easier.Validation
To confirm that the instrumentation process was successful, you can run the commandnm to list all the symbols in a binary, and then grep the string “antithesis_load_libvoidstar”.
Symbolization
The LLVM compiler infrastructure will output debug symbols in the DWARF format. They could be separate debug info or just the original unstripped binary. These files should be symlinked (or moved) into a directory named/symbols in the root of the appropriate container image.