简体   繁体   中英

Linux - source files/lines doesn't appear when running valgrind

I am currently trying to get ride of some memory errors with valgrind but I am having some problems with the output informations, source files/lines numbers doesn't appears. So I have this kind of output:

==11656== by 0xA5A095: Class::method(T1, T2) (in /usr/local/bin/MyBinary)

I am compiling my program with the debug informations ( -g flag) and GCC 4.8.2 (also tried with clang 3.4) on my Ubuntu. I am using the cmake build system because I want to make several libraries and then make some binaries. I checked if the -g flag is present during compilation with make VERBOSE=1 and it is.

The binary I want to debug is linked with several libraries, the one that is important and need debugs informations is, libA, that is also linked with libB and libC. libA, libB and libC are libraries I make. They are also both compiled with debugs informations and statically linked each time.

So the dependency scheme is : MyBinary <- libA <- libB, libC.

The strange thing is that valgrind gives me the functions names and namespaces so I assume my binary and libraries are not stripped. Moreover, I checked retrieving the source file and line number from symbols in the binary(given nm and addr2line ) and the informations are here.

The flags used for compiling are : -g -std=c++11 , and for valgrind: --leak-check=full --track-origins=yes .

Am I missing some flags/options for the compilation, linking or for valgrind ? It would surprise me the problem comes from valgrind ...

Thank's for your time reading me.

I found out why it is not working. I didn't check that ... There was an other binary with the same name existing on my disk ... So, the question is not relevant any more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM