EG:
g++ -g *.cpp
gdb a.out
http://www.student.cs.uwaterloo.ca/~cs343/documents/C++GDBTutorial.pdf
valgrind is a programming tool for memory debugging, memory leak
detection, and profiling.
If you have a segmentation fault, run valgrind on your program to check
for any uninitialized values.
EG:
valgrind a.out
--
Patrick Lee
CS240 Tutor
Yes, valgrind is a wonderful (and free!) tool. I recommend the "quick
start guide" here: http://valgrind.org/docs/manual/quick-start.html
Tips:
-Compile with -g for gdb AND for valgrind
-Run valgrind with --leak-check=yes since memory leaks are probably what
you're after.
-All the sizes are in terms of bytes. For reference, a char is typically
1 byte, an int is typically 4, and a double is always 8 bytes.
-valgrind is really slow. Don't use big data on it! Start with very
small examples and build up slowly until you get some errors.
-Dan Roche
CS 240 Instructor, Section 003