我剛開始學習使用的valgrind和--tool = MEMCHECK如何使用Valgrind的有效
但我有實際查找問題什麼麻煩。
例如
一個這樣的問題是這樣的。
==12561== Conditional jump or move depends on uninitialised value(s)
==12561== at 0x425779: Server::HandleReceiveFrom(boost::system::error_code const&, unsigned long) (mUUID.h:63)
==12561== by 0x428EC4: boost::asio::detail::reactive_socket_recvfrom_op<boost::asio::mutable_buffers_1, boost::asio::ip::basic_endpoint<boost::asio::ip::udp>, boost::_bi::bind_t<void, boost::_mfi::mf2<void, Server, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<Server*>, boost::arg<1> (*)(), boost::arg<2> (*)()> > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code, unsigned long) (mem_fn_template.hpp:280)
==12561== by 0x42E589: boost::asio::detail::task_io_service::run(boost::system::error_code&) (task_io_service_operation.hpp:35)
==12561== by 0x42720C: Server::Run() (io_service.ipp:57)
==12561== by 0x42FB00: main (obbs.cpp:198)
,另一個是這個
== Use of uninitialised value of size 8
==12561== at 0x5E56091: _itoa_word (_itoa.c:196)
==12561== by 0x5E573D8: vfprintf (vfprintf.c:1613)
==12561== by 0x5F0EA6F: __vsnprintf_chk (vsnprintf_chk.c:65)
如何最有效地追查這些類型的問題的一些提示後我。 (條件轉移和未初始化值)。
編輯
這是什麼可擔心的?似乎消失與選項--run-libc-freeres=no
。 這是否意味着我有一個越野車C庫?
==14754== Invalid free()/delete/delete[]
==14754== at 0x4C27D71: free (vg_replace_malloc.c:366)
==14754== by 0x5F43A0A: free_mem (in /lib/libc-2.12.1.so)
==14754== by 0x5F435A1: __libc_freeres (in /lib/libc-2.12.1.so)
==14754== by 0x4A2366B: _vgnU_freeres (vg_preloaded.c:62)
==14754== by 0x5E4A4A4: exit (exit.c:93)
==14754== by 0x5E2FD94: (below main) (libc-start.c:258)
==14754== Address 0x4046bb8 is not stack'd, malloc'd or (recently) free'd
+1一個非常重要的工具,可以使用 – 2010-11-12 08:41:42
未初始化的值在Valgrind的快速入門http://valgrind.org/docs/manual /QuickStart.html(總共約12段,少於未初始化的值) – isomorphismes 2013-08-26 09:09:07