Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

Launch Configurations Reference

In this chapter:

What is a launch configuration?

To run or debug programs with the IDE, you must set up a launch configuration to define which programs to launch, the command-line options to use, and what values to use for environment variables. The configurations also define which special tools to run with your program (e.g. the Code Coverage tool, the Application Profiler, Kernel Logging, and the Memory Analysis tool).

The IDE saves your launch configurations so you can quickly reproduce the particular execution conditions of a setup you've done before, no matter how complicated.

Each launch configuration specifies a single program running on a single target. If you want to run your program on a different target, you can copy and modify an existing launch configuration. And you can use the same configuration for both running and debugging your program, provided that your options are the same.

Types of launch configurations

The IDE supports these default types of launch configurations:

C/C++ QNX QConn (IP) — (Profile, Run, and Debug)
If you're connecting to your target machine by IP, select this configuration (even if your host machine is also your target). You'll have full debugger control and can use the Application Profiler, Memory Analysis, Code Coverage, Mudflap, APS Options, and Kernel Logging tools. tools. Your target must be running qconn. Typically, You'll likely be using this type of launch configuration.
C/C++ Attach Local Application — (Debug)
If you're developing non-QNX C/C++ programs, you may create a C/C++ Attach Local Application launch configuration to attach gdb to the locally running process. You don't need to use qconn; the IDE launches your program through gdb.
C/C++ Local Application — (Run and Debug)
If you're developing non-QNX C/C++ projects, you may create a C/C++ Local launch configuration. You don't need to use qconn; the IDE launches your program through gdb.
C/C++ Postmortem debugger — (Debug)
If your program produced a dump file (via the dumper utility) when it faulted, you can examine the state of your program by loading it into the postmortem debugger. This option is available only when you select Debug. When you debug, you're prompted to select a dump file.
C/C++ QNX Attach to Remote Process via QConn (IP) — (Profile, Run, and Debug)
If you're connecting to your target machine by IP, select this configuration to connect to a remote process that is already running. This option let's you use the Application Profiler tool for profiling. Your target must be running qconn.
C/C++ QNX PDebug (Serial) — (Debug)
If you can access your target only via a serial connection, select this configuration. Rather than use qconn, the IDE uses the serial capabilities of gdb and pdebug directly. This option is available only when you select Debug.
GDB Hardware Debugging — (Debug)
If you want to connect to hardware debugging devices that support an integration with GDB, such as JTAG. In addition, this launch configuration lets you specify:
Launch Group — (Profile, Run, and Debug)
Let's you run multiple applications at the same time or in sequential order. By default, it runs in the mode that you selected when launching the application, and the IDE launches the applications in the order that they appear in the Launches list. You can specify a different target for each application; however, you must identify the target separately in each individual launch configuration for the applications you include in the list.
PhAB Application
If you wish to run a PhAB application, follow the steps for creating a C/C++ QNX QConn (IP) launch configuration.

Note: In addition to these configurations, you can include other launch configuration types, such as those for JTAG debugging. For general information about JTAG debugging, see Using JTAG debugging.” For information about installing and configuring the Lauterbach Trace32 In-Circuit Debugger launch Configuration type, see Lauterbach Trace32 In-Circuit Debugger, for the Abatron debugger, see Abatron BDI2000 Debugger, and for the Macraigor debugger, see Macraigor Usb2Demon Debugger.”

The main difference between the C/C++ QNX QConn (IP) launch configurations and the other types is that the C/C++ QNX QConn (IP) type supports the runtime analysis tools (QNX System Profiler and the QNX Memory Trace).

Running and debugging for the first time

You can use the same launch configuration to run or debug a program:

The Run and Debug menu items appear in the C/C++ perspective by default, but they may not appear in all perspectives. You'll need the Run-->Run… menu item to set up a launch configuration.

To include the menu item into your current perspective:

  1. From the main menu, select Window-->Customize Perspective.
  2. Select the Commands tab.
  3. Select the Launch checkbox in the Available command groups list if it is not currently selected for you.

    Customize Perspective - Commands

  4. Click OK.

Debugging a program the first time

