Valgrind输出带有地址和问号? [英] Valgrind output with address and question marks?

查看:889
本文介绍了Valgrind输出带有地址和问号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从valgrind收到了一个我不太了解的输出:

I have just receive an output from valgrind that I do not quite understand:

==20290== Invalid read of size 1
==20290==    at 0x8C1D678: ???
==20290==    by 0x5D74C47: ???
==20290==  Address 0xee818c7d is not stack'd, malloc'd or (recently) free'd
==20290== 
==20290== 
==20290== Process terminating with default action of signal 11 (SIGSEGV)
==20290==  Access not within mapped region at address 0xEE818C7D
==20290==    at 0x8C1D678: ???
==20290==    by 0x5D74C47: ???
==20290==  If you believe this happened as a result of a stack
==20290==  overflow in your program's main thread (unlikely but
==20290==  possible), you can try to increase the size of the
==20290==  main thread stack using the --main-stacksize= flag.
==20290==  The main thread stack size used in this run was 8388608.
==20290== 

尤其是,我对这些问号感到困惑.通常,您在该位置上看到的是valgrind检测到的错误的位置.我以前使用过valgrind,并且所有输出均如手册中所述.我使用了以下valgrind命令:

Particularly, I am confused by these question marks. Typically what you get on this place is the location of errors valgrind has detected. I have used valgrind before and all the output was as describe in the manual. I have used this valgrind command:

valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=20 --track-origins=yes

程序本身大喊分段错误.尽管valgrind这次没有告诉我内存泄漏的任何位置,但是通过调试,我已经确定了发生分段错误的位置.不幸的是,它在Intel ODE求解器库(dodesol)的ODE求解器函数中,我无法访问它.我已经仔细检查了我多次传递给该函数的所有参数,这些参数似乎还可以(至少与我之前使用的手册和示例中的参数相对应).

The program itself yells a segmentation fault. Although valgrind does not tell me any location of the memory leak this time, from debugging I have determined the place where segmentation fault occurs. Unfortunately, it is within an ODE solver function from Intel ODE solver library (dodesol), and I have no access to it. I have carefully checked all the parameters I pass to this function many times and they seem to be ok (at least correspond to those in manual and examples I had before).

推荐答案

???几乎可以肯定意味着Valgrind无法在该地址附近的任何地方找到符号.我怀疑您正在执行没有代码的代码.例如,这可能是覆盖堆栈上的返回地址的结果,例如,可能是缓冲区溢出(但是其他指针错误可能触发它)导致的结果.Valgrind非常擅长动态分配内存的问题,但是它具有更多的优势.局部变量是一项艰巨的工作,因为无法总是确定堆栈上数组的结束位置.

The ??? almost certainly mean that Valgrind wasn't able to find a symbol anywhere near the address in question. I suspect that you're executing code where there is no code. This could be the result of overwriting the return address on the stack, for example, perhaps as the result of a buffer overrun (but other pointer errors can trigger it) Valgrind is very good at problems with dynamically allocated memory, but it has a more difficult job with local variables, because it's not always possible for it to determine where an on stack array ends.

这篇关于Valgrind输出带有地址和问号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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