Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
compare webbrowser
Freenet DSL
Who's Online
10 user(s) are online (10 user(s) are browsing encyclopedia)

Members: 0
Guests: 10

more...
browser tip
Unix Befehle
manual of unix befehle
recommendation!
Sponsored
partner

GNU Debugger

The GNU Debugger, usually called just GDB, is the standard Debugger for the GNU software system. It is a portable debugger that runs on many Unix-like systems and works for many programming languages, including C programming language, C plus plus, and Fortran programming language. Originally written by Richard Stallman in 1988, GDB is free software released under the GNU General Public License.

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 function (programming) independently of the program s normal behavior.

The debugger does not contain its own graphical user interface, and defaults to a command-line interface. However, several front-ends have been built for it, such as Data Display Debugger, GDBtk/Insight and the GUD mode in Emacs. These offer facilities similar to debuggers found in integrated development environments.

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

GDB target processors (as of 2003) include: DEC Alpha, ARM architecture, Hitachi H8, System/370, System 390, X86 and X86-64, Itanium Itanium , Motorola 68000, MIPS architecture,PA-RISC, PowerPC, SuperH, SPARC, VAX.

Lesser-known target processors supported in the standard release have included A29K, Advanced RISC Computing, AVR, CRIS, D10V, D30V, FR-30, FR-V, Intel i960, M32R, Motorola 68HC11, Motorola 88000, MCORE, MN10200, MN10300, 320xx microprocessor, Stormy16, V850, VAX, and Zilog Z8000. (Newer releases will likely not include some of these.)

= An example session =

This is an example GDB session on the example program in Stack trace:

GNU gdb Red Hat Linux (6.3.0.0-1.21rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type show copying to see the conditions. There is absolutely no warranty for GDB. Type show warranty for details. This GDB was configured as i386-redhat-linux-gnu ...Using host libthread_db library /lib/libthread_db.so.1 .

(gdb) run Starting program: /home/sam/programming/crash Reading symbols from shared object read from target memory...done. Loaded system supplied DSO at 0xc11000 This program will demonstrate gdb

Program received signal SIGSEGV, Segmentation fault. 0x08048428 in function_2 (x=24) at crash.c:22 22 return *y; (gdb) edit (gdb) shell gcc crash.c -o crash -gstabs+ (gdb) run The program being debugged has been started already. Start it from the beginning (y or n) y warning: cannot close shared object read from target memory : File in wrong format `/home/sam/programming/crash has changed; re-reading symbols. Starting program: /home/sam/programming/crash Reading symbols from shared object read from target memory...done. Loaded system supplied DSO at 0xa3e000 This program will demonstrate gdb 24 Program exited normally. (gdb) quit

The program is being run. After the cause of the segmentation fault is found, the program is edited to use the correct behavior. The corrected program is recompiled with GCC and then run.

= References =

  • Richard Stallman, Roland Pesch, Stan Shebs, et al., Debugging with GDB (Free Software Foundation, 2002) ISBN 1882114884
  • , 2003) ISBN 159327002X
  • = External links =

    *[http://www.gnu.org/software/gdb/gdb.html GDB homepage] *[http://sources.redhat.com/gdb/current/onlinedocs/gdb.html Debugging with GDB] *[http://sources.redhat.com/gdb/current/onlinedocs/gdbint.html GDB Internals]