在 Valgrind 中运行程序时如何进行调试?
我正在完成一个代码模组,并想通过 Valgrind 运行我的程序,以确保我已经占用了所有内存,但我的程序失败了一个断言,而该断言在单独运行时不会失败。 从 Valgrind 运行时是否可以在调试器中停止? 我目前正在翻阅手册,但我想我可以更快地从你们那里得到答案。
I was finishing up a code mod and wanted to run my program through Valgrind to make sure I've got all memory accounted for, but my program failed an assertion that doesn't fail when running on its own. Is it possible to stop in the debugger while running from Valgrind? I'm currently wading through the manual, but figured I could get my answer faster from you all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了
--db-attach=yes
参数。 每次检测到错误时都会停止并询问您此时是否要进入调试器。然而,对于我的程序来说,这被证明很难使用。 我从标准输入读取一个文件进行初始化,我认为 Valgrind 正在将 EOL 解释为对其提示的响应。
I discovered the
--db-attach=yes
argument. This will stop every time an error is detected and ask if you want to enter the debugger at this point.For my program, this is proving to be difficult to use, however. I read a file from standard input for initialization, and I think Valgrind is interpreting EOLs as responding to its prompts.