How to debug with valgrind
Line 1: | Line 1: | ||
− | Using | + | Using the 'valgrind' program helps to recognize memory errors. To debug with valgrind using the command line while inside the example directory, execute the following line: |
valgrind python cavity2D-incomstatic.py >debugtest.out | valgrind python cavity2D-incomstatic.py >debugtest.out | ||
− | debug process for "cavity2D-incomstatic.py" is saved in "debugtest.out". | + | The debug process for "cavity2D-incomstatic.py" is saved in "debugtest.out". Several valgrind options are accesible by using the following command: |
valgrind --help | valgrind --help | ||
− | + | So the following line could be a useful option for a thorough debug: | |
valgrind --leak-check=full python cavity2D-incomstatic.py >debugtest.out | valgrind --leak-check=full python cavity2D-incomstatic.py >debugtest.out | ||
− | There are some cases in which valgrind gives "Conditional jump or move depends on uninitialised value(s)" message | + | There are some cases in which valgrind gives a "Conditional jump or move depends on uninitialised value(s)" message where the origin of the error can be found some statements before. In those cases, the "--track-origins=yes" option can be very useful in finding the real source of error. |
valgrind --track-origins=yes python cavity2D-incomstatic.py >debugtest.out | valgrind --track-origins=yes python cavity2D-incomstatic.py >debugtest.out | ||
− | If instead of the command line, the | + | If instead of using the command line, the commands are written in "emacs", reading the output files can be much easier. |
[[Category:How To]] | [[Category:How To]] |
Revision as of 14:29, 16 July 2013
Using the 'valgrind' program helps to recognize memory errors. To debug with valgrind using the command line while inside the example directory, execute the following line:
valgrind python cavity2D-incomstatic.py >debugtest.out
The debug process for "cavity2D-incomstatic.py" is saved in "debugtest.out". Several valgrind options are accesible by using the following command:
valgrind --help
So the following line could be a useful option for a thorough debug:
valgrind --leak-check=full python cavity2D-incomstatic.py >debugtest.out
There are some cases in which valgrind gives a "Conditional jump or move depends on uninitialised value(s)" message where the origin of the error can be found some statements before. In those cases, the "--track-origins=yes" option can be very useful in finding the real source of error.
valgrind --track-origins=yes python cavity2D-incomstatic.py >debugtest.out
If instead of using the command line, the commands are written in "emacs", reading the output files can be much easier.