|
From: Salvador E. T. <sal...@in...> - 2004-05-10 14:39:17
|
Valgrind version: 2.1.1 and 2.0.0 (can=B4t test CVS because it needs newe=
r=20
autotools)
Brief description: Valgrind hooks __builtin_delete but fails to hook=20
__builtin_new resulting in tons of wrong reports about "Mismatched=20
free() / delete / delete []".
System: Debian GNU/Linux Woody, gcc 2.95.4 *important*: libgcc is an=20
static library for Woody. GNU libc 2.2.5.
More info:
I get things like it:
=3D=3D32691=3D=3D Mismatched free() / delete / delete=20
[] =
=20
=3D=3D32691=3D=3D at 0x3C01A8DB: __builtin_delete=20
(vg_replace_malloc.c:128) =
=20
=3D=3D32691=3D=3D by 0x3C0A2319: TStringCollection::~TStringCollection=
(void)=20
(../classes/tstringc.cc:65) =20
=3D=3D32691=3D=3D by 0x80BB591: LoadTVMenuAndStatus(char *)=20
(../../tvision/include/tv/object.h:45) =20
=3D=3D32691=3D=3D by 0x80BB650: LoadMenuAndStatus(char *, int)=20
(../setedit/menuload.cc:1059) =20
=3D=3D32691=3D=3D Address 0x3C65C06C is 0 bytes inside a block of size 4=
4=20
alloc'd =20
=3D=3D32691=3D=3D at 0x3C01A2F5: malloc=20
(vg_replace_malloc.c:105) =
=20
=3D=3D32691=3D=3D by 0x80FF8F8: __builtin_new (in=20
/usr/src/setedit/makes/editor.exe) =
=20
=3D=3D32691=3D=3D by 0x80BB277: LoadTVMenuAndStatus(char *)=20
(../setedit/menuload.cc:963) =20
=3D=3D32691=3D=3D by 0x80BB650: LoadMenuAndStatus(char *, int)=20
(../setedit/menuload.cc:1059) =20
=3D=3D32691=3D=3D
As you can see valgrind thinks that I allocated with malloc and that I=B4=
m=20
deallocating with delete.
Something similar happends with new[]/delete[]:
=3D=3D32691=3D=3D Mismatched free() / delete / delete=20
[] =
=20
=3D=3D32691=3D=3D at 0x3C01A83F: free=20
(vg_replace_malloc.c:127) =
=20
=3D=3D32691=3D=3D by 0x80FFA43: __builtin_vec_delete (in=20
/usr/src/setedit/makes/editor.exe) =20
=3D=3D32691=3D=3D by 0x80803A3: TSetEditorApp::SetTitle(char const *, =
char=20
const *) (../setedit/editmain.cc:437) =20
=3D=3D32691=3D=3D by 0x8085154: main=20
(../setedit/editmain.cc:2868) =
=20
=3D=3D32691=3D=3D Address 0x3C66C1C4 is 0 bytes inside a block of size 2=
4=20
alloc'd =20
=3D=3D32691=3D=3D at 0x3C01A602: __builtin_vec_new=20
(vg_replace_malloc.c:112) =
=20
=3D=3D32691=3D=3D by 0x3C0AA491: TVIntl::getTextNew(char const *, bool=
)=20
(../classes/tvintl.cc:153) =20
=3D=3D32691=3D=3D by 0x80802EA: TSetEditorApp::SetTitle(char const *, =
char=20
const *) (../setedit/editmain.cc:421) =20
=3D=3D32691=3D=3D by 0x8085154: main (../setedit/editmain.cc:2868) =
ith=20
new[]/delete[]:
I=B4m confused about the fact that valgrind hooks some functions and fail=
s=20
with others.
I generated a map of my application (/usr/src/setedit/makes/editor.exe)=20
and the functions:
0x80FFA43: __builtin_vec_delete
0x80FF8F8: __builtin_new
Are statically linked, but the same is for __builtin_vec_new and=20
__builtin_delete.
I added some "printfs" to coregrind/vg_replace_malloc.c to see what is=20
trying to hook, I added this to the loop in init:
VALGRIND_INTERNAL_PRINTF("--> Reemplazando %s %p\n",
replacements[i].libname,
replacements[i].func);
Y get:
=3D=3D18807=3D=3D --> Reemplazando __builtin_new 0x3C01A314
=3D=3D18807=3D=3D --> Reemplazando __builtin_vec_new 0x3C01A560
=3D=3D18807=3D=3D --> Reemplazando __builtin_delete 0x3C01A848
=3D=3D18807=3D=3D --> Reemplazando __builtin_vec_delete 0x3C01A980
So valgrind is trying to hook all of them.
One thing that could be related to it is that when I compile=20
vf_replace_malloc.c I get warnings like this:
vg_replace_malloc.c:105: warning: `visibility' attribute directive ignore=
d
I consulted the gcc docs and "visibility" isn=B4t valid for gcc 2.95.
So I think that:
1) The ALIAS macro should be declared conditionaly checking gcc version.
2) It could have some relation.
SET
--=20
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Visit my home page: http://welcome.to/SetSoft or
http://www.geocities.com/SiliconValley/Vista/6552/
Alternative e-mail: se...@co... se...@ie...=20
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA Phone: +(5411) 4759 0013
|