|
From: Alexander P. <gl...@go...> - 2009-10-01 15:44:58
|
Oh, and running the same binary without any suppressions and the
demangling turned off prints the following report:
$ valgrind --demangle=no ./merror
...
==9457== Conditional jump or move depends on uninitialised value(s)
==9457== at 0x1F7B: _ZN3Foo3barEv (in ./merror)
==9457== by 0x1F2A: main (in ./merror)
...
That means that the same internal representation of the function name
is printed, while the real function name is:
$ nm merror | grep _ZN3Foo3barEv
00001f32 T __ZN3Foo3barEv
The only difference is in the leading underscore, but I still find
this a bit confusing.
PS: regarding the "function names with the gcc mangling scheme" in the
previous letter -- this is something platform-specific rather than
gcc-specific. Sorry for being unclear.
On Thu, Oct 1, 2009 at 7:36 PM, Alexander Potapenko <gl...@go...> wrote:
> Hi everyone,
>
> It appears that the suppressions generated by Valgrind on Mac OS
> contain function names with the gcc mangling scheme (ok for Linux, but
> invalid for Mac OS).
> For example, for the following code:
>
> -------------------------
> #include <stdio.h>
>
> struct Foo {
> void bar() {
> int *a = new int;
> *a = 12345;
> delete a;
> a = new int;
> if (*a == 12345) printf("67890\n");
> }
> };
>
> int main() {
> Foo foo;
> foo.bar();
> return 0;
> }
> -------------------------
>
> valgrind --gen-suppressions=all produces the following suppression:
>
> -------------------------
> {
> <insert_a_suppression_name_here>
> Memcheck:Cond
> fun:_ZN3Foo3barEv
> fun:main
> }
> -------------------------
>
> This suppression really works on Mac OS, but _ZN3Foo3barEv can't be
> demangled with c++filt on this platform (it should be
> "__ZN3Foo3barEv")
>
> The question is: is it the bug or a feature? Do the suppressions on
> every platform rely on the same mangling algorithm?
>
> Thanks,
> Alexander Potapenko
> Software Engineer
> Google Moscow
>
--
Alexander Potapenko
Software Engineer
Google Moscow
|