Chapter 3. Using IC2D debugging features

IC2D comes with several plug-ins to help developers with the process of debugging their applications built above ProActive.

3.1. Debugging a ProActive Application using IC2D

The communication between a debugger (like JDB or Eclipse) and a Java Virtual Machine (JVM) uses a socket connection. The debugger has therefore to know the URL of the JVM and the port number available for this socket connection. However, no port number is available by default on the JVM. Thus, in order to be able to launch the JVM with the correct arguments, the IC2D debugger connection tool is intended to give the information needed to the debugger connection.

First of all, JVMs (ProActive Runtimes) have to be started with the debug command line argument, otherwise it is not possible to establish a remote connection to these JVMs. The additional argument is of the following form:

-DdebugID=padebug_someDeploymentId -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=0,launch='java -cp <path/to/ProActive.jar> org.objectweb.proactive.core.debug.dconnection.DebuggeePortSetter padebug_someDeploymentId'

In the previous line, the path to the ProActive archive is the only thing to be changed. The debug id and the port number (address) will be set randomly so as to avoid conflicts between JVMs.

In order to ease the use of the debugging features, the GCMA descriptor has been extended to easily start runtimes in debug mode. One has to add the tag <debug/> as a child of the application/proactive tag. An example is shown hereafter:

<?xml version="1.0" encoding="UTF-8"?>
<GCMApplication xmlns="urn:gcm:application:1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="urn:gcm:application:1.0 http://proactive.inria.fr/schemas/gcm/1.0/ApplicationDescriptorSchema.xsd">

    <environment>
        <javaPropertyVariable name="proactive.home" />
        <javaPropertyVariable name="user.dir" />

        <descriptorVariable name="hostCapacity" value="2"/>
        <descriptorVariable name="vmCapacity" value="2"/>
    </environment>


    <application>
        <proactive base="root" relpath="${proactive.home}">
            <configuration>
                <applicationClasspath>
                    <pathElement base="proactive" relpath="dist/lib/ProActive_examples.jar"/>
                    <pathElement base="proactive" relpath="dist/lib/ibis-1.4.jar"/>
                    <pathElement base="proactive" relpath="dist/lib/ibis-connect-1.0.jar"/>
                    <pathElement base="proactive" relpath="dist/lib/ibis-util-1.0.jar"/>
                </applicationClasspath>
                    <debug/>
            </configuration>
            <virtualNode id="Workers" capacity="4"/>
        </proactive>

    </application>

    <resources>
        <nodeProvider id="workers">
            <file path="../GCMD_Local.xml" />
        </nodeProvider>
    </resources>
</GCMApplication>

One does not have to complete his descriptor with jvmarg tags to give arguments evoked above: it is precisely the role of the debug tag. It gives these arguments to all the created JVMs.

3.1.1. The connection

The IC2D debugger connection differs slightly from a simple debugger connection. When a user wants to connect a debugger to a remote JVM, he actually has to connect it to the local IC2D JVM. Then, it is an active object (created when the user sends the connection request) that is in charge of transmitting, through a proactive connection, the debugger information and requests to the JVM.

connection

Figure 3.1. connection


3.1.2. How to use the IC2D debugger connection tools

When a user right clicks on a monitored JVM, he can select an option (connect a debugger) that shows him the port number of his local debugger.

Menu

Figure 3.2. Menu


The following dialog box should appear:

Debugger Choice

Figure 3.3. Debugger Choice


Then, you can select either to use the Eclipse Extended Debugger or an external one. In case of an external one, the following window should appear asking you to give the connection information:

Popup

Figure 3.4. Popup


Next, the user has just to connect his debugger. For example: The Eclipse debugger

Eclipse connection

Figure 3.5. Eclipse connection


Eclipse debugger

Figure 3.6. Eclipse debugger


Communication

Figure 3.7. Communication


3.2. Step by step mode

Step by step preview

Figure 3.8. Step by step preview


3.2.1. Breakpoints Overview

The step by step mode allows to control the execution of an active object at the service level. There are several types of breakpoints located at different steps of the service execution. These breakpoints are used to stop (when it is enabled) and restart (when it is disabled) an active object execution.

3.2.1.1. Standard breakpoints

The standard breakpoints are located inside the service thread of an active object. These breakpoints do not block the other threads (like immediate services, JMX, ...). There are 3 points:

  • New service: This breakpoint is located before the beginning of the service. If the breakpoint is enabled, then the service will not start.

    Enabled by default.

  • End service: This breakpoint is located after the end of the service. Once the service finished, no other service will start if the breakpoint is enabled.

    Enabled by default.

  • Send request: This breakpoint is located before sending a request to an active object. The request is not added to the request queue of the active object.

    Disabled by default.

3.2.1.2. Immediate service breakpoints

The immediate service breakpoints are located inside each immediate service thread. The functionalities of these breakpoints are the same than those of standard breakpoints. For one object, there may be several immediate services blocked at the same time. There are 2 points for this specific service:

  • New immediate service: This breakpoint is located before the beginning of the immediate service.

    Enabled by default.

  • End immediate service: This breakpoint is located after the end of the immediate service.

    Enabled by default.

3.2.2. Step by step controls

3.2.2.1. Enable / Disable / NextStep

The main functionality of the step by step mode is to stop and restart an active object (enable/disable button). This functionality is available for one object or for each object in a node, a JVM, a host or a world (all object visible on IC2D monitoring). If an active object has been stopped, it is possible to restart it up to the next enabled breakpoint (next step button).

Pause

Figure 3.9. Pause


3.2.2.2. Filters

The filter tool allows to enable or disable some specific breakpoints. For example, it is possible to enable a new service and send request breakpoints, and disable the others.

filters

Figure 3.10. filters


Popup filters

Figure 3.11. Popup filters


3.2.2.3. Slow motion

This tool enables to introduce a delay after the breakpoints. Using this tool, the active object will stop at each breakpoint and will automatically restart after the delay.

slow motion

Figure 3.12. slow motion


3.2.2.4. Informations

This view displays some informations of an active object when it is selected. From this view, one can restart a previously blocked active object.

This tool also enables to choose the blocked service to restart (immediate or not).

Information

Figure 3.13. Information