8. Executing

8.1. Creating Launch Configurations for Native Ada Applications

Ada applications can be executed natively by creating and applying either an External Tools launch configuration or a C++ Application launch configuration. Remember that launch configurations can be reused indefinitely; they need not be created anew each time a given application is to be executed.

Although not mandatory, building your project beforehand will facilitate creating the corresponding launch configuration. In particular, it will make it possible to browse and search for some of the required entries instead of manually entering the values.

8.1.1. Creating A C++ Launch Configuration

First, open the Run configuration dialog. Select “Run Configurations…” from the Run menu, or click on the down-arrow next to the Run button on the toolbar and make the same selection there.

run menu open run config menu

The following dialog box will appear. (In this figure there are no existing user-defined launch configurations; yours may have some already.)

initial run dialog

In the left-hand pane of the dialog, double-click on “C/C++ Application.”

If you had a project actively selected in the GNAT Project Explorer when you double-clicked, Eclipse (really, the CDT launch facility) will have automatically filled in the Main page on the right of the dialog. Otherwise, you should see an empty new configuration, like the following:

new empty C++ configuration

Using the tabbed dialog on the right, you will specify various different configuration options. For instance you specify the name of the configuration, the executable you wish to run, the arguments you wish to pass to it when it’s launched, if any, the environment under which it will run, and so on.

When everything necessary is correctly specified, press Apply. The new launch configuration name will appear in the list of known configurations and the page will appear similar to the figure below. You can now press Close to exit the dialog; the new launch configuration is ready to use. Alternatively, you can launch the application by pressing Run. We discuss launching in Executing Native Ada Applications

C++ config dialog main page

8.1.2. Creating an External Tools Launch Configuration

To create a new External Tools launch configuration, use the External Tools dialog, which can be invoked using either the Run menu or the External Tools button and selecting the Open External Tools Dialog… entry. The following figure illustrates use of the Run menu:

run menu open external tools dialog

Using the External Tools button on the button bar is shown in this figure:

toolbar open external tools dialog

Once invoked, the External Tools dialog page will pop up. Initially, when no launch configurations have yet been created, it will appear as follows. Note the buttons above the list of configurations on the left of the page. Their descriptions are on the right side of the page.

empty external tools dialog

Create a new configuration by selecting the “Program” category and then pressing the “New launch configuration” button above the category list. This will invoke the wizard to walk you through the creation steps. The initial new configuration page will appear as follows:

external tools dialog new config page

Change the name of the configuration to something meaningful, unless you do not intend to save and reuse this configuration. Then, in the “Main” tab, either enter the location of the executable or browse to it. Similarly, specify the path to the directory in which the executable should be launched. You may also specify any command line parameters to apply when invoking the executable.

Once you have entered the information for the “Main” tab, press the Apply button to save the information. The other tabs (“Refresh”, etc.) can be left unchanged in typical usage.

The sample configuration for our Mil-Std-1553 demonstration application is shown below, prior to pressing Apply (because the configuration is still named “New_configuration” in the list of all known Program configurations).

external tools dialog new config created

You can also specify other aspects of the configuration, including whether the enclosing project (or workspace, etc.) is built prior to each launch execution. The image below shows the Build page, for example. By default, the entire workspace is built prior to execution. You may want to build only the project containing the executable associated with the specific launch.

external tools dialog build page

When everything necessary is correctly specified, press Apply. The new launch configuration name will appear in the list of known configurations and the page will appear similar the the figure below. You can now press Close to exit the dialog; the new launch configuration is ready to use. Alternatively, you can launch the application by pressing Run. We discuss launching in Executing Native Ada Applications

external tools dialog new config applied

8.2. Executing Native Ada Applications

You may execute a native Ada application using either an external tool launch configuration or a C++ application launch configuration.

Note that you can reuse launch configurations indefinitely, unless some aspect of the launch changes. See Creating Launch Configurations for Native Ada Applications for the details.

8.2.1. Using A C++ Launch Configuration

You can execute a native Ada application as if it is a C++ application, thereby reusing the CDT facilities. To do so, you apply an existing C++ launch configuration.

Select the launch configuration using the Run… dialog, which can be invoked using either the Run menu or the Run button on the toolbar, and then select the Run Configurations… entry. The following figure illustrates use of the Run menu:

run menu open run configurations dialog

The resulting dialog will list all the known launch configurations. Select the intended configuration and press Run.

existing config in external tools dialog

Execution will commence and any output will appear in a dedicated console in the Console view. You can use the console controls to terminate the execution if required.

app executing in console

Once you have applied a given launch configuration, Eclipse places it into the Run menu so it is easy to apply it again. From then on you can launch the application from the menu without having to invoke the dialog. You may also include the configuration in your “launch favorites” and it will then be available in the menu until you remove it.

For example, the following figure illustrates our Mil-Std-1553 demo launch configuration within the Run menu:

existing config in Run menu

8.2.2. Using An External Tool Launch Configuration

To execute a native Ada application as an external tool, apply an existing External Tools launch configuration.

Select the launch configuration using the External Tools dialog, which can be invoked using either the Run menu or the External Tools button and selecting the Open External Tools Dialog… entry. The following figure illustrates use of the Run menu:

run menu open external tools dialog

Using the External Tools button on the button bar is shown in this figure:

toolbar open external tools dialog

The resulting dialog will list all the known launch configurations. Select the intended configuration and press Run.

existing config in external tools dialog

Execution will commence and any output will appear in a dedicated console in the Console view. You can use the console controls to terminate the execution if required.

app executing in console

Once you have applied a given launch configuration, Eclipse places it into the External Tools menu so it is easy to apply it again. From then on you can launch the application from the menu without having to invoke the External Tools dialog. You may also include the configuration in your “launch favorites” and it will then be available in the menu until you remove it.

For example, the following figure illustrates our Mil-Std-1553 demo launch configuration within the External Tools menu:

config in external tools menu

8.3. Executing Embedded Ada Applications

GNATbench supports development of both native and embedded applications. For example, a cross compiler can just as easily be used as a native compiler. Execution in an embedded context, however, involves a number of differences, such as debugger probes, emulators, and so forth, that are beyond the scope of this general User’s Guide. Please refer to the specific documentation supplied with your cross development system for the details of remote execution.