Skip to content

Instantly share code, notes, and snippets.

@smartkiwi
Created September 3, 2014 01:27
Show Gist options
  • Save smartkiwi/573d0173839c8c2e5972 to your computer and use it in GitHub Desktop.
Save smartkiwi/573d0173839c8c2e5972 to your computer and use it in GitHub Desktop.
vw ./c_test/sample_gcc valgrind -v info
[vagrant@localhost c_test]$ valgrind -v ./sample_gcc
==15733== Memcheck, a memory error detector
==15733== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==15733== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==15733== Command: ./sample_gcc
==15733==
--15733-- Valgrind options:
--15733-- -v
--15733-- Contents of /proc/version:
--15733-- Linux version 2.6.32-279.el6.x86_64 ([email protected]) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Fri Jun 22 12:19:21 UTC 2012
--15733-- Arch and hwcaps: AMD64, amd64-sse3
--15733-- Page sizes: currently 4096, max supported 4096
--15733-- Valgrind library directory: /usr/lib64/valgrind
--15733-- Reading syms from /vagrant/rpmbuild/BUILD/vowpal_wabbit/c_test/sample_gcc
--15733-- Reading syms from /usr/lib64/valgrind/memcheck-amd64-linux
--15733-- object doesn't have a dynamic symbol table
--15733-- Reading syms from /lib64/ld-2.12.so
--15733-- Scheduler: using generic scheduler lock implementation.
--15733-- Reading suppressions file: /usr/lib64/valgrind/default.supp
==15733== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-15733-by-vagrant-on-localhost.localdomain
==15733== embedded gdbserver: writing to /tmp/vgdb-pipe-to-vgdb-from-15733-by-vagrant-on-localhost.localdomain
==15733== embedded gdbserver: shared mem /tmp/vgdb-pipe-shared-mem-vgdb-15733-by-vagrant-on-localhost.localdomain
==15733==
==15733== TO CONTROL THIS PROCESS USING vgdb (which you probably
==15733== don't want to do, unless you know exactly what you're doing,
==15733== or are doing some strange experiment):
==15733== /usr/lib64/valgrind/../../bin/vgdb --pid=15733 ...command...
==15733==
==15733== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==15733== /path/to/gdb ./sample_gcc
==15733== and then give GDB the following command
==15733== target remote | /usr/lib64/valgrind/../../bin/vgdb --pid=15733
==15733== --pid is optional if only one valgrind process is running
==15733==
--15733-- REDIR: 0x302ea174a0 (strlen) redirected to 0x38049551 (vgPlain_amd64_linux_REDIR_FOR_strlen)
--15733-- Reading syms from /usr/lib64/valgrind/vgpreload_core-amd64-linux.so
--15733-- Reading syms from /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so
--15733-- REDIR: 0x302ea17310 (index) redirected to 0x4a07bf0 (index)
--15733-- REDIR: 0x302ea17390 (strcmp) redirected to 0x4a08530 (strcmp)
--15733-- Reading syms from /usr/lib64/libvw_c_wrapper.so
--15733-- Reading syms from /lib64/libc-2.12.so
--15733-- Reading syms from /vagrant/rpmbuild/BUILD/vowpal_wabbit-7.6/vowpalwabbit/.libs/libvw.so.0.0.0
--15733-- Reading syms from /vagrant/rpmbuild/BUILD/vowpal_wabbit-7.6/vowpalwabbit/.libs/liballreduce.so.0.0.0
--15733-- Reading syms from /usr/lib64/libboost_program_options-mt.so.5
--15733-- object doesn't have a symbol table
--15733-- Reading syms from /lib64/libz.so.1.2.3
--15733-- object doesn't have a symbol table
--15733-- Reading syms from /usr/lib64/libstdc++.so.6.0.13
--15733-- object doesn't have a symbol table
--15733-- Reading syms from /lib64/libm-2.12.so
--15733-- Reading syms from /lib64/libgcc_s-4.4.7-20120601.so.1
--15733-- object doesn't have a symbol table
--15733-- Reading syms from /lib64/libpthread-2.12.so
--15733-- Reading syms from /lib64/librt-2.12.so
--15733-- REDIR: 0x302f284100 (strcasecmp) redirected to 0x480155c (_vgnU_ifunc_wrapper)
--15733-- REDIR: 0x302f2863c0 (strncasecmp) redirected to 0x480155c (_vgnU_ifunc_wrapper)
--15733-- REDIR: 0x302f282070 (__GI_strrchr) redirected to 0x4a07a70 (__GI_strrchr)
--15733-- REDIR: 0x302f280590 (__GI_strlen) redirected to 0x4a07f70 (__GI_strlen)
--15733-- REDIR: 0x302f27eb10 (strcmp) redirected to 0x480155c (_vgnU_ifunc_wrapper)
--15733-- REDIR: 0x302f27eb50 (__GI_strcmp) redirected to 0x4a084e0 (__GI_strcmp)
--15733-- REDIR: 0x302f280550 (strlen) redirected to 0x480155c (_vgnU_ifunc_wrapper)
--15733-- REDIR: 0x30302bd080 (operator new(unsigned long)) redirected to 0x4a0753a (operator new(unsigned long))
--15733-- REDIR: 0x302f288aa0 (memcpy) redirected to 0x4a08b20 (memcpy)
--15733-- REDIR: 0x302f289ed0 (__GI___rawmemchr) redirected to 0x4a09f60 (__GI___rawmemchr)
--15733-- REDIR: 0x302f279760 (calloc) redirected to 0x4a056d7 (calloc)
this is a native c program calling vw
--15733-- REDIR: 0x302f27ffa0 (strcpy) redirected to 0x480155c (_vgnU_ifunc_wrapper)
--15733-- REDIR: 0x302f27ffd0 (__GI_strcpy) redirected to 0x4a08060 (__GI_strcpy)
--15733-- REDIR: 0x302f27ae40 (realloc) redirected to 0x4a06b17 (realloc)
--15733-- REDIR: 0x302f27a950 (free) redirected to 0x4a06369 (free)
--15733-- REDIR: 0x302f282780 (memchr) redirected to 0x4a085d0 (memchr)
--15733-- REDIR: 0x30302bb2f0 (operator delete(void*)) redirected to 0x4a05f4f (operator delete(void*))
--15733-- REDIR: 0x302f282c30 (memmove) redirected to 0x4a09ab0 (memmove)
--15733-- REDIR: 0x302f289f20 (strchrnul) redirected to 0x4a09f10 (strchrnul)
--15733-- REDIR: 0x302f283930 (mempcpy) redirected to 0x4a09f80 (mempcpy)
--15733-- REDIR: 0x302f2807c0 (__GI_strncmp) redirected to 0x4a08430 (__GI_strncmp)
--15733-- REDIR: 0x302f283fb0 (__GI_stpcpy) redirected to 0x4a097a0 (__GI_stpcpy)
can't open: , error = Success
--15733-- REDIR: 0x302f279b20 (malloc) redirected to 0x4a0696c (malloc)
terminate called after throwing an instance of 'std::exception'
what(): std::exception
==15733==
==15733== Process terminating with default action of signal 6 (SIGABRT)
==15733== at 0x302F2328A5: raise (in /lib64/libc-2.12.so)
==15733== by 0x302F234084: abort (in /lib64/libc-2.12.so)
==15733== by 0x30302BEA5C: __gnu_cxx::__verbose_terminate_handler() (in /usr/lib64/libstdc++.so.6.0.13)
==15733== by 0x30302BCBE5: ??? (in /usr/lib64/libstdc++.so.6.0.13)
==15733== by 0x30302BCC12: std::terminate() (in /usr/lib64/libstdc++.so.6.0.13)
==15733== by 0x30302BCD0D: __cxa_throw (in /usr/lib64/libstdc++.so.6.0.13)
==15733== by 0x4E570D0: io_buf::open_file(char const*, bool, int) (in /vagrant/rpmbuild/BUILD/vowpal_wabbit-7.6/vowpalwabbit/.libs/libvw.so.0.0.0)
==15733== by 0x4ED13B9: parse_source_args(vw&, boost::program_options::variables_map&, bool, unsigned long) (in /vagrant/rpmbuild/BUILD/vowpal_wabbit-7.6/vowpalwabbit/.libs/libvw.so.0.0.0)
==15733== by 0x4E984CF: parse_args(int, char**) (in /vagrant/rpmbuild/BUILD/vowpal_wabbit-7.6/vowpalwabbit/.libs/libvw.so.0.0.0)
==15733== by 0x4E99EC9: VW::initialize(std::string) (in /vagrant/rpmbuild/BUILD/vowpal_wabbit-7.6/vowpalwabbit/.libs/libvw.so.0.0.0)
==15733== by 0x4C199C2: VW_InitializeA (in /usr/lib64/libvw_c_wrapper.so)
==15733== by 0x400763: main (in /vagrant/rpmbuild/BUILD/vowpal_wabbit/c_test/sample_gcc)
==15733== Invalid free() / delete / delete[] / realloc()
==15733== at 0x4A063F0: free (vg_replace_malloc.c:446)
==15733== by 0x302F33F59A: free_mem (in /lib64/libc-2.12.so)
==15733== by 0x302F33F131: __libc_freeres (in /lib64/libc-2.12.so)
==15733== by 0x480166D: _vgnU_freeres (vg_preloaded.c:62)
==15733== by 0x302F234084: abort (in /lib64/libc-2.12.so)
==15733== by 0x30302BEA5C: __gnu_cxx::__verbose_terminate_handler() (in /usr/lib64/libstdc++.so.6.0.13)
==15733== by 0x30302BCBE5: ??? (in /usr/lib64/libstdc++.so.6.0.13)
==15733== by 0x30302BCC12: std::terminate() (in /usr/lib64/libstdc++.so.6.0.13)
==15733== by 0x30302BCD0D: __cxa_throw (in /usr/lib64/libstdc++.so.6.0.13)
==15733== by 0x4E570D0: io_buf::open_file(char const*, bool, int) (in /vagrant/rpmbuild/BUILD/vowpal_wabbit-7.6/vowpalwabbit/.libs/libvw.so.0.0.0)
==15733== by 0x4ED13B9: parse_source_args(vw&, boost::program_options::variables_map&, bool, unsigned long) (in /vagrant/rpmbuild/BUILD/vowpal_wabbit-7.6/vowpalwabbit/.libs/libvw.so.0.0.0)
==15733== by 0x4E984CF: parse_args(int, char**) (in /vagrant/rpmbuild/BUILD/vowpal_wabbit-7.6/vowpalwabbit/.libs/libvw.so.0.0.0)
==15733== Address 0x4e1b5e0 is not stack'd, malloc'd or (recently) free'd
==15733==
==15733==
==15733== HEAP SUMMARY:
==15733== in use at exit: 4,371,451 bytes in 792 blocks
==15733== total heap usage: 1,065 allocs, 275 frees, 4,449,140 bytes allocated
==15733==
==15733== Searching for pointers to 792 not-freed blocks
==15733== Checked 4,502,656 bytes
==15733==
==15733== LEAK SUMMARY:
==15733== definitely lost: 0 bytes in 0 blocks
==15733== indirectly lost: 0 bytes in 0 blocks
==15733== possibly lost: 12,497 bytes in 252 blocks
==15733== still reachable: 4,358,954 bytes in 540 blocks
==15733== suppressed: 0 bytes in 0 blocks
==15733== Rerun with --leak-check=full to see details of leaked memory
==15733==
==15733== ERROR SUMMARY: 2 errors from 1 contexts (suppressed: 6 from 6)
==15733==
==15733== 2 errors in context 1 of 1:
==15733== Invalid free() / delete / delete[] / realloc()
==15733== at 0x4A063F0: free (vg_replace_malloc.c:446)
==15733== by 0x302F33F59A: free_mem (in /lib64/libc-2.12.so)
==15733== by 0x302F33F131: __libc_freeres (in /lib64/libc-2.12.so)
==15733== by 0x480166D: _vgnU_freeres (vg_preloaded.c:62)
==15733== by 0x302F234084: abort (in /lib64/libc-2.12.so)
==15733== by 0x30302BEA5C: __gnu_cxx::__verbose_terminate_handler() (in /usr/lib64/libstdc++.so.6.0.13)
==15733== by 0x30302BCBE5: ??? (in /usr/lib64/libstdc++.so.6.0.13)
==15733== by 0x30302BCC12: std::terminate() (in /usr/lib64/libstdc++.so.6.0.13)
==15733== by 0x30302BCD0D: __cxa_throw (in /usr/lib64/libstdc++.so.6.0.13)
==15733== by 0x4E570D0: io_buf::open_file(char const*, bool, int) (in /vagrant/rpmbuild/BUILD/vowpal_wabbit-7.6/vowpalwabbit/.libs/libvw.so.0.0.0)
==15733== by 0x4ED13B9: parse_source_args(vw&, boost::program_options::variables_map&, bool, unsigned long) (in /vagrant/rpmbuild/BUILD/vowpal_wabbit-7.6/vowpalwabbit/.libs/libvw.so.0.0.0)
==15733== by 0x4E984CF: parse_args(int, char**) (in /vagrant/rpmbuild/BUILD/vowpal_wabbit-7.6/vowpalwabbit/.libs/libvw.so.0.0.0)
==15733== Address 0x4e1b5e0 is not stack'd, malloc'd or (recently) free'd
==15733==
--15733--
--15733-- used_suppression: 4 U1004-ARM-_dl_relocate_object
--15733-- used_suppression: 2 glibc-2.5.x-on-SUSE-10.2-(PPC)-2a
==15733==
==15733== ERROR SUMMARY: 2 errors from 1 contexts (suppressed: 6 from 6)
Aborted (core dumped)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment