繁体   English   中英

如何将Valgrind与Meson结合使用?

[英]How to use Valgrind with Meson?

project('testproject', 'cpp')

src = ['a.cpp', 'b.cpp']

executable('test', src)

使用Meson构建系统使用Valgrind构建可执行文件的最简单方法是什么?

valgrind是一种动态分析工具,无需专门为valgrind重新编译它。

例如,您可以执行以下操作:

瓦尔格朗德

valgrind将运行并分析ls命令。

但是请注意,建议您编译调试信息,否则valgrind的错误报告将不太容易理解。

http://www.valgrind.org/docs/manual/QuickStart.html中提供了有关如何使用valgrind的介绍

仅出于完整性考虑,想注意一下valgrind可以用作介子命令行中的包装器,例如

$ meson test --wrap='valgrind --leak-check=full --error-exitcode=1' testname

要么

$ meson test --wrap='valgrind --tool=helgrind -v --error-exitcode=1' testname

可以与其他测试选项结合使用,例如

$ meson test --wrap='valgrind --leak-check=full --error-exitcode=1' testname --repeat=100

检查此页面的参考手册。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM