vendredi 10 juin 2016

Google test framework gives double memory corruption (munmap_chunk)


I am trying to test shared libraries using Google test framework and ended up with the double pointer memory corruption. This is happening in Ubuntu Machine. I have added the appropriate flags in the makefile.

Should I need to do any special compilation settings in Makefile (cmake) for the shared libraries?

I am unable to correlate what is the error here.

Please find the following trace:

0xb7fdd424 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7fdd424 in __kernel_vsyscall ()
#1  0xb735f607 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#2  0xb7362a33 in __GI_abort () at abort.c:89
#3  0xb7399e53 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0xb7496edc "*** Error in `%s': %s: 0x%s ***n") at ../sysdeps/posix/libc_fatal.c:175
#4  0xb73a433a in malloc_printerr (action=<optimized out>, str=0xb7496f00 "munmap_chunk(): invalid pointer", ptr=0x80a37b8) at malloc.c:4996
#5  0xb73a4408 in munmap_chunk (p=<optimized out>) at malloc.c:2816
#6  0xb754582f in operator delete(void*) () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#7  0xb754587b in operator delete[](void*) () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#8  0xb7f56448 in testing::internal::String::~String (this=0x80a2ce0, __in_chrg=<optimized out>) at /usr/include/gtest/internal/gtest-string.h:218
#9  0xb7fa8265 in void std::_Destroy<testing::internal::String>(testing::internal::String*) ()
   from /home/mike/src../src/unitTest/testlibs/mytest_test.so
#10 0xb7fa7d70 in void std::_Destroy_aux<false>::__destroy<testing::internal::String*>(testing::internal::String*, testing::internal::String*) ()
   from /home/mike/src../src/unitTest/testlibs/mytest_test.so
#11 0xb7fa756d in void std::_Destroy<testing::internal::String*>(testing::internal::String*, testing::internal::String*) ()
   from /home/mike/src../src/unitTest/testlibs/mytest_test.so
#12 0xb7fa68c0 in void std::_Destroy<testing::internal::String*, testing::internal::String>(testing::internal::String*, testing::internal::String*, std::allocator<testing::internal::String>&) () from /home/mike/src../src/unitTest/testlibs/mytest_test.so
#13 0xb7fa8c3f in std::vector<testing::internal::String, std::allocator<testing::internal::String> >::~vector() ()
   from /home/mike/src../src/unitTest/testlibs/mytest_test.so
#14 0xb7364543 in __cxa_finalize (d=0xb7eec020) at cxa_finalize.c:56
#15 0xb7e8b693 in __do_global_dtors_aux () from /home/mike/src../src/unitTest/testlibs/mytest_test.so
#16 0xb7fed35c in _dl_fini () at dl-fini.c:252
#17 0xb73641b1 in __run_exit_handlers (status=status@entry=0, listp=0xb74db3c4 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:82
#18 0xb736420d in __GI_exit (status=0) at exit.c:104
#19 0xb734aa8b in __libc_start_main (main=0x804ceed <main(int, char**)>, argc=2, argv=0xbfffe7b4, init=0x807a6f0 <__libc_csu_init>,
    fini=0x807a760 <__libc_csu_fini>, rtld_fini=0xb7fed180 <_dl_fini>, stack_end=0xbfffe7ac) at libc-start.c:321
#20 0x0804ce11 in _start ()

Aucun commentaire:

Enregistrer un commentaire