Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

NOTE: CentOS Enterprise Linux is built from the Red Hat Enterprise Linux source code. Other than logo and name changes CentOS Enterprise Linux is compatible with the equivalent Red Hat version. This document applies equally to both Red Hat and CentOS Enterprise Linux.

2.9. gdb, the Debugging Tool

GDB, the GNU debugger, has the principal purpose of allowing you to stop your program before it terminates. If your program terminates, the debugger helps you determine where it failed. To debug a file named file.c, first compile the file using gcc -g file.c as a command, where -g produces the debugging information. You then run the debugger. Refer to Section 3.4 Debug the Executable, for the steps involved in debugging.

Set breakpoints with the breakpoint command.

Navigate through the program with the step command or the next command.

The debugger debugs threads, signals, trace information, and other data in a program. Each time your program performs a function call, a block of data (the stack frame), which shows the location of the call, the arguments, and the local variables of the function is generated. The debugger allows you to examine the stack frame to get your program to work.

For more information, refer to Debugging with GDB.

 
 
  Published under the terms of the GNU General Public License Design by Interspire