I was trying to use valgrind on one of my applications. The program runs fine
on its own, but valgrind reports a SIGSEGV and exits without running any of my
application, as far as I can tell.
I have been able to reproduce the issue with a simple test. The test does not
even use log4cxx, but just linking it in causes the problem, so likely some
static vars causing constructors, etc. to run maybe? Again, running the test
without valgrind does not cause a seg fault.
I am on Fedora Core 14, kernel 2.6.35.12-88, g++ 4.5.1, glibc-2.13.1.
Any help most appreciated,
Thanks,
Shash
Here's the content of my Test.cpp file:
int main(const int argc,
const char** argv)
{
return (0);
}
Here are the commands to build:
g++ -g -Wall -o Test.o -c src/Test.cpp
g++ -g Test.o -o test -llog4cxx
Running "valgrind ./test" gets:
==28114== Memcheck, a memory error detector
==28114== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==28114== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==28114== Command: ./test
==28114==
==28114== Conditional jump or move depends on uninitialised value(s)
==28114== at 0x4005339: operator delete[](void*, std::nothrow_t const&)
(vg_replace_
malloc.c:380)
==28114== by 0x512DCE7: ??? (in /usr/lib/libstdc++.so.6.0.14)
==28114== by 0x509D7C8: std::underflow_error::underflow_error(std::string
const&) (s
tdexcept.cc:72)
==28114== by 0x509DFAD: virtual thunk to std::strstream::~strstream() (in
/usr/lib/l
ibstdc++.so.6.0.14)
==28114== by 0x4DE9AD: pthread_once (pthread_once.S:122)
==28114== by 0x509E0A8: std::locale::locale() (strstream.cc:369)
==28114== by 0x509AF97: std::ios_base::Init::Init() (locale_facets.h:1930)
==28114== by 0x4101B14: global constructors keyed to loglog.cpp (iostream:73)
==28114== by 0x4159B1C: ??? (in /usr/local/lib/liblog4cxx.so.10.0.0)
==28114== by 0x40A5073: ??? (in /usr/local/lib/liblog4cxx.so.10.0.0)
==28114== by 0x3348FB: call_init (dl-init.c:68)
==28114== by 0x334A18: _dl_init (dl-init.c:132)
==28114==
==28114== Invalid free() / delete / delete[]
==28114== at 0x4005379: operator delete[](void*, std::nothrow_t const&)
(vg_replace_
malloc.c:380)
==28114== by 0x512DCE7: ??? (in /usr/lib/libstdc++.so.6.0.14)
==28114== by 0x509D7C8: std::underflow_error::underflow_error(std::string
const&) (s
tdexcept.cc:72)
==28114== by 0x509DFAD: virtual thunk to std::strstream::~strstream() (in
/usr/lib/l
ibstdc++.so.6.0.14)
==28114== by 0x4DE9AD: pthread_once (pthread_once.S:122)
==28114== by 0x509E0A8: std::locale::locale() (strstream.cc:369)
==28114== by 0x509AF97: std::ios_base::Init::Init() (locale_facets.h:1930)
==28114== by 0x4101B14: global constructors keyed to loglog.cpp (iostream:73)
==28114== by 0x4159B1C: ??? (in /usr/local/lib/liblog4cxx.so.10.0.0)
==28114== by 0x40A5073: ??? (in /usr/local/lib/liblog4cxx.so.10.0.0)
==28114== by 0x3348FB: call_init (dl-init.c:68)
==28114== by 0x334A18: _dl_init (dl-init.c:132)
==28114== Address 0x5059b24 is not stack'd, malloc'd or (recently) free'd
==28114==
==28114== Use of uninitialised value of size 4
==28114== at 0x4005388: operator delete[](void*, std::nothrow_t const&)
(vg_replace_
malloc.c:380)
==28114== by 0x509D7C8: std::underflow_error::underflow_error(std::string
const&) (s
tdexcept.cc:72)
==28114== by 0x509DFAD: virtual thunk to std::strstream::~strstream() (in
/usr/lib/l
ibstdc++.so.6.0.14)
==28114== by 0x4DE9AD: pthread_once (pthread_once.S:122)
==28114== by 0x509E0A8: std::locale::locale() (strstream.cc:369)
==28114== by 0x509AF97: std::ios_base::Init::Init() (locale_facets.h:1930)
==28114== by 0x4101B14: global constructors keyed to loglog.cpp (iostream:73)
==28114== by 0x4159B1C: ??? (in /usr/local/lib/liblog4cxx.so.10.0.0)
==28114== by 0x40A5073: ??? (in /usr/local/lib/liblog4cxx.so.10.0.0)
==28114== by 0x3348FB: call_init (dl-init.c:68)
==28114== by 0x334A18: _dl_init (dl-init.c:132)
==28114== by 0x3268AE: ??? (in /lib/ld-2.13.so)
==28114==
vex x86->IR: unhandled instruction bytes: 0xEA 0xB5 0x8 0x5
==28114== Invalid read of size 1
==28114== at 0x512DCE8: ??? (in /usr/lib/libstdc++.so.6.0.14)
==28114== by 0x509D7C8: std::underflow_error::underflow_error(std::string
const&) (s
tdexcept.cc:72)
==28114== by 0x509DFAD: virtual thunk to std::strstream::~strstream() (in
/usr/lib/l
ibstdc++.so.6.0.14)
==28114== by 0x4DE9AD: pthread_once (pthread_once.S:122)
==28114== by 0x509E0A8: std::locale::locale() (strstream.cc:369)
==28114== by 0x509AF97: std::ios_base::Init::Init() (locale_facets.h:1930)
==28114== by 0x4101B14: global constructors keyed to loglog.cpp (iostream:73)
==28114== by 0x4159B1C: ??? (in /usr/local/lib/liblog4cxx.so.10.0.0)
==28114== by 0x40A5073: ??? (in /usr/local/lib/liblog4cxx.so.10.0.0)
==28114== by 0x3348FB: call_init (dl-init.c:68)
==28114== by 0x334A18: _dl_init (dl-init.c:132)
==28114== by 0x3268AE: ??? (in /lib/ld-2.13.so)
==28114== Address 0x6a050f16 is not stack'd, malloc'd or (recently) free'd
==28114==
==28114==
==28114== Process terminating with default action of signal 11 (SIGSEGV)
==28114== Access not within mapped region at address 0x6A050F16
==28114== at 0x512DCE8: ??? (in /usr/lib/libstdc++.so.6.0.14)
==28114== by 0x509D7C8: std::underflow_error::underflow_error(std::string
const&) (s
tdexcept.cc:72)
==28114== by 0x509DFAD: virtual thunk to std::strstream::~strstream() (in
/usr/lib/l
ibstdc++.so.6.0.14)
==28114== by 0x4DE9AD: pthread_once (pthread_once.S:122)
==28114== by 0x509E0A8: std::locale::locale() (strstream.cc:369)
==28114== by 0x509AF97: std::ios_base::Init::Init() (locale_facets.h:1930)
==28114== by 0x4101B14: global constructors keyed to loglog.cpp (iostream:73)
==28114== by 0x4159B1C: ??? (in /usr/local/lib/liblog4cxx.so.10.0.0)
==28114== by 0x40A5073: ??? (in /usr/local/lib/liblog4cxx.so.10.0.0)
==28114== by 0x3348FB: call_init (dl-init.c:68)
==28114== by 0x334A18: _dl_init (dl-init.c:132)
==28114== by 0x3268AE: ??? (in /lib/ld-2.13.so)
==28114== by 0x40A5073: ??? (in /usr/local/lib/liblog4cxx.so.10.0.0)
==28114== by 0x3348FB: call_init (dl-init.c:68)
==28114== by 0x334A18: _dl_init (dl-init.c:132)
==28114== by 0x3268AE: ??? (in /lib/ld-2.13.so)
==28114== Address 0x6a050f16 is not stack'd, malloc'd or (recently) free'd
==28114==
==28114==
==28114== Process terminating with default action of signal 11 (SIGSEGV)
==28114== Access not within mapped region at address 0x6A050F16
==28114== at 0x512DCE8: ??? (in /usr/lib/libstdc++.so.6.0.14)
==28114== by 0x509D7C8: std::underflow_error::underflow_error(std::string
const&) (s
tdexcept.cc:72)
==28114== by 0x509DFAD: virtual thunk to std::strstream::~strstream() (in
/usr/lib/l
ibstdc++.so.6.0.14)
==28114== by 0x4DE9AD: pthread_once (pthread_once.S:122)
==28114== by 0x509E0A8: std::locale::locale() (strstream.cc:369)
==28114== by 0x509AF97: std::ios_base::Init::Init() (locale_facets.h:1930)
==28114== by 0x4101B14: global constructors keyed to loglog.cpp (iostream:73)
==28114== by 0x4159B1C: ??? (in /usr/local/lib/liblog4cxx.so.10.0.0)
==28114== by 0x40A5073: ??? (in /usr/local/lib/liblog4cxx.so.10.0.0)
==28114== by 0x3348FB: call_init (dl-init.c:68)
==28114== by 0x334A18: _dl_init (dl-init.c:132)
==28114== by 0x3268AE: ??? (in /lib/ld-2.13.so)
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users