简体   繁体   English

在Valgrind中运行程序时如何调试?

[英]How do I debug while running my program in 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. 我正在完成一个代码mod,并希望通过Valgrind运行我的程序,以确保我已经考虑了所有内存,但是我的程序失败了一个断言,而断言在单独运行时不会失败。 Is it possible to stop in the debugger while running from Valgrind? 从Valgrind运行时,是否可以在调试器中停止运行? I'm currently wading through the manual, but figured I could get my answer faster from you all. 我目前正在仔细阅读本手册,但认为可以更快地从所有人那里得到答案。

I discovered the --db-attach=yes argument. 我发现了--db-attach=yes参数。 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. 我从标准输入中读取了一个文件以进行初始化,我认为Valgrind会将EOL解释为对其提示的响应。

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

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