【问题标题】:Valgrind output showing addresses not code against errorsValgrind 输出显示地址而不是针对错误的代码
【发布时间】:2011-07-08 03:15:01
【问题描述】:

我正在我的程序上运行 Valgrind。它向我显示了两个错误,但仅提及针对它们的地址,而不是实际代码,即使在调试版本中也是如此。

你能请。帮助我理解它所说的内容以及如何找到错误的代码行?

输出是

==23002== Memcheck, a memory error detector.  
==23002== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.  
==23002== Using LibVEX rev 1575, a library for dynamic binary translation.  
==23002== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.  
==23002== Using valgrind-3.1.1, a dynamic binary instrumentation framework.  
==23002== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.  
==23002== For more details, rerun with: -v  
==23002==  
==23002== Invalid read of size 4  
==23002== at 0x8AAE6D: open_path (in /lib/ld-2.3.4.so)  
==23002== by 0x8AB68B: _dl_map_object (in /lib/ld-2.3.4.so)  
==23002== by 0x8AF307: openaux (in /lib/ld-2.3.4.so)  
==23002== by 0x8B066D: _dl_catch_error (in /lib/ld-2.3.4.so)  
==23002== by 0x8AF5A9: _dl_map_object_deps (in /lib/ld-2.3.4.so)  
==23002== by 0x8A6459: dl_main (in /lib/ld-2.3.4.so)  
==23002== by 0x8B3DF4: _dl_sysdep_start (in /lib/ld-2.3.4.so)  
==23002== by 0x8A53EF: _dl_start (in /lib/ld-2.3.4.so)  
==23002== by 0x8A47C6: (within /lib/ld-2.3.4.so)  
==23002== Address 0x2F8BBBF8 is not stack'd, malloc'd or (recently) free'd  
==23002==  
==23002== Process terminating with default action of signal 11 (SIGSEGV)  
==23002== Access not within mapped region at address 0x2F8BBBF8  
==23002== at 0x8AAE6D: open_path (in /lib/ld-2.3.4.so)  
==23002== by 0x8AB68B: _dl_map_object (in /lib/ld-2.3.4.so)  
==23002== by 0x8AF307: openaux (in /lib/ld-2.3.4.so)  
==23002== by 0x8B066D: _dl_catch_error (in /lib/ld-2.3.4.so)  
==23002== by 0x8AF5A9: _dl_map_object_deps (in /lib/ld-2.3.4.so)  
==23002== by 0x8A6459: dl_main (in /lib/ld-2.3.4.so)  
==23002== by 0x8B3DF4: _dl_sysdep_start (in /lib/ld-2.3.4.so)  
==23002== by 0x8A53EF: _dl_start (in /lib/ld-2.3.4.so)  
==23002== by 0x8A47C6: (within /lib/ld-2.3.4.so)  
==23002==  
==23002== Jump to the invalid address stated on the next line  
==23002== at 0x246: ???  
==23002== Address 0x246 is not stack'd, malloc'd or (recently) free'd  
==23002==  
==23002== Process terminating with default action of signal 11 (SIGSEGV)  
==23002== Bad permissions for mapped region at address 0x246  
==23002== at 0x246: ???  
==23002==  
==23002== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)  
==23002== malloc/free: in use at exit: 0 bytes in 0 blocks.  
==23002== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.  
==23002== For counts of detected errors, rerun with: -v  
==23002== All heap blocks were freed -- no leaks are possible.  

【问题讨论】:

  • 我看到你正在使用 Valgrind 3.1.1。那是一个非常的旧版本了。我建议您首先考虑升级到 3.5.0 并再试一次。新版本可能会为您提供更好的诊断。

标签: linux centos


【解决方案1】:

那个地址看起来是假的。忘记 valgrind,启动 gdb 来查找您的程序的段错误。

【讨论】:

    【解决方案2】:

    没有调试信息,因为指示的代码在 ld-2.3.4.so 库中(这是动态链接器)。

    在我看来,您的可执行文件链接到了损坏的动态库文件(或试图通过该机制加载不是动态库的文件)。

    【讨论】:

      猜你喜欢
      • 2023-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-21
      • 1970-01-01
      • 2021-04-04
      • 1970-01-01
      • 2016-11-11
      相关资源
      最近更新 更多