gpt4 book ai didi

Passing valgrind flags from cmake(从cmake传递valgrind标志)

转载 作者:bug小助手 更新时间:2023-10-24 19:45:50 30 4
gpt4 key购买 nike



Complementary to this question, how can I pass flags to valgrind from cmake?

作为对这个问题的补充,我如何将标志从cmake传递给valgrind?


# enable valgrind checks
set(CTEST_MEMORYCHECK_TYPE "valgrind")
set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "--leak-check=no")

According to the docs, The lines above should work, but after running cmake . + make I get:

根据文档,上面的代码行应该可以工作,但在运行cmake之后。+使我得到:


$ ctest -T memcheck | grep "Memory Leak\|Defects"
1/1 MemCheck: #1: test ............................. Defects: 1
Memory Leak - 1

When I inspect the DartConfiguration.tcl file I don't see my flag there:

当我检查DartConfiguration.tcl文件时,我没有在那里看到我的标志:


$ sed -n "79,80p" ./DartConfiguration.tcl 
MemoryCheckCommand: /usr/local/bin/valgrind
MemoryCheckCommandOptions: # <--- nothing here ...

After manually editing DartConfiguration.tcl everything works fine:

手动编辑DartConfiguration.tcl后,一切正常:


$ sed -i "s/MemoryCheckCommandOptions:/MemoryCheckCommandOptions: --leak-check=no/g" DartConfiguration.tcl
$ ctest -T memcheck | grep "Memory Leak\|Defects"
$ # nothing ( good )


更多回答

Maybe this?

也许是这个?

@dewaffled no, it doesn't work

@dewaffed no,它不起作用

I ended up calling valgrind directly. When leaks are not ignored, the pipeline breaks (like it should)

我最后直接给瓦尔格恩德打了电话。当泄漏不被忽视时,管道就会破裂(就像它应该的那样)

优秀答案推荐

Maybe...wrong include order and variable name.

Try this!

也许……错误的包含顺序和变量名。尝尝这个!


set(MEMORYCHECK_TYPE "valgrind")
set(MEMORYCHECK_COMMAND_OPTIONS "--leak-check=no")
include(CTest)

更多回答

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

您的答案可以通过其他支持信息来改进。请编辑以添加更多详细信息,如引用或文档,以便其他人可以确认您的答案是正确的。你可以在帮助中心找到更多关于如何写出好答案的信息。

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