gcov可以处理共享库吗? [英] can gcov deal with shared object?

查看:160
本文介绍了gcov可以处理共享库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近正在使用gcov收集代码覆盖率信息。 gcov在可执行应用程序中表现良好:),但是当我尝试加载.so文件时,出现此错误:未知符号__gcov_merge_add。

I am recently using gcov to collect the code coverage info. gcov plays well with executable application :) , but when I try to load a .so file, I got this error: unknown symbol __gcov_merge_add.

然后我在Google和有人说将-lgcov添加到链接标志(LDFLAGS),我确实添加了此选项,但它不起作用。我还尝试在链接标志中使用--coverage选项,无法摆脱此错误。

Then I search on Google and someone said adding -lgcov to the link flag(LDFLAGS), I did add this option and it didn't work. I also try on --coverage option in link flag, cannot get rid of this error.

有人可以帮助解决此问题吗?

Can someone help on this issue?

谢谢。

推荐答案

我也遇到了这个问题,但此后就解决了。我只是在CPPFLAGS和LDFLAGS中都使用--coverage选项。我认为应该为您解决编译问题。

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.

尽管共享对象似乎仍然不生成.gcda文件,但我不确定如何解决那个问题。就像您说的那样,它可以与可执行文件很好地工作,但是共享对象似乎有一些问题。

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.

编辑:
显然,gcov现在支持共享对象。昨天我做了大量研究,发现有矛盾的答案,所以我邮寄了gcc-help列表。请在此处查看主题: http://gcc.gnu.org/ ml / gcc-help / 2010-09 / msg00130.html 。我尚未尝试根据答案来解决问题,但我会在发布时回发。

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.

编辑2:
共享对象确实可以与gcov一起使用(或者不是gcc的--cover选项)。这里还有另一篇详细信息: gcov:从.gcda中生成输出共享库?

这篇关于gcov可以处理共享库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