gpt4 book ai didi

c++ - GCOV-在其他文件夹中生成的gcda文件

转载 作者:行者123 更新时间:2023-12-02 10:11:31 24 4
gpt4 key购买 nike

资料夹结构
〜/沙盒/ dev
〜/沙盒/测试

  • 我在dev目录中有main.cpp。我使用--coverage标志编译了代码以生成代码覆盖率。
    现在,将生成a.out和main.gcno文件。
  • 现在我将main.cpp,main.gcno和a.out复制到测试目录
  • 当我从测试目录运行a.out时,main.gcda文件在dev文件夹而不是当前工作目录中生成。

  • 似乎该路径在二进制/ gcno中是硬编码的。
    需要进行哪些更改才能在测试目录中生成gcda文件?

    最佳答案

    By default, the .gcda files are also stored in the same directory as the object file, but the GCC -fprofile-dir option may be used to store the .gcda files in a separate directory.


    https://gcc.gnu.org/onlinedocs/gcc/Gcov-Data-Files.html
    -fprofile-dir tag in GCOV utility

    关于c++ - GCOV-在其他文件夹中生成的gcda文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63360206/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com