使valgrind在第一个错误后立即停止 [英] Make valgrind stop immediately after first error

查看:117
本文介绍了使valgrind在第一个错误后立即停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序处理大量错误,并且在开发期间会在控制台上产生大量输出。它遭受内存损坏,因此我尝试使用valgrind来定位错误。

my program processes large errors and during development in produces large amount of output on the console. It suffers from memory corruption and I try to use valgrind to locate the error.

不幸的是,我在输出行中找不到错误消息,并且它们被刷新弹出时无法取消执行速度太快。它们必须在那里才能找到错误(哪个元素确实导致了错误,依此类推)。在我的程序中重定向然后无效,就像管道输出只会重定向程序输出,而不是valgrind输出一样。

Unfortunately, i can't find the error messages among the output lines, and they flushing by too fast to cancel execution when they pop up. They have to be there in order to locate the error ( which element does cause the error and so on ). Redirecting then within my program doesn't work, just like piping the output does only redirect the program output, not the valgrind output.

能否给我一个提示

推荐答案

您可以要求 valgrind 将其输出保存到文件:

You can ask valgrind to save its output into file:

valgrind --log-file=<filename>

其中< filename> 是文件输出名称。稍后,您可以使用 less 或文本编辑器查看此文件。

where <filename> is the file name for output. Later you can view this file with less or text editor.

这篇关于使valgrind在第一个错误后立即停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