Valgrind will not return the original lines!

I tried to run valgrind (memcheck and massif) in the application that I wrote, but all I return is the addresses for the functions to be performed.

---------------------------------
Context accounted for  0.6% of measured spacetime
  0x805F29A: (within prog_name)
  0x8141740: (within prog_name)

Called from:
   0.6% : 0x812E077: (within prog_name)

---------------------------------
Context accounted for  0.5% of measured spacetime
  0x805F29A: (within prog_name)
  0x81418FB: (within prog_name)

Called from:
   0.5% : 0x812E077: (within prog_name)

I compiled my application with the -g flag to put debugging symbols. Is there another reason valgrind will not show the original string?

EDIT: valgrind version 3.2.1-Debian; g ++ 4.3.1

+5
source share
4 answers

I found that during compilation I went through the flags -gand -ggdbup g++. Omitting the flag -g, this problem has disappeared.

+8
source

There are several possible reasons:

  • , ( , ),
  • JIT- ( ).

file prog_name? "", . , , . GDB , 0x805F29A:

gdb prog_name
(gdb) info symbol 0x805F29A
+2

, .

- show-reachable - , , .

-

+1

For other readers with a similar problem (I had the same, but my compiler options, where good): It turns out that valgrind needs a path to the executable, if you don’t give it, then it will work fine, but it won’t give you a number lines. In my case, the executable was in another directory that was in my PATH, but in order to get information about the line that I had to run

valgrind --leak-check = full path_to_myprogram / myprogram

+1
source

All Articles