Document Number 323269-002US
Intel® C++ Composer XE 2011, Intel® Fortran Composer XE 2011 - Linux* OS, Mac OS* X
Get started using the debugger by 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.
This document assumes that all stated technical requirements are satisfied. All program examples are created with the Intel® C++ Compiler. To change the set-up, an experienced engineer must make adjustments accordingly.
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; }
The Intel Debugger does not support position independent executable (pie).
On some systems the compiler option -fpie is set by default. Use -fno-pie to disable pie.
Before compiling you must set the environment variables as described in the compiler User Guide.
Compile the application:
On Linux* OS, compile the application using the following command:
icc -debug -O0 helloworld.c -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
Open a shell and change to the working directory.
Compile the application:
On Linux* OS, compile the application using the following command:
ifort -debug -O0 helloworld.f90 -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.
To start the debugger:
The debugger starts running.
To open the executable file using the GUI:
The debugger opens helloworld.
To open the executable file using the command line:
Enter the following command:
(idb) file helloworldThe debugger opens helloworld.
To display the source file using the GUI:
The Source window displays the source code and sets the scope appropriately.
To display the source file using the command line:
Enter the following command:
(idb) list mainThe debugger displays the source code of the main function in helloworld.
To run the application, choose one of the following:
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 does not contain any code to stop program execution, you must use breakpoints to stop the application.
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, 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.
A breakpoint is now set at main.
The application should stop at the breakpoint you set.
The debugger displays all existing breakpoints.
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.
To exit the debugger:
The debugger and all output files are closed.
See the Intel® Debugger Online Help for more detailed information.
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(R) 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.
Cilk and Intel are trademarks of Intel Corporation in the U.S. and/or other countries.
* Other names and brands may be claimed as the property of others.
Copyright (C) 2001-2011, Intel Corporation. All rights reserved.