GDB, short for GNU Debugger, is the most popular debugger for UNIX systems to debug C and C programs.This tutorial provides a brief introduction on how to use GDB commands to ensure the programs are error-free. AudienceA debugger is regarded as the best friend of a software programmer. Hence, this tutorial will be useful for all those programmers who would like to develop robust and error-free programs. PrerequisitesThis tutorial assumes that you already know how to program in C and C and that you can compile and execute programs.
To start gdb, just type gdb at the unix prompt. Gdb will give you a prompt that looks like this: (gdb). From that prompt you can run your program, look at variables, etc., using the commands listed below (and others not listed). Or, you can start gdb and give it the name of the program executable you want to debug by saying gdb executable.