TO build the code: make BUILD = TARGET_ --> Builds the code
What command to be used to compile source code with Valgrind. Any idea?
Command to run valgrind for C/C++ file valgrind --tool=memcheck --leak-check=yes --show-reachable=yes ./<file_name>
This is the output:
==16702== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 14 from 1)
==16702== malloc/free: in use at exit: 13,165 bytes in 414 blocks.
==16702== malloc/free: 1,219 allocs, 805 frees, 176,926 bytes allocated.
==16702== For counts of detected errors, rerun with: -v
==16702== searching for pointers to 414 not-freed blocks.
==16702== checked 108,004 bytes.
==16702==
==16702== 80 bytes in 1 blocks are definitely lost in loss record 1 of 4
==16702== at 0x4004405: malloc (vg_replace_malloc.c:149)
==16702== by 0x8095A91: xmalloc (in /bin/bash)
==16702== by 0x806AC84: execute_command_internal (in /bin/bash)
==16702== by 0x806C72F: execute_command (in /bin/bash)
==16702== by 0x805DE1A: reader_loop (in /bin/bash)
==16702== by 0x805CEE1: main (in /bin/bash)
==16702==
==16702==
==16702== 128 bytes in 1 blocks are still reachable in loss record 2 of 4
==16702== at 0x400579F: realloc (vg_replace_malloc.c:306)
==16702== by 0x8095AFC: xrealloc (in /bin/bash)
==16702== by 0x8067484: (within /bin/bash)
==16702== by 0x8067525: (within /bin/bash)
==16702== by 0x8066DD4: (within /bin/bash)
==16702== by 0x806712D: (within /bin/bash)
==16702== by 0x8067B92: print_simple_command (in /bin/bash)
==16702== by 0x806A3D6: execute_command_internal (in /bin/bash)
==16702== by 0x806C72F: execute_command (in /bin/bash)
==16702== by 0x805DE1A: reader_loop (in /bin/bash)
==16702== by 0x805CEE1: main (in /bin/bash)
==16702==
==16702==
==16702== 2,092 bytes in 4 blocks are still reachable in loss record 3 of 4
==16702== at 0x4004405: malloc (vg_replace_malloc.c:149)
==16702== by 0x8095B13: xrealloc (in /bin/bash)
==16702== by 0x8085F7C: (within /bin/bash)
==16702== by 0x8086146: fd_to_buffered_stream (in /bin/bash)
==16702== by 0x8086613: with_input_from_buffered_stream (in /bin/bash)
==16702== by 0x805CFC3: main (in /bin/bash)
==16702==
==16702==
==16702== 10,865 bytes in 408 blocks are still reachable in loss record 4 of 4
==16702== at 0x4004405: malloc (vg_replace_malloc.c:149)
==16702== by 0x8095A91: xmalloc (in /bin/bash)
==16702== by 0x8090EE1: set_default_locale (in /bin/bash)
==16702== by 0x805C19A: main (in /bin/bash)
==16702==
==16702== LEAK SUMMARY:
==16702== definitely lost: 80 bytes in 1 blocks.
==16702== possibly lost: 0 bytes in 0 blocks.
==16702== still reachable: 13,085 bytes in 413 blocks.
==16702== suppressed: 0 bytes in 0 blocks.
How can I compile and use commands in such a way that I get more file and line number and not (/bin/bash)?