I'm currently using ptxdist 2015.10.0 and I've selected valgrind as a built-in option in the 'Debug Tools' using menuconfig.  Valgrind is then installed in my image at /usr/bin/valgrind.  However, it is currently not usable since the available glibc is too optimized, resulting in the following message.

> 

>             valgrind:  Fatal error at startup: a function redirection

>             valgrind:  which is mandatory for this platform-tool combination

>             valgrind:  cannot be set up.  Details of the redirection are:

>             valgrind: 

>             valgrind:  A must-be-redirected function

>             valgrind:  whose name matches the pattern:      strcmp

>             valgrind:  in an object with soname matching:   ld-linux-armhf.so.3

>             valgrind:  was not found whilst processing

>             valgrind:  symbols from the object with soname: ld-linux-armhf.so.3

>             valgrind: 

>             valgrind:  Possible fixes: (1, short term): install glibc's debuginfo

>             valgrind:  package on this machine.  (2, longer term): ask the packagers

>             valgrind:  for your Linux distribution to please in future ship a non-

>             valgrind:  stripped ld.so (or whatever the dynamic linker .so is called)

>             valgrind:  that exports the above-named function using the standard

>             valgrind:  calling conventions for this platform.  The package you need

>             valgrind:  to install for fix (1) is called

>             valgrind: 

>             valgrind:    On Debian, Ubuntu:                 libc6-dbg

>             valgrind:    On SuSE, openSuSE, Fedora, RHEL:   glibc-debuginfo

>             valgrind: 

>             valgrind:  Cannot continue -- exiting now.  Sorry.

 

I've found a couple of references to the optimization being the culprit, such as https://sourceforge.net/p/valgrind/mailman/message/30887009/

> 

>             ...

>             Very probably these are due to calls on strlen() or memcpy() which have been

>             expanded inline because of aggressive optimization ("#include <string.h>"

>             compiled with -O2 or -O3.)

>             ...

 

 

Is there a method of configuring glibc to build un-optimized ( below -O2) for use with the valgrind tool?

Can the valgrind selection automatically trigger this un-optimized build?

Or, if there are other suggestions for addressing this issue, I’d like to hear them.

 

Thanks,

- Jason Crim