Debugging compiled language applications

To create a launch configuration that will load a compiled language application for debugging, complete these steps:

  1. In a workbench perspective that offers the launch/debug/run action set (such as the Debug perspective), perform one of the following tasks:
    • Select Run > Debug from the workbench menu bar to open the Debug launch configurations dialog box.
    • Click the down arrow next to the workbench toolbar Debug push button and choose Debug from the list. This will open the Debug launch configurations dialog box.
  2. In the Debug launch configurations dialog box, perform one of the following tasks:
    • Select the Compiled Application node and click New.
    • Right-click the Compiled Application node and select New from the pop-up menu.
    • Double-click the Compiled Application node.
  3. This will cause the launch configuration tabs and entry fields to display on the right-hand side of the dialog box.
  4. In the Name field, enter a name of your choice for the configuration that you are creating.
  5. Select the Main tab to bring it to the foreground.
  6. In the Main tab Project field, enter the name of the project that contains the source for the application that you want to debug. If the application source is not in a workbench project, enter the name of the project that contains the application that you want to debug, and then indicate the source search path in the launch configuration Source tab page.

    Rather than enter a project name in the Project field, you can browse for the project by clicking Browse.

    Completion of this field is optional but recommended.

  7. Enter the full path and name of the program that you want to debug in the Program name field. Alternatively, you can browse for the program by clicking Browse. Completion of this field is mandatory.
  8. In the Program parameters field, enter any program parameters that are required by the application that you want to debug. This step is optional.
  9. Select the Debug initialization check box to debug code that executes before the main program entry point is called. You might want to do this if you are debugging C++ code and you need to debug the constructors for your globally-declared C++ class objects (because such objects are constructed before main is entered). If the check box is cleared, the program will run to the main entry point.
  10. To set the Source Lookup Path, select the Source tab and perform any of these tasks:
    • To add a source location, click Add. This will invoke the Add Source dialog box, in which you can select the type of source location to add. From the selection list in the Add Source dialog box, choosing Workspace will cause all projects in your workspace to be added to the source search path and choosing Debug engine will cause the debug engine to be added to the source search path. All other selections will result in a dialog box in which you can enter or browse for the source search path location that you want to use.
    • To remove an existing entry, select a source location and click Remove.
    • To set the order of existing entries, select a source location and click Up or Down to alter that location's placement.
      Note: In some cases, changing the placement of a location might not take effect until the next time the program is launched.

    If you want to search for all instances of the source filename in the source search path, select the Search for duplicate source files on the path check box. If you select this check box and the debugger finds multiple instances of the filename, you will be prompted by a dialog box to choose the correct source file.

  11. Select the Environment tab to bring it to the foreground. In the Environment page, you can set environment variables for your debug session. Settings that you make in this page will only affect your debug session.

    You might need to set environment variables for a variety of factors, for example, to specify the location of the executable for an application that is required for the debug session. To set environment variables in this page, perform any of these tasks:

    • By default, the environment variables that are set for your debug session are as follows:
      • If you launched the workbench from your system (for example, from Microsoft® Windows® Explorer), your system variables are default. These will not display in the Environment page.
      • If you launched the workbench from a command line or batch file with environment variables set, these will be the default environment variables used for the debug session.
    • To add an environment variable for the debug session, click the New button and then complete the New Environment Variable dialog box with the appropriate values. The environment variable will be added to the default environment variables.
    • To remove an environment variable for the debug session, select it from the Environment variables to set list and then choose the Remove button.
  12. Select the Common tab to bring it to the foreground. You can perform any of these tasks in the Common page:
    • If you want the launch configuration to be stored locally and available for a single user, ensure that the Local radio button is selected. If the launch configuration is to be stored as a file in the workspace and shared in a repository for team use, select the Shared radio button and enter the project location where you want the launch configuration to be stored in the Location of shared configuration field. Alternatively, you can browse for the project.
    • If you want the launch configuration to be displayed as a favorite debug configuration in the Debug push button favorites menu or the Debug menu Debug History list, select the Debug check box.
  13. If all information mandatory to the launch configuration has been provided, the Debug and Apply push buttons will be enabled. Clicking Apply will save the launch configuration, at which point you can choose to close the dialog box without launching the debug session or you can click Debug to launch a debug session using the new launch configuration. If you click Debug, any changes to the launch configuration will be saved and a debug session will be launched.

    After you have saved a debug launch configuration, you can edit it. For further information about editing debug launch configurations, see the related task.

    Tip: If you have not yet saved launch configuration settings and if you have made entries in the launch configuration settings that you want to remove or change, clicking Revert will remove all changes that you have made.
  14. If information mandatory to the launch configuration has not been provided or if there are errors in the information that you have provided, messages at the top of the dialog box will indicate what is missing.
  15. If you did not use the dialog box to launch a debug session (for example, you used it instead to create and save a launch configuration), click Close to exit the dialog box when you are finished working in it.
Related concepts
When to attach
Related tasks
Setting environment variables for debugging
Using compiled language debug launch configurations
Attaching to compiled language applications
Creating new launch configurations from existing launch configurations
Editing launch configurations
Removing launch configurations
Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.