GNU Debugger Tutorial
  • gnu_debugger - Tutorial
  • - Css
  • - W3css
  • gnu_debugger - Useful Resources
  • Gnu_debugger - Ebook Download


  • GNU Debugger


    The GNU Debugger GDB is a portable debugger that runs on many Unix-like systems and works for many programming languages, including Ada, C, C++, Objective-C, Free Pascal, Fortran, Go, and partially others.

    History


    GDB was first written by Richard Stallman in 1986 as part of his GNU system, after his GNU Emacs was "reasonably stable". GDB is free software released under the GNU General Public License GPL. It was modeled after the DBX debugger, which came with Berkeley Unix distributions.

    From 1990 to 1993 it was maintained by ] Now it is maintained by the GDB Steering Committee which is appointed by the Free Software Foundation.

    Technical details


    GDB offers extensive facilities for tracing and altering the execution of computer programs. The user can monitor and modify the values of programs' internal variables, and even call functions independently of the program's normal behavior.

    GDB target processors as of 2003 include: Altera Nios/Nios II, D10V, D30V, FR-30, MN10200, Stormy16, and Z8000. Newer releases will likely not support some of these. GDB has compiled-in simulators for even lesser-known target processors such like M32R or V850.

    GDB is still actively developed. As of version 7.0 new features include support for Python scripting and as of version 7.8 GNU Guile scripting as well. Since version 7.0, support for "reversible debugging" — allowing a debugging session to step backward, much like rewinding a crashed program to see what happened — is available.

    GDB offers a "remote" mode often used when debugging embedded systems. Remote operation is when GDB runs on one machine and the program being debugged runs on another. GDB can communicate to the remote "stub" that understands GDB protocol through a serial device or TCP/IP. A stub program can be created by linking to the appropriate stub files provided with GDB, which implement the target side of the communication protocol. Alternatively, gdbserver can be used to remotely debug the program without needing to change it in any way.

    The same mode is also used by KGDB for debugging a running Linux kernel on the source level with gdb. With KGDB, kernel developers can debug a kernel in much the same way as they debug application programs. It makes it possible to place breakpoints in kernel code, step through the code, and observe variables. On architectures where hardware debugging registers are available, watchpoints can be set which trigger breakpoints when specified memory addresses are executed or accessed. KGDB requires an additional machine which is connected to the machine to be debugged using a serial cable or Ethernet. On FreeBSD, it is also possible to debug using Firewire direct memory access DMA.

    The debugger does not contain its own UltraGDB, Xxgdb, , Dev-C++, Geany, GNAT Programming Studio GPS, KDevelop, Qt Creator, Lazarus, MonoDevelop, Eclipse, NetBeans, and Visual Studio can interface with GDB. GNU Emacs has a "GUD mode" and tools for VIM exist e.g. clewn. These offer facilities similar to debuggers found in IDEs.

    Some other debugging tools have been designed to work with GDB, such as memory leak detectors.