I am testing a C/C++ shared library where I have compiled the library with the -fprofile-arcs -ftest-coverage -pg
flags and linked with -fprofile-arcs -ftest-coverage
flags.
I am loading, and testing the shared library in Python via the ctypes python routines.
Gcda files do not get generated from python as my python binary was not linked with the -fprofile-arcs -ftest-coverage
flags.
If I run python from lldb/gdb
then gcda files are generated as lldb/gdb
were compiled with the appropriate coverage flags.
Is it possible to call the appropriate coverage functions to initialize profile-arcs, and test-coverage prior to calling functions in my shared library, and then call the appropriate coverage closing routines?
I did a nm on my library and noticed the following routines, but am not sure how to call them.
___llvm_gcov_init
___llvm_gcov_flush
___llvm_writeout_files
It seems like llvm_gcov_init takes parameters so I cant call it directly from python.
I would like to initialize code coverage directly, and not need to recompile python with coverage on multiple machines.