Soot2jabc jETI HowTo

From JETI FMICS Wiki
Jump to: navigation, search

This page describes the integration of the soot2jabc tool into the jETI tool server and the subsequent usage of the deployed service in a Java ABC SIB graph.


Necessary files

To deploy soot2jabc as a jETI tool, you will of course first need a working jETI tool server and the required permissions to edit the tools.

The tool is provided as part of the soot2jabc CLI (command-line interface) package that contains the CLI implementation. The corresponding JAR file (usually called something like soot2jabc-CLI.jar) has to be placed inside the lib directory of the tool server (or wherever your other tool packages reside). Additionally, a small wrapper script is required due to the nature of the Soot tool:

soot2jabc.sh

#!/usr/bin/bash

classFileName=`basename $1`
classFileName=`echo $classFileName | sed -e s/.class$//`

java -cp lib/soot2jabc-CLI.jar:$3 de.metaframe.plugin.soot2jabc.UnitgraphConverter $classFileName $2

If you encounter an error saying that java.lang.Object could not be found during execution, you should try adding the rt.jar (usually in you Java home lib directory) to your classpath (just before the $3 within the bash-script).

Adding the tools to the jETI tool server

Then, you need to add the jETI service (either via the web configurator or directly in the file config/tools.xml).


Via the web frontend

Add a new service with the following parameters:

For the soot2jabc converter
Type Name Class Class Argument Value
static N/A String leave empty local_tools/soot2jabc.sh
required inputClass Input File N/A N/A
required outputSIBGraph Output File N/A N/A
static N/A de.unido.ls5.eti.toolserver.SessionFolderReference leave empty null


Via config/tools.xml

Alternatively, you can add the tool description directly in the config/tools.xml tool description file. The following XML snippet should help.

<tool name='Soot2jabc' active='true' class='de.unido.ls5.eti.toolserver.RuntimeUnix' method='exec'>
  <description>Transforms a Java class into a SIBGraph representation of a soot data flow analysis graph.</description>
  <array class='java.lang.Object'>
    <parameter class='java.lang.String' value='local_tools/soot2jabc.sh' />
    <parameter name='inputClass' class='de.unido.ls5.eti.toolserver.InputFileReference' required='true' description='The Java class to analyze.' />
    <parameter name='outputSIBGraph' class='de.unido.ls5.eti.toolserver.OutputFileReference' required='true'
        description='The resulting SIBGraph representation of the DFA graph.' />
    <parameter class='de.unido.ls5.eti.toolserver.SessionFolderReference' value='null' />
  </array>
</tool>


Generate the required SIB

Let the jETI web configurator generate the required SIB for you. The resulting ZIP file should contain one SIB for every tool you have selected in the tool editor, including the SIB for the soot2jabc tool. Place that ZIP file somewhere where your Java ABC installation can find and use them (e.g. in your folder of the JavaABC project where you would like to use the tool).


Build SIB graphs to make use of soot2jabc remotely

Now you need to integrate the remote usage of soot2jabc into an existing SIB graph. Below you can find a ZIP file containing two example graphs. You will need to replace the SIBs with those you downloaded from the server in the previous step.

These example graphs first load the Java class that should be analyzed into an execution context so the tool can use it. The next SIB interacts with the jETI server and returns a SIB Graph that contains the generated output by soot2jabc. Finally, the resulting graph is displayed (last SIB).


MacOS X Notes

We found that under MaxOS X, you need to explicitly add Java's rt.jar to the class path in order to get soot2jabc working. If soot2jabc complains about being unable to find the class java.lang.Object, adjust the script given above as follows:

soot2jabc.sh

#!/usr/bin/bash

classFileName=`basename $1`
classFileName=`echo $classFileName | sed -e s/.class$//`

java -cp lib/soot2jabc-CLI.jar:/path/to/rt.jar:$3 de.metaframe.plugin.soot2jabc.UnitgraphConverter $classFileName $2

Note the new /path/to/rt.jar entry in the class path parameter of the Java call. You will need to make machine-dependent adjustments here.