To create a launch configuration to debug a program for the first time:

  1. In the C/C++ Projects or Navigator view, select your project.
  2. Select Run-->Debug Configurations….
  3. Select a launch configuration type:

    Launch Configurations dialog

    Typically, if you're connecting to your target via IP, you can select C/C++ QNX QConn (IP). If not, see the “Types of launch configurations” section in this chapter before deciding.


    Note: You can't create a local debug session with the QNX GDB Debugger. This debugger is available only on qconn for postmortem debugging.

  4. Click the New button.

    The dialog shows the various tabs for the launch configuration.

    Launch Configurations dialog

  5. In the Name field, type a name for the configuration.
  6. Fill in the details in the various tabs. For details about each tab, see the “Setting execution options” section in this chapter.
  7. Click Debug.

    Now, you can run (launch) and debug your program.


Note: You can also use the Debug As menu item to conveniently select a particular launch configuration and launch and existing debug configuration:

Debug As item


Running a program the first time

When you configure a program to run, you should also configure it to debug as well.


Note: There are fewer options for running programs than for debugging.

To run a program the first time:
Repeat the procedure for debugging a program (see “Debugging a program the first time”), with the following changes:

Note:

You can also use the Run As menu item to conveniently select a particular launch configuration:

Debug As item


The IDE also lets you run a program without creating a launch configuration, but the program's output doesn't appear in the Console view.

To run a program without using the launcher:

  1. After building the program, drag the executable from the Project Explorer view to a target listed in the Target File System Navigator view. (To learn more about the view, see the “Moving files between the host and target” in the Building OS and Flash Images chapter.)
  2. In the Target File System Navigator view, right-click your file and select Run. When the dialog appears, click OK. Your program runs.

Running and debugging subsequent times

Once you've created a launch configuration, running or debugging a program is as easy as selecting that configuration. You can do this in several ways:

Launching a selected program (fast)

To debug or run a program that you've created a launch configuration for:

  1. From the main menu, select Run-->Debug… or Run-->Run….
  2. In the left pane, select the launch configuration you created when you first ran or debugged your program.
  3. Click Debug or Run.

Launching from a list of favorites (faster)

If you have a program that you launch frequently, you can add it to the Debug or Run dropdown menu so you can launch it quickly.


Note: To use this method, you must have selected Display in favorites when you first created your launch configuration. If you didn't, edit the Display in favorites menu option under the Common tab. See “Setting execution options” in this chapter.

To debug or run a program using your favorites list:

  1. Do one of the following:
  2. Click Organize Favorites… and select all the launch configurations you want to specify as favorites. They will appear at the top of the menu:

    Launch Configuration dialog; running a program subsequent times (faster)

  3. Select your launch configuration from the list of favorites.

Launching the last-launched program (fastest)

To relaunch the last program you ran or debugged:
Press F11 or click the dropdown button (Icon: Menu dropdown) beside the Debug or Run icon, then select your launch configuration.

Setting execution options

Depending on the type of launch configuration you specify, the Launch Configurations dialog has several tabs:


Note: All of these tabs appear when you select the C/C++ QNX QConn (IP) type of launch configuration; only some tabs appear when you select the other types.

Main tab

This tab lets you specify the project and the executable that you want to run or debug. The IDE might fill in some of the fields for you:


Launch Configurations dialog; Main tab


The Main tab in the Launch Configuration dialog.

Different fields appear in the Main tab, depending on the type of configuration you're creating. Here are descriptions of all the fields:

Project
Type the name of the project that contains the executable you want to launch. You may also locate a project by clicking Browse…. You can create or edit launch configurations only for open projects.
C/C++ Application
Type the relative path of the executable's project directory (e.g. x86/o/Test1_x86). For QNX projects, an executable with a suffix of _g indicates it was compiled for debugging. You may also locate an available executable by clicking Search Project….
Priority/Scheduling Algorithm
Lets you specify the priority and scheduling for threads. Each thread can be given a priority and will be able to access the CPU based on that priority. If a low-priority thread and a high-priority thread both want to run, then the high-priority thread will be the one that gets to run. If a low-priority thread is currently running and then a high-priority thread suddenly wants to run, then the high-priority thread will take over the CPU and run, thereby preempting the low-priority thread.

For the scheduling options:

Target Options
General Options
If you're creating a C/C++ QNX PDebug (Serial) launch configuration, then you'll see the Stop in main option, which is selected by default. This means that after you start the debugger, it stops in main() and waits for your input.

Note: For serial debugging, make sure that the pseudo-terminal communications manager (devc-pty) is running on your target.

Serial Port Options
Here you can specify the serial port (e.g. COM1 for Windows hosts) and the baud rate, which you select from the dropdown list.

Arguments tab

