GDB Short Course

1. You start it by typing 'gdb myfile' at the prompt (no quotes), where myfile is the executable that your makefile compiled to. (eg., "dlist")

2. Once inside gdb, you can set up breakpoints in specific places, by using the 'b' command:

You can do fancier stuff, but these two are very useful.

3. To run your program, type, 'run' at the gdb prompt.

4. If the program crashes from a logical error (seg fault, or stack overflow or something), gdb will tell you the line it crashed on. Useful for debugging.

5. To step through the execution of your program one line at a time, type 'n' at the gdb prompt, after you've started it running.

6. To see the value/state of any variable at any time in execution, type 'print variable' at the gdb prompt. (eg., print first->getValue() would return the value of the link that first was pointing at.)

7. The last command that you told gdb to execute will continue to be it's default command until you change it. (eg., you set up a breakpoint in the Remove function, when gdb arrived there, it let you press 'n' to execute the code one line at a time, and then you decided you wanted to see the value of the first pointer, so you did step 6. When you finished looking at it (and wondering how it ended up with that value), you wanted to continue with the line-by-line execution. To do this, you must press 'n' again. Otherwise, it'll just keep printing out the value of the first pointer.)