Document number: 319697-005US
The Intel® Debugger supports debugging applications written in C, C++, Fortran and Assembly languages.
This document helps you get started using the debugger by taking you through building a simple application and executing all the necessary steps to begin debugging, as well as several basic debugging tasks.
The information here is applicable to both the GUI-based version of the debugger, and the command-line version. The GUI-based version is available on systems based on based on IA-32 or Intel® 64 architecture running Linux* OS.
All technical requirements must be satisfied. All program examples are created with the Intel® C++ Compiler or the Intel® Fortran Compiler.
The Intel® Debugger graphical environment is a Java* application and requires a Java Runtime Environment (JRE) to execute. See the Release Notes for the exact requirements.
For other technical requirements, see the installation guide and Release Notes for the Intel® Debugger.
A simple Hello World application can demonstrate some of the debugger's basic features.
Create a new file named helloworld.c in a working directory. Add the following code to helloworld.c:
#include <stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
Before compiling you must set the environment variables as described in the compiler User Guide.
icc -debug -O0 helloworld.c -o helloworld
First, create an object file with debug information using the following command:
icc -debug -O0 -c helloworld.c -o helloworld.o
Then compile the application using the following command:
icc -debug -O0 helloworld.o -o helloworld
Following successful compilation, the compiler creates an executable named helloworld in the working directory.
Create a new file named helloworld.f90 in a working directory. Add the following code to helloworld.f90:
program main
print *,"Hello World!"
end program main
ifort -debug -O0 helloworld.f90 -o helloworld
First, create an object file with debug information using the following command:
ifort -debug -O0 -c helloworld.f90 -o helloworld.o
Then compile the application using the following command:
ifort -debug -O0 helloworld.o -o helloworld
Following successful compilation, the compiler creates an executable named helloworld in the working directory.
On systems based on IA-32 or Intel® 64 architecture running Linux* OS, the debugger runs in GUI mode by default. You can also start the debugger in command line mode on these systems by specifying idbc instead of idb in the command line.
On all other systems, the debugger only runs in command line mode.
The idb command is enabled when you run the script that sets up the compiler environment as described in the Getting Started document for the compiler.
Enter the following command in a shell:
idb
The debugger starts running.
The debugger opens helloworld.
Enter the following command:
(idb) file helloworld
The debugger opens helloworld.
The Source Files window appears, displaying a list of the project source files to be debugged.
The Source window displays the source code and sets the scope appropriately.
Enter the following command:
(idb) list main
The debugger displays the source code of the main function in helloworld.
The application runs, and displays Hello World! in the shell that spawned the debugger, and the program exits.
In a case such as this, in which the application doesn't contain any code to stop program execution, you must use breakpoints to stop the application.
In this section, you set and then delete a breakpoint at the main function.
In the Source window, the debugger indicates lines of code on which you can set breakpoints with a blue dot at the start of the line.
The line pointer is set to this line, and the pop-up menu of the window appears.
Alternatively, you can set a breakpoint by double-clicking the blue dot.
A breakpoint is now set at main, indicated by a red stop-sign.
The application should stop at the breakpoint you set.
The line pointer is set to this line, and the pop-up menu of the window appears.
Alternatively, you can delete a breakpoint by double-clicking the stop sign.
You have deleted the breakpoint you set. The blue dot has replaced the stop-sign.
The application runs, and displays Hello World! in the shell that spawned the debugger, and the program exits.
(idb) break main
A breakpoint is now set at main.
The application should stop at the breakpoint you set.
(idb) info breakpoints
The debugger displays all existing breakpoints.
(idb) delete breakpoint 1
You have deleted the breakpoint you set.
The application runs, and displays Hello World! in the shell that spawned the debugger, and the program exits.
The debugger and all output files are closed.
See the Intel® Debugger Online Help for more detailed descriptions of commands.
You can also use the help command by entering the following at the debugger command prompt:
(idb) help
INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL® PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS OTHERWISE AGREED IN WRITING BY INTEL, THE INTEL PRODUCTS ARE NOT DESIGNED NOR INTENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A SITUATION WHERE PERSONAL INJURY OR DEATH MAY OCCUR.
Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked reserved or undefined. Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information.
The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.
Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.
Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or by visiting Intel's Web Site.
Intel processor numbers are not a measure of performance. Processor numbers differentiate features within each processor family, not across different processor families. See http://www.intel.com/products/processor_number for details.
BunnyPeople, Celeron, Celeron Inside, Centrino, Centrino Atom, Centrino Atom Inside, Centrino Inside, Centrino logo, Core Inside, FlashFile, i960, InstantIP, Intel, Intel logo, Intel386, Intel486, IntelDX2, IntelDX4, IntelSX2, Intel Atom, Intel Atom Inside, Intel Core, Intel Inside, Intel Inside logo, Intel. Leap ahead., Intel. Leap ahead. logo, Intel NetBurst, Intel NetMerge, Intel NetStructure, Intel SingleDriver, Intel SpeedStep, Intel StrataFlash, Intel Viiv, Intel vPro, Intel XScale, Itanium, Itanium Inside, MCS, MMX, Oplus, OverDrive, PDCharm, Pentium, Pentium Inside, skoool, Sound Mark, The Journey Inside, Viiv Inside, vPro Inside, VTune, Xeon, and Xeon Inside are trademarks of Intel Corporation in the U.S. and other countries.
* Other names and brands may be claimed as the property of others.
Copyright © 2001-2009, Intel Corporation. All rights reserved.
Portions Copyright © 2001, Hewlett-Packard Development Company, L.P.