This tab lets you specify the arguments your program uses and the directory where it runs.


Launch - Arguments tab


The Arguments tab in the Launch Configurations dialog.

C/C++ Program Arguments
Enter the arguments that you want to pass on the command line. For example, if you want to send the equivalent of myProgram -v -L 7, type -v -L 7 in this field. You can put -v and -L 7 on separate lines because the IDE automatically strings the entire contents together.
Working directory on target
The option Use default working directory is set on by default. This means the executable runs in the /tmp directory on your target. If you turn off this option, you can click Browse… to locate a different directory.

Environment tab

The Environment tab lets you set the environment variables and values to use when the program launches. For example, if you want to set the environment variable named PHOTON to the value /dev/photon_2 when you run your program, use this tab. Click New to add an environment variable.


Launch - Environment tab


The Environments tab in the Launch Configurations dialog.

Upload tab

The Upload tab lets you tell the IDE whether to transfer an executable from the host machine to the target. You use this tab if libraries have to be uploaded every time an application runs.


Launch - Download tab


The Upload tab in the Launch Configurations dialog.

You also have the option of not downloading any shared libraries to your target.

Upload executable to target
Send the executable to the target every time you run or debug.
Use executable on target
Make the IDE use the existing version of the executable on the target. If you select this option, you'll need to specify a Remote directory for the executable.
Remote directory
Show the remote directory of /tmp on your target. You can also click Browse… to locate a directory. Since the IDE doesn't know the location of your shared library paths, you must specify the directory containing any libraries.
Strip debug information before uploading
Remove the debug information from the executable being uploaded to the target.
Use unique name
Make your executable's filename unique (by appending a number) during each download session.
Upload shared libraries to the target
Transfer a shared library from the host machine to the target.
Upload
Select the shared libraries your program needs from the list.
Local path
Shows the local path to the library.
Remote directory
Shows the remote directory of the library on your target.
Strip
Remove debug information before downloading. By default, the Strip debug information before uploading option is selected. Deselect this option if you don't want the IDE to strip the executable you're uploading to your target.
Auto
Attempts to automatically find the required libraries.
Project…
Open a dialog to look in your workspace for libraries.
Add…
Add a new shared library path to the list.
Delete
Remove the selected shared library path from the list.
Remove uploaded components after session
Remove files that the IDE downloaded after each session. If you don't want the IDE to “clean up” after itself, then deselect this option.

Debugger tab

The Debugger tab lets you configure how your debugger works. To debug your application, you must use executables that are compiled for debugging. These executables contain additional debug information that let the debugger make direct associations between the source code and binaries generated from the source.

These options on the Debugger tab change, depending on the type of debugger you select:


Launch Configurations dialog; Debugger tab


The Debugger tab in the Launch Configurations dialog.


Note: The settings in the Debugger tab affect your executable only when you debug it, not when you run it.

Generic debugger settings

Debugger
The debugger dropdown list includes the available debuggers for the selected launch-configuration type. The list also varies depending on whether you're debugging a remote or a local target.
Stop on startup at
By default, this option is selected and the default location is main(). If you deselect it, the program runs until you interrupt it manually, or until it encounters a breakpoint.
Advanced
Click to show the Advanced Options dialog:

Advanced debug options

Enable these options if you want the system to track every variable and register as you step through your program. Disable the Variables option to manually select individual variables to work with in the Variables view in the debugger (see the Debugging Your Programs chapter). Disabling the Registers option works the same way for the Registers view.


Note: If you choose to track all the variables or registers, your program's performance may decrease.

Verbose console mode
For GDB, select Verbose console mode to see all of the commands sent to GDB, and all of the responses returned from GDB.
Use full path to set breakpoints
Set breakpoints if you have many files with the same base name in the project. When file names are identical but their paths are different, setting this option ensures that breakpoints are set for the appropriate file, as expected.

Debugger Options

The Main tab and Shared libraries tabs let you specify specific options for the debugger that you selected.

GDB command file
Specify a file for running gdb using the -command option (see the Utilities Reference).

You can use the pane to select specific libraries or use the Auto button to have the IDE attempt to select your libraries.

Verbose console mode
See all of the commands sent to GDB, and all of the responses returned from GDB.
Load shared library symbols automatically
Watch line-by-line stepping of library functions in the C/C++ editor. You may want to deselect this option if your target doesn't have much memory; the library symbols consume RAM on the target.
Use full path to set breakpoints
Set breakpoints if you have many files with the same base name in the project.
Stop on shared library events
Choose this option if you want the debugger to break automatically when a shared library or DLL is loaded or unloaded.

Source tab

The Source tab lets you specify where the debugger should look for source files. By default, the debugger uses the source from your project in your workspace, but you can specify source from other locations (e.g. from a central repository).


Launch - Source tab


The Source tab in the Launch Configurations dialog.

To specify a new source location:

  1. On the Source tab, click Add…. The Add Source Location dialog appears.

    Launch - Source tab - Add Source

  2. Select the type of source that you want to add to the lookup source path from the following:
    Absolute File Path
    An absolute path to a file in the local file system.
    File System Directory
    A directory in the local file system. If you wish to add source from outside your workspace, select the File System Directory path type, and click OK. Type the path to your source in the Select location directory field, or use the Browse button to locate your source.
    Path Mapping
    A path mapping.
    Project
    A project in the workspace.
    Workspace
    All projects in the workspace. If you wish to add source from your workspace, select the Workspace path type, or from a specific folder select Workspace Folder and then click OK.
    Workspace Folder
    A folder in the workspace.

    If you want to specify a mapping between directories, choose the Associate with option and enter the directory in the available field. For example, if your program was built in the C:/source1 directory and the source is available in the C:/source2 directory, enter C:/source2 in the first field and associate it with C:/source1 using the second field.

    If you want the IDE to recurse through the subdirectories to find the source, then select the Search subfolders option.

  3. After you click OK, you can remove or modify a source path by selecting a source lookup path from the list, and then clicking Remove or Edit.
  4. To change the order of source lookup paths by selecting a type, and then clicking Up or Down. To search for duplicates in your source locations, select the Search for duplicate source files on the path checkbox.
  5. Click Finish. The IDE adds the new source location.

Common tab

The Common tab lets you define where the launch configuration is stored, how you access it, and what perspective you change to when you launch.


Launch - Common tab


The Common tab in the Launch Configurations dialog.

Save as
When you create a launch configuration, the IDE saves it as a .launch file. If you select Local, the IDE stores the configuration in one of its own plugin directories. If you select Shared file, you can save it in a location you specify (such as in your project). Saving as a shared file lets you commit the .launch file to source control, such as CVS or Subversion, which allows others to run the program using the same configuration.
Local file
Saves the launch configuration locally.
Shared file
Specifies the path of, or browse to, a workspace to store the launch configuration file, and be able to commit it to CVS.
Display in favorites menu
Add configuration name to Run, Debug, or Profile menus for easy selection. You can have your launch configuration displayed when you click the Run, Debug, or Profile dropdown menus in the toolbar. To do so, check the Run, Debug, or Profile options under the Display in favorites menu heading.
Console Encoding
Specify the encoding scheme to use for console output.
Allocate Console (necessary for input)
Check to assign a console view to receive the output.
File
Specify the file name to save the output.
Workspace
Specifies the path of, or browse to, a workspace to store the output file.
File System
Specifies the path of, or browse to, a file system directory to store the output file.
Variables
Select variables by name to include in the output file.
Append
Select to append the output. Deselect this option to recreate the file each time.
Launch in background
Select this option to launch configuration in background mode. This option is enabled by default, letting the IDE launch applications in the background so that you can continue to use the IDE while waiting for a large application to be transferred to the target.

Tools tab

The Tools tab lets you add runtime analysis tools to the launch. To do this, click the Add/Delete Tool button at the bottom of the tab:


Launch Configurations dialog; tools tab


The Tools tab in the Launch Configurations dialog.

You can add the following tools (some launch options affect which tools are available):

Application Profiler
Lets you count how many times functions are called, who called which functions, and so on. For more information about this tool, see the Profiling Your Application chapter.

Application Profiler

Memory Analysis
Lets you track memory errors. For more information about this tool, see the Finding Memory Errors chapter.

Memory Analysis

Kernel Logging
Lets you perform a system wide profile to monitor all processes that execute on a specific set of CPUs.

Kernel Logging tool

Shared Libraries
Lets you add paths to shared library references.

Shared Library tool

Code Coverage
Lets you measure what parts of your program have run, and what parts still need to be tested. For more information about this tool, see the Code Coverage chapter.

Code Coverage

If you want the IDE to open the appropriate perspective for the tool during the launch, then check Switch to this tool's perspective on launch.