What is GDB ?




What is GDB ?

  • GDB, short for GNU Debugger, is the most popular debugger for UNIX systems to debug C and C++ programs.
  • A debugger is a program that runs other programs, allowing the user to exercise control over these programs, and to examine variables when problems arise.
 What is Gdb

GDB Supported Languages

  • GNU Debugger helps you in getting information about the following:
    • If a core dump happened, then what statement or expression did the program crash on ?
    • If an error occurs while executing a function, what line of the program contains the call to that function, and what are the parameters ?
    • What are the values of program variables at a particular point during execution of the program?
    • What is the result of a particular expression in a program ?
  • It is actually a free software, which is released under the GNU GPL. This debugger is written in a C language.

Following are the various languages supported by the GDB :

  • Ada
    • Ada is a structured, statically typed, imperative, and object-oriented high-level programming language, extended from Pascal and other languages.
  • Assembly
    • In computer programming, assembly language, often abbreviated asm, is any low-level programming language in which there is a very strong correspondence between the instructions in the language and the architecture's machine code instructions.
  • C
    • C is a general-purpose, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, with a static type system.
  • Fortran
    • Fortran is a general-purpose, compiled imperative programming language that is especially suited to numeric computation and scientific computing.

How GDB Debugs ?

  • GDB allows you to run the program up to a certain point, then stop and print out the values of certain variables at that point, or step through the program one line at a time and print out the values of each variable after executing each line.
  • GDB uses a simple command line interface.

Note

  • Even though GDB can help you in finding out memory leakage related bugs, but it is not a tool to detect memory leakages.
  • GDB cannot be used for programs that compile with errors and it does not help in fixing those errors.
 GDB Summary

GDB Summary

There are quite a few good debuggers available in the market:

  • DBX Debugger
    • This debugger ships along with Sun Solaris and you can get complete information about this debugger using the man page of dbx, i.e., man dbx.
  • DDD Debugger
    • This is a graphical version of dbx and freely available on Linux. To have a complete detail, use the man page of ddd, i.e., man ddd.

You can get a comprehensive detail about GNU Debugger from the following link: Debugging with GDB



Related Searches to What is GDB ?