|
From: Olivier B. <oli...@on...> - 2006-06-25 14:48:38
|
Sorry for the noise, after numerous tests my C++ code is right but when
I switched to the autotools I had made two mistakes :
1. a forgotten AM_LDFLAGS=3D"$AM_LDFLAGS -s" (i.e. --strip-all) was
removing what -ggdb -O0 -fno-inline was adding (thus explaining why so
few informations were reported by valgrind)
2. in AM_CXXFLAGS, I added -fstack-check which caused several g++
versions to generate faulty code (which may or may not cause directly a
crash; valgrind saw them in both cases)
Thanks anyway,
regards,
Olivier.
Olivier Boudeville a =E9crit :
>Hi everybody,
>
>I am trying to debug a C++ library I developed that runs fine on some
>computers and fails badly on others.
>
>I use valgrind (valgrind-3.1.1 from gentoo) for that, but I have trouble
>understanding some of its messages :
>(extract of the output of '/usr/bin/valgrind -v ./testCeylanMostBasic
>2>&1 |more' on a computer where the program does not crash)
>
>=3D=3D18442=3D=3D Invalid write of size 4
>=3D=3D18442=3D=3D at 0x40D2F2D: _GLOBAL__I__ZN6Ceylan3URI17ProtocolSe=
paratorE
>(CeylanTypes.h:432)
>=3D=3D18442=3D=3D by 0x40D30E4: (within
>/home/sye/tmp-Ceylan-test-install/lib/libCeylan-0.3.so.0.0.3)
>=3D=3D18442=3D=3D by 0x4052388: (within
>/home/sye/tmp-Ceylan-test-install/lib/libCeylan-0.3.so.0.0.3)
>=3D=3D18442=3D=3D by 0x400B70C: call_init (in /lib/ld-2.3.6.so)
>=3D=3D18442=3D=3D by 0x400B7F1: _dl_init (in /lib/ld-2.3.6.so)
>=3D=3D18442=3D=3D by 0x400081E: (within /lib/ld-2.3.6.so)
>=3D=3D18442=3D=3D Address 0xBEFFCBA8 is not stack'd, malloc'd or (recen=
tly) free'd
>=3D=3D18442=3D=3D
>=3D=3D18442=3D=3D Invalid write of size 4
>=3D=3D18442=3D=3D at 0x40D2E5A:
>__static_initialization_and_destruction_0(int, int) (CeylanTypes.h:432)
>=3D=3D18442=3D=3D by 0x40D2F46: _GLOBAL__I__ZN6Ceylan3URI17ProtocolSe=
paratorE
>(CeylanTypes.h:432)
>=3D=3D18442=3D=3D by 0x40D30E4: (within
>/home/sye/tmp-Ceylan-test-install/lib/libCeylan-0.3.so.0.0.3)
>=3D=3D18442=3D=3D by 0x4052388: (within
>/home/sye/tmp-Ceylan-test-install/lib/libCeylan-0.3.so.0.0.3)
>=3D=3D18442=3D=3D by 0x400B70C: call_init (in /lib/ld-2.3.6.so)
>=3D=3D18442=3D=3D by 0x400B7F1: _dl_init (in /lib/ld-2.3.6.so)
>=3D=3D18442=3D=3D by 0x400081E: (within /lib/ld-2.3.6.so)
>=3D=3D18442=3D=3D Address 0xBEFFCB68 is not stack'd, malloc'd or (recen=
tly) free'd
>--18442-- REDIR: 0x42CCBF0 (strlen) redirected to 0x401D4B0 (strlen)
>--18442-- REDIR: 0x41BFF80 (operator new(unsigned)) redirected to
>0x401B870 (operator new(unsigned))
>
>(I can send the full valgrind log if it helps)
>
>What puzzles me is that, as far as I know,
>_GLOBAL__I__ZN6Ceylan3URI17ProtocolSeparatorE relates to "global
>constructors keyed to Ceylan::URI::ProtocolSeparator" (after a double
>c++filt), which is declared in CeylanUniformResourceIdentifier.h with
>
>"""
>namespace Ceylan
>{
> namespace URI
> {
>[..]=09
> extern const std::string ProtocolSeparator ;
>[..]
>"""
>
>
>and defined in CeylanUniformResourceIdentifier.cc
>
>"""
>const std::string Ceylan::URI::ProtocolSeparator =3D "://" ;
>"""
>
>Both are appropriate I think, and I ensured no other pre-main variable
>refers to ProtocolSeparator.
>Moreover, valgrind refers to "CeylanTypes.h:432" which is :
>
>"""
>typedef std::list<Ceylan::Uint16>::size_type ListSize ;
>"""
>
>(they do no seem related in any way, though)
>
>Finally, whenever I wrap valgrind in a shell script (to give it the
>exact same relevant options and redirect the output as on the command
>line), it crashes my program with a segmentation fault.
>
>Could anybody help me, notably with the interpretation of both "Invalid
>write of size 4" ?
>
>(if it helps :
> - library and test executable have been built with g++-3.3.6 on
>GNU/Linux with full warnings enabled and -g -ggdb -O0
> - > ldd testCeylanMostBasic
> linux-gate.so.1 =3D> (0xffffe000)
> libCeylan-0.3.so.0 =3D>
>/home/sye/tmp-Ceylan-test-install/lib/libCeylan-0.3.so.0 (0xb7f00000)
> libstdc++.so.5 =3D>
>/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libstdc++.so.5 (0xb7e21000)
> libgcc_s.so.1 =3D>
>/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libgcc_s.so.1 (0xb7e19000)
> libpthread.so.0 =3D> /lib/libpthread.so.0 (0xb7dc7000)
> libm.so.6 =3D> /lib/libm.so.6 (0xb7da4000)
> libc.so.6 =3D> /lib/libc.so.6 (0xb7c8e000)
> /lib/ld-linux.so.2 (0xb7feb000)
>)
>
>Thanks in advance for any hint,
>regards,
>
>Olivier.
>
>
>Using Tomcat but need to do more? Need to support web services, security=
?
>Get stuff done quickly with pre-integrated technology to make your job e=
asier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geroni=
mo
>http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D=
121642
>_______________________________________________
>Valgrind-users mailing list
>Val...@li...
>https://lists.sourceforge.net/lists/listinfo/valgrind-users
>
>
> =20
>
|