Getting Started with the Intel® Debugger

Document Number 323269-002US

Intel® C++ Composer XE 2011, Intel® Fortran Composer XE 2011 - Linux* OS, Mac OS* X

Legal Information

Overview: Getting Started

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.

Note iconNote

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.

Technical Requirements

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.

Building the Sample Code

A simple Hello World application can demonstrate some of the debugger's basic features.

To prepare helloworld in C:

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;
 }

Note iconNote

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.

To compile helloworld.c:

Before compiling you must set the environment variables as described in the compiler User Guide.


  1. Open a shell and change to the working directory.
  2. 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.

To prepare helloworld in Fortran:

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 

To compile helloworld.c:


  1. Open a shell and change to the working directory.

  2. 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.

Starting the Debugger

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.

Note iconNote

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:

Enter the following command in a shell: idb

The debugger starts running.

Opening the helloworld Executable

To open the executable file using the GUI:

  1. In the debugger, select File > Open Executable ....
  2. Click the Browse button, navigate to your working directory and select the helloworld executable file.
  3. Click OK.

The debugger opens helloworld.

To open the executable file using the command line:

Enter the following command:

(idb) file helloworld

The debugger opens helloworld.

Displaying the Source File

To display the source file using the GUI:

  1. Select View > Source Files.

    The Source Files window appears, displaying a list of the project source files to be debugged.

  2. Double-click helloworld.c or helloworld.f90.

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 main

The debugger displays the source code of the main function in helloworld.

Running the Application

To run the application, choose one of the following:

  1. Select Run > Run or Continue from the debugger menu.
  2. Enter run on the command line.

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.

Setting and Deleting a Breakpoint

Setting and Deleting a Breakpoint - GUI

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.

  1. To set a breakpoint in the Source window:
    1. Right-click a line of code that contains a blue dot.

      The line pointer is set to this line, and the pop-up menu of the window appears.

    2. Select Create Breakpoint.

      Alternatively, you can set a breakpoint by double-clicking the blue dot.

      A breakpoint is now set, indicated by a red stop-sign.

    3. Run the application again.

      The application should stop at the breakpoint you set.

  2. To delete the breakpoint:
    1. Right-click a line of code that contains a stop sign.

      The line pointer is set to this line, and the pop-up menu of the window appears.

    2. Select Delete Code Breakpoint.

      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.

    3. Run the application again.

      The application runs, and displays Hello World! in the shell that spawned the debugger, and the program exits.

Setting and Deleting a Breakpoint - Command-line

  1. To set a breakpoint:
    1. Enter the following command: (idb) break main

      A breakpoint is now set at main.

    2. Enter run to run the application again.

      The application should stop at the breakpoint you set.

  2. To delete the breakpoint:
    1. List the IDs of all existing breakpoint by entering the following command: (idb) info breakpoints

      The debugger displays all existing breakpoints.

    2. Identify the ID of the breakpoint you want to delete. If you have not set any other breakpoints since starting the debugger, there is only one breakpoint, and its ID is 1.
    3. Delete the breakpoint by entering the following command: (idb) delete breakpoint 1

      You have deleted the breakpoint you set.

    4. Run the application again.

      The application runs, and displays Hello World! in the shell that spawned the debugger, and the program exits.

Exiting the Debugger

To exit the debugger:

Select File > Exit or enter quit.

The debugger and all output files are closed.

Further Information

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

Legal Information

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.