I've got some server in c++ (commands acquired from build-system):
g++ -o obj/server.o -c -m64 -isystem/opt/boost/include -Wall -Werror -march=core2 -ftest-coverage -fprofile-arcs -DGCOV_ENABLED= -Iinclude -I/opt/hydraOST/lzopro/include -I/usr/include/libxml2 -Idaemon/include src/server.cpp g++ -o bin/server.exe -rdynamic -ftest-coverage -fprofile-arcs -m64 -Wl,-rpath=\$ORIGIN -Wl,-rpath=/opt/hydraOST/lzopro/lib obj/server.o (+ other libs) As it's daemon and I'm stopping it with signal but to enforce dumping gcov data before kill $PID I'm using gdb:
gdb -p $PID -batch -x gcov/dumpGcovData where contents of gcov/dumpGcovData:
call __gcov_flush() thread apply all call __gcov_flush() I know that linking should be with -lgcov but as it was working in that way so I didn't change it in build system. The problem occured just after added -rdynamic flag (without that flag it worked properly).