Development Tools

General References


We recommend using make to automate some aspects of software development! Here are some links to information and tutorials on the web:


gdb is a command-line debugger useful for debugging C and C++ programs. Here are two sources of documentation.

Memory leaks

Valgrind is a debugging and profiling tool can automatically analyze a compiled C++ program for memory leaks and other bugs such as double deletes, unitialized variables, etc. Your program will slow down noticeably, so take appropriate steps, such as running with small input sizes. The manual page are are online and also available on ieng6. Tutorials for valgrind are available online, see, for example, valgrind's web site at including the Quick Start Guide.

Here is an easy way to use valgrind. Suppose you have a compiled C++ executable program foo in the current working directory. Then running

valgrind ./foo

will run foo, printing the results of the checks valgrind did. If foo was compiled using the -g flag to g++, valgrind will be able to print the line numbers of statements that are involved in bugs that it has found. If want to see more detailed information about memory leaks, run

valgrind --tool=memcheck --leak-check=yes foo

The output from valgrind's analysis can be lengthy and can be hard to read, especially if your program is also printing to the terminal. You may find it more convenient to divert valgrind's output to a file rather than to the terminal.

valgrind --log-file=out ./foo

You can then read the file in the editor, or search it with grep.


Gprof is a program profiler that allows you to see where your code is spending its time. On-line documentation is plentiful and here are a few sources of information:

Maintained by [Sun Mar 29 12:33:47 PDT 2015]