can gcov deal with shared object?

可紊 提交于 2019-11-30 23:56:33
deuberger

I ran into that problem too, but have since solved it. I just use the --coverage option in both CPPFLAGS and LDFLAGS. I think that should take care of the compile issue for you.

The shared object still doesn't seem to produce .gcda files though and I'm not sure how to solve that problems. Like you said, it works fine with executables, but shared objects seem to have some problems.

EDIT: Apparently, gcov does support shared objects now. I did a significant amount of research yesterday and found conflicting answers, so I mailed the gcc-help list. See thread here: http://gcc.gnu.org/ml/gcc-help/2010-09/msg00130.html. I haven't tried solving my problem based on the answer yet, but I will post back when I do.

EDIT 2: Shared objects do work with gcov (or rather than --cover option with gcc). There's another post with details here: gcov: producing .gcda output from shared library?. It also references the same thread above.

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