From: Alex I. <ale...@in...> - 2003-06-04 22:59:22
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> Gentlemen, <p>I am still having issues with __builtin_new not being intercepted by Valgrind. Jeremy Fitzhardinge gave me some suggestions, but it did not solve the issue. Here is the problem: when I am compling certain classes, the compiler generates references to __builtin_new (vec_new, delete, vec_delete) in the object file. When this object file is linked into executable, the compiler resolves the __builtin* references from libgcc.a, where they are defined as "W" symbols. <p>As a result, Valgrind does NOT intercept those __builtin* functions, and only catches malloc() and free() calls when these classes are used. As you can imagine, a swarm of musmatched free/delete/delete[] is evoked, plus the validity of memory checks probably becomes questionable. <p>Now, this is happening when I am using gcc 2.95.3 ( and g++ as linker). If I compile with gcc 3.2, references to __builtin* are not generated, instead it generated references to "operator new" and its buddies - that works well with Valgrind. Unfortunately, I cannot compile my system with 3.2 - I am stuck with 2.95.3 for the time being. There is a lot of code in the system that does not compile with 3.2 and fixing the code is not a choice (it's millions of lines). <p>I am attaching a cheesy test case - definition of 3 classes plus two object files generated by 2.95.3 and 3.2 compilers. Please, if anyone can give me a hint how this problem may be circumvented, that would be awesome and merit at least a six-pack! :) <p>Looking forward to suggestions! <br>Regards, <br>Alex Ivershen <pre>-- Alex G. Ivershen Inet Technologies, Inc. Network Products Dept. 1500 N. Greenville Ave. Inet Technologies Inc. Richardson, TX 75081 Phone: +1-469-330-4295 USA</pre> </html> |