如何从这些输出中获取实际的函数名称

2024-03-24

我使用 boost 测试进行单元测试,使用 gcov 和 lcov 来测量覆盖范围。

不幸的是 genhtml 生成类似函数覆盖率的报告:

我现在想知道有什么功能_ZN7UtilLib11ProgressBarC2EjdRSo实际上是。

到目前为止,我无法将此函数与 ProgressBar 的任何类接口相关联:

class ProgressBar {
 public:
    explicit ProgressBar(
            unsigned int expected_count,
            double updateInterval = 30,
            std::ostream& os = std::cout);

    unsigned int operator+=(unsigned int increment);

    unsigned int operator++();

    unsigned int operator++(int i);
}

任何人都可以帮助我如何使用 gcov 获得更好的函数名称或者如何理解这些函数名称。

该应用程序是使用 gcc4.7 编译的,具有以下标志:-g -g -save-temps=obj -Wall -Wextra -Wno-unused-parameter -Wno-error=unused-parameter -O0 -pedantic


这些是损坏的 C++ 符号,请使用c++filt在 shell 中将其分解:

> c++filt _ZN7UtilLib11ProgressBarC2EjdRSo
UtilLib::ProgressBar::ProgressBar(unsigned int, double, std::basic_ostream<char, std::char_traits<char> >&)

另外,因为你似乎使用genhtml,查看--demangle-cpp自动为您进行整理的选项。

请注意,编译器为您编写的 ctor 发出了两个实现,使用--demangle-cpp将隐藏仅在损坏的符号名称中可见的差异。要了解编译器在做什么,请查看here https://stackoverflow.com/questions/6921295/dual-emission-of-constructor-symbols/6921467#6921467.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何从这些输出中获取实际的函数名称 的相关文章

随机推荐