How do you get Valgrind to show line errors?

寵の児 提交于 2019-12-01 05:31:42
tune2fs

Try valgrind --leak-check=full

This normally prints more useful information. Also add the -O0 flag when compiling so your code doesn't get optimized.

I've repeatedly gotten hosed on this, and couldn't figure out why '--leak-check=full' wasn't working for me, so I thought I'd bump up tune2fs comment.

The most likely problem is that you've (Not ShrimpCrackers, but whoever is reading this post right now) placed --leak-check=full at the end of your command line. Valgrind would like you to post the flag before you enter the actual command line to run your program.

i.e.:

valgrind --leak-check=full ./myprogram

NOT:

valgrind ./myprogram --leak-check=full

Let me be more specific for other readers (i had the same problem but my arguments were in the right order): I found out that valgrind needs the path to the executable, if you dont give this then it will run bu it won't give you the line numbers. In my case the executable was in a different directory, which was in my PATH, but to get the line information you have to run

valgrind --leak-check=full path_to_myprogram/myprogram
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!