This is a cheatsheet of how to utilize GDB for cs50 and other applications through the command line

NOTES:

• GDB stands for global debugger
• It works on Linux OS, sometimes used with VI or VIM
• GDB only works on executable, not source files like .c
• Runs on the terminal, cmd prompt, bash, etc

Running GDB is done by the following, navigate to the file first using cd

At this point, can specify any argv[1] or argv[2] things to add on (inputs)

./copy, where copy is the executable file

add a break in the main function

R stands for run, runs the program

CTRL+C does not work to exit out of GDB

#### Debugger vs GDB

Debugger through CS50 is more-so on the IDE side

• Works on source file
• Compiles the program in real time

#### Resources

• http://cs50.stackexchange.com/questions/21681/how-do-you-pass-arguments-into-gdb-argv1-argv2/21682#21682, my question on stackoverflow great answer