How to use SensA


All the libs listed below should be in your Java classpath:

The versions of libs should be identical with those listed. Unpredictable behavior will occur when using different versions of libs.

Libraries required:

These libraries are required to compile SensA source package and, more other libraries may be needed to add to either the JVM class path or Soot class path, depending on which part of Sensa is to be used. Those more libraries are clarified in the sections where they are involved as follows.


Simply put, the input to SensA should be the Java bytecodes, in which there is a change location of which you wish to see the impacts. The bytecodes, in the form of classfiles, are to be presented to the SensA instrumenter as the source input of the whole SensA dynamic analysis pipeline as well, which includes three phases:
(1) instrumenting subject, which instruments modification interface into the subject bytecode for later dynamic analysis;
(2) running instrumented subject, by which SensA modifies target variable in the instrumented statement in the runtime;
(3) post-processing the outputs from phase (2), through which SensA calculates change impact rankings as so to tell which points (statements) in the input subject is impacted and, especially, how much each point is impacted in terms of the rank of possibility that each is impacted compared to other impacted points.

As these phases being listed, the input for phase (2) is the instrumented subject classfiles, and that for the phase (3) is the outputs from running the subject instrumented. Here the running outputs are not merely the output of the original subject before instrumentation, but those in which the execution history, that SensA has instrumented by the way the modification interface was instrumented in phase (1), is mixed.

Another input for phase (2) is what the original subject should be fed with. In particular, SensA presumes that there is a "standard" sub-directory named "inputs" located in the "Basepath", as indicated as the second parameter of SensaRun. See the following section on "How to use SensA Run" for more details.

Overall Process

How to prepare subjects for SensA analysis

In order for SensA to instrument the bytecode of the target subject, adding certain statements in the subject source code is needed. In this regard however, SensA requires the addition of statements into the main/entry class of the holistic subject project only.

Precisely, the following statements should be added to the entry class, which is essentially an extra static method and thus would not mess the original source code up:

public class TheEntryClass {
	// added for Sensa Instrumentation
	static void __link() { 

In order to compile this piece of code, the corresponding names should be imported as well:

	import profile.ExecHistReporter;
	import change.DynSliceReporter;
	import profile.BranchReporter;
	import profile.DUAReporter;

As long as the libraries required as described above are in the class paths, the compiler will be able to find the packages and names in there. For the "Sensa.Modify" to be resolved, however, the path where the SensA classfiles are located should also be added into the class path setting for compiler.

Now the source code of target subject with the foregoing additions can be compiled, an exemplary class path setting is given below as it is in a complete compilation script (in Linux B-shell):

	javac -g:source -source 1.4 -cp ${MAINCP} -d $ROOT/subject/bin

Other paths needed for the subject's class dependences and libraries ought also to be in "MAINCP". Note that the "-g:source -source:1.4" option for javac is strongly recommended for compiling subject in order to ensure correct functionalities of SensA.

Once the compilation succeeds, it is ready to start the instrumentation for dynamic analysis as instructed as follows. First, you need to indicate the instrumentation point for SensA to instrument modifications in the enclosing class. This instrumentation point is also referred as "change location" since you will almost always want to instrument at the change location when using SensA to predict how the change you have known about will impact other points in your whole subject project.

How to find a specific change location

Since the primary input of SensA is the byte-code of the target subject, change location as it is indicated to SensA is referred to based on the intermediate representation of the subject rather than its plain source code. SensA is now built and works on top of the Soot framework and, in particular, substantially uses Soot's Jimple representation along with the corresponding parser to implement basic Java byte-code resolution and analysis. Therefore, the change location is specified according to where the statement in which the change is involved is located in the Jimple code derived from the original subject's source code.

How to use SensA Instr

Once we have chosen the change location, instrumentation is ready to run. As shown in the following example, "change" is the statement id giving the change location and, the class path for JVM and Soot are given by "MAINCP" and "SOOTCP" respectively. To run the instrumenter using command line on Windows, the shell below script can be converted into batch script accordingly. When running it in IDEs such as Eclipse, a Run/Debug configuration can be created by picking class paths as exemplified in the script below and indicating corresponding parameters.
The primary parameters for SensA instrumenter are explained as follows.


mkdir -p out-instr


mkdir -p $OUTDIR

java -Xmx1600m -ea -cp ${MAINCP} Sensa.SensaInst \
	-w -cp ${SOOTCP} \
	-p cg verbose:true,implicit-entry:false -p cg.spark verbose:true,on-fly-cg:true,rta:true \
	-f c -d "$OUTDIR" -brinstr:off -duainstr:off \
   	-duaverbose -start:$change \
	-slicectxinsens \
	-allowphantom \
	-exechist \
	-main-class ScheduleClass -entry:ScheduleClass \
	-process-dir $subjectloc/bin/${ver}${seed}  \
	1>out-instr/instr-$change-${ver}${seed}.out 2>out-instr/instr-$change-${ver}${seed}.err

How to use SensA Run

After successful instrumentation, the instrumented subject, the instrumented class needs to be run using SensA runner as follows.

An actual example of the runtime phase usage of SensA is shown below.





mkdir -p $OUTDIR

java -Xmx2800m -ea -cp ${MAINCP} -DnotRunWithNotHit=true Sensa.SensaRun \
	ScheduleClass \
	"$subjectloc" \
	"$INDIR" \
	$change \

How to examine the results

(1) the expected outputs of SensA instrumenter are:

(2) the expected outputs for the run phase of SensA are:

Generated on 3 Dec 2014 for SensA by  doxygen 1.6.1