What is GDB?
GDB or GNU Debugger is GNU project which helps to debug software applications and analyze what is happening during program execution.
- It helps to:
- investigate improper behavior of your program.
- find cause of logical error which is hard to find just by looking at source code.
- analyze crash occuring in your application.
How does GDB help?
GDB gives you control over your program execution.
- You can:
- stop/pause program execution by specifying conditions
- when your program is paused, you can analyse state of program, check values of variables and registers
- change values of variables/registers to see the impact on program behavior and this you can do without modifying source code
So GDB is not some magic spell which will debug your program automatically but Its weapon which you can use to find out cause of bug.
Supported Programming Languages
Currently GDB supports C, C++, D, Go, Objective-C, Fortran, Java, OpenCL C, Pascal, assembly, Modula-2, and Ada languages. Now you would have brief idea about what is GDB and how it can be your savior when something goes wrong in your program. Lets goto next section which describes how to install GDB.