CS 24000 Lecture Notes - Lecture 3: Gnu Debugger, Gnu Compiler Collection, Segmentation Fault
Document Summary
What is gdb: gdb is a debugger that helps you debug your program, the time you spend now learning gdb will save you days of debugging time, a debugger will make a good programmer a better programmer. Compiling a program for gdb: you need to compile with the -g option to be able to debug a program with gdb, the -g option adds debugging information to your program gcc g o hello hello. c. If your program has arguments, you can pass them after run. Stepping through your program: your program will start running and when it reaches main() it will stop, gdb, now you have the following commands to run your program step by step, (gdb) step. If it is a function call, it will enter into it: (gdb) next. It will run the next line of code and stop.