Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

solve memory problems checked by valgrind

Tags:

c

linux

valgrind

I have a problem, with valgrind; I dont know why when I check my program developped in C with valgrind, it couldn't display functions names (it display "???") where it found problems but this problems is not for all errors that it detects

==9803== ERROR SUMMARY: 24 errors from 6 contexts (suppressed: 0 from 0)
==9803== 
==9803== 1 errors in context 1 of 6:
==9803== Conditional jump or move depends on uninitialised value(s)
==9803==    at 0x40F7EC6: ???
==9803== 
==9803== 1 errors in context 2 of 6:
==9803== Conditional jump or move depends on uninitialised value(s)
==9803==    at 0x40F86F8: ???
==9803== 
==9803== 1 errors in context 3 of 6:
==9803== Conditional jump or move depends on uninitialised value(s)
==9803==    at 0x40F8166: ???
==9803== 
==9803== 1 errors in context 4 of 6:
==9803== Conditional jump or move depends on uninitialised value(s)
==9803==    at 0x40F805E: ???
==9803==

Have you a solution for displaying functions names with valgrind?

Thanks in advance

like image 488
developer Avatar asked Apr 19 '26 21:04

developer


1 Answers

Presumably these errors are occurring in libraries for which you have no debug symbols. It's easy to confirm: just do look at /proc/pidof my-binary/maps while the application is running.

08048000-08052000 r-xp 00000000 fe:00 42546         /bin/cat
08052000-08053000 rw-p 0000a000 fe:00 42546         /bin/cat
097fb000-0981c000 rw-p 00000000 00:00 0             [heap]
f73bc000-f75ac000 r--p 00000000 fe:02 281727        /usr/lib/locale/locale-archive
f75ac000-f75ad000 rw-p 00000000 00:00 0 
f75ad000-f76ed000 r-xp 00000000 fe:00 18416         /lib/i686/cmov/libc-2.11.2.so
f76ed000-f76ef000 r--p 0013f000 fe:00 18416         /lib/i686/cmov/libc-2.11.2.so
f76ef000-f76f0000 rw-p 00141000 fe:00 18416         /lib/i686/cmov/libc-2.11.2.so
f76f0000-f76f3000 rw-p 00000000 00:00 0 
f7705000-f7707000 rw-p 00000000 00:00 0 
f7707000-f7708000 r-xp 00000000 00:00 0             [vdso]
f7708000-f7723000 r-xp 00000000 fe:00 19087         /lib/ld-2.11.2.so
f7723000-f7724000 r--p 0001a000 fe:00 19087         /lib/ld-2.11.2.so
f7724000-f7725000 rw-p 0001b000 fe:00 19087         /lib/ld-2.11.2.so
ffb6e000-ffb83000 rw-p 00000000 00:00 0             

This clearly shows the addresses of the code sections (marked as r-xp) of each shared library. Just find the range matching the addresses you see and you'll at least know which library is responsible.

like image 85
Kristof Provost Avatar answered Apr 22 '26 11:04

Kristof Provost