How to force gcov to extract data, even when program is aborted

白昼怎懂夜的黑 提交于 2019-11-30 20:46:58

Call void __gcov_flush(void) (from libgcov.a which is linked in by -fprofile-arcs option of compiler) in your assert code, just before killing and application (e.g. change abort(); into __gcov_flush();abort();). This one will call an gcov_exit function (it is statically defined in libgcov). gcov_exit is the main functions to save collected coverage into file. It is registered by __gcov_init with atfork(); and your assert ignores atfork when kills an application.

Another way of solving this is to find why your assert ignores atfork()-registered functions.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!