如何使用Valgrind获取错误信息?

时间:2015-04-20 12:16:21

标签: c++ c segmentation-fault valgrind

我的代码用C和C ++编写,报告了一个分段错误。 如果我在main函数中替换语句" return 0;"使用"退出(0);",项目执行在退出指令处成功停止。 为了了解错误的位置,我使用了valgrind。 valgrind执行日志文件的最后一个错误是:

==23354== Jump to the invalid address stated on the next line
==23354==    at 0x1700000007: ???
==23354==    by 0x1800000007: ???
==23354==    by 0x1900000008: ???
==23354==    by 0x1A00000009: ???
==23354==    by 0x1B0000000A: ???
==23354==    by 0x1C0000000B: ???
==23354==    by 0x1D0000000C: ???
==23354==    by 0x1F0000000E: ???
==23354==    by 0xFFFFFFFFF: ???
==23354==    by 0x1100000000: ???
==23354==    by 0x1200000001: ???
==23354==    by 0x1300000002: ???
==23354==  Address 0x1700000007 is not stack'd, malloc'd or (recently) free'd
==23354== 
==23354== 
==23354== Process terminating with default action of signal 11     (SIGSEGV)
==23354==  Bad permissions for mapped region at address 0x1700000007
==23354==    at 0x1700000007: ???
==23354==    by 0x1800000007: ???
==23354==    by 0x1900000008: ???
==23354==    by 0x1A00000009: ???
==23354==    by 0x1B0000000A: ???
==23354==    by 0x1C0000000B: ???
==23354==    by 0x1D0000000C: ???
==23354==    by 0x1F0000000E: ???
==23354==    by 0xFFFFFFFFF: ???
==23354==    by 0x1100000000: ???
==23354==    by 0x1200000001: ???
==23354==    by 0x1300000002: ???

我真的不知道如何解释这个问号。 任何帮助都非常感谢。

0 个答案:

没有答案