chord.project.analyses
Class DynamicAnalysis

java.lang.Object
  extended by chord.project.analyses.JavaAnalysis
      extended by chord.project.analyses.BasicDynamicAnalysis
          extended by chord.project.analyses.DynamicAnalysis
All Implemented Interfaces:
ITask

public class DynamicAnalysis
extends BasicDynamicAnalysis

Generic implementation of a dynamic analysis that allows choosing from a limited but commonly-used set of events, such as method entry/exit, field reads/writes, lock acquires/releases, etc.

Author:
Mayur Naik (mhn@cs.stanford.edu), omertripp (omertrip@post.tau.ac.il)

Field Summary
protected  InstrScheme scheme
          The instrumentation scheme for this dynamic analysis.
 
Fields inherited from class chord.project.analyses.BasicDynamicAnalysis
DEBUG, eventHandlerArgs, instrumentorArgs, runIDs
 
Fields inherited from class chord.project.analyses.JavaAnalysis
consumes, controls, name, produces
 
Constructor Summary
DynamicAnalysis()
           
 
Method Summary
 boolean canReuseTraces()
           
 java.util.Map<java.lang.String,java.lang.String> getEventHandlerArgs()
          Arguments to be passed to the event handler.
 java.lang.Class getEventHandlerClass()
          The class of the event handler to be used.
 InstrScheme getInstrScheme()
           
 java.lang.String getInstrSchemeFileName()
           
 java.util.Map<java.lang.String,java.lang.String> getInstrumentorArgs()
          Arguments to be passed to the instrumentor.
 java.lang.Class getInstrumentorClass()
          The class of the instrumentor to be used.
 java.util.List<java.lang.Runnable> getTraceTransformers()
          Subclasses can override this method.
 void handleEvent(ByteBufferedFile buffer)
           
 void processAcquireLock(int l, int t, int o)
           
 void processAftMethodCall(int i, int t, int o)
           
 void processAftNew(int h, int t, int o)
           
 void processAloadPrimitive(int e, int t, int b, int i)
           
 void processAloadReference(int e, int t, int b, int i, int o)
           
 void processAstorePrimitive(int e, int t, int b, int i)
           
 void processAstoreReference(int e, int t, int b, int i, int o)
           
 void processBasicBlock(int b, int t)
           
 void processBefMethodCall(int i, int t, int o)
           
 void processBefNew(int h, int t, int o)
           
 void processEnterLoop(int w, int t)
           
 void processEnterMainMethod(int t)
           
 void processEnterMethod(int m, int t)
           
 void processExplicitThrow(int p, int t, int o)
           
 void processGetfieldPrimitive(int e, int t, int b, int f)
           
 void processGetfieldReference(int e, int t, int b, int f, int o)
           
 void processGetstaticPrimitive(int e, int t, int b, int f)
           
 void processGetstaticReference(int e, int t, int b, int f, int o)
           
 void processImplicitThrow(int p, int t, int o)
           
 void processLeaveLoop(int w, int t)
           
 void processLeaveMethod(int m, int t)
           
 void processLoopIteration(int w, int t)
           
 void processNewArray(int h, int t, int o)
           
 void processNotify(int i, int t, int o)
           
 void processPutfieldPrimitive(int e, int t, int b, int f)
           
 void processPutfieldReference(int e, int t, int b, int f, int o)
           
 void processPutstaticPrimitive(int e, int t, int b, int f)
           
 void processPutstaticReference(int e, int t, int b, int f, int o)
           
 void processQuad(int p, int t)
           
 void processReleaseLock(int r, int t, int o)
           
 void processReturnPrimitive(int p, int t)
           
 void processReturnReference(int p, int t, int o)
           
 void processThreadJoin(int i, int t, int o)
           
 void processThreadStart(int i, int t, int o)
           
 void processWait(int i, int t, int o)
           
 void run()
          Executes this analysis in a "classic" project.
 
Methods inherited from class chord.project.analyses.BasicDynamicAnalysis
doneAllPasses, donePass, getInstrKind, getTimeout, getTraceBlockSize, getTraceFileName, getTraceFileName, getTraceFileName, getTraceFileName, getTraceKind, haltOnErr, initAllPasses, initPass, processTrace, reuseTraces, useJvmti
 
Methods inherited from class chord.project.analyses.JavaAnalysis
getName, run, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

scheme

protected InstrScheme scheme
The instrumentation scheme for this dynamic analysis.

Constructor Detail

DynamicAnalysis

public DynamicAnalysis()
Method Detail

getInstrScheme

public InstrScheme getInstrScheme()

getInstrSchemeFileName

public java.lang.String getInstrSchemeFileName()

getInstrumentorClass

public java.lang.Class getInstrumentorClass()
Description copied from class: BasicDynamicAnalysis
The class of the instrumentor to be used. Subclasses can override this method but must return a class which is a subclass of BasicInstrumentor.

Overrides:
getInstrumentorClass in class BasicDynamicAnalysis

getEventHandlerClass

public java.lang.Class getEventHandlerClass()
Description copied from class: BasicDynamicAnalysis
The class of the event handler to be used. Subclasses can override this method but must return a class which extends BasicEventHandler. Additionally, if the dynamic analysis implemented by the subclass is multi-JVM (uses separate JVMs for generating and handling events), then this method must return a class which extends TraceEventHandler.

Overrides:
getEventHandlerClass in class BasicDynamicAnalysis

getInstrumentorArgs

public java.util.Map<java.lang.String,java.lang.String> getInstrumentorArgs()
Description copied from class: BasicDynamicAnalysis
Arguments to be passed to the instrumentor. If this dynamic analysis uses the JVMTI agent implemented in main/agent/ to start and end the event handler at runtime, then the only argument passed to the instrumentor by default is use_jvmti=true. If this dynamic analysis does not use the JVMTI agent, then the following arguments are passed to the instrumentor by default: 1. use_jvmti=false 2. event_handler_class= 3. event_handler_args=@@ ... @@ The reason these arguments are passed to the instrumentor is because, in the absence of the JVMTI agent, the instrumentor must inject calls to start and end the event handler at runtime, at the entry and exit, respectively, of the bytecode of the main method of the analyzed program. Whether or not this dynamic analysis uses the JVMTI agent is determined by method BasicDynamicAnalysis.useJvmti(). The value of above is determined by method BasicDynamicAnalysis.getEventHandlerClass(). The values of , , ..., , above are determined by method BasicDynamicAnalysis.getEventHandlerArgs(). Subclasses can override this method but must call super.getInstrumentorArgs(), add any additional arguments to the returned map, and return that same map.

Overrides:
getInstrumentorArgs in class BasicDynamicAnalysis

getEventHandlerArgs

public java.util.Map<java.lang.String,java.lang.String> getEventHandlerArgs()
Description copied from class: BasicDynamicAnalysis
Arguments to be passed to the event handler. If this dynamic analysis is multi-JVM (uses separate JVMs for generating and handling events), then the following arguments are passed to the event handler by default: 1. trace_block_size= 2. trace_file= If this dynamic analysis is single-JVM, then no arguments are passed to the event handler by default. Whether or not this dynamic analysis is single- or multi-JVM is determined by method BasicDynamicAnalysis.getEventHandlerClass(). If this method returns a subclass of TraceEventHandler, then it is multi-JVM; otherwise, it is single-JVM. The value of is determined by method BasicDynamicAnalysis.getTraceBlockSize(). The value of is determined by method BasicDynamicAnalysis.getTraceFileName(int). Subclasses can override this method but must call super.getEventHandlerArgs(), add any additional arguments to the returned map, and return that same map.

Overrides:
getEventHandlerArgs in class BasicDynamicAnalysis

getTraceTransformers

public java.util.List<java.lang.Runnable> getTraceTransformers()
Description copied from class: BasicDynamicAnalysis
Subclasses can override this method.

Overrides:
getTraceTransformers in class BasicDynamicAnalysis

canReuseTraces

public boolean canReuseTraces()
Overrides:
canReuseTraces in class BasicDynamicAnalysis

run

public void run()
Description copied from interface: ITask
Executes this analysis in a "classic" project. This method must usually not be called directly. The correct way to call it is to call ClassicProject.runTask(String) or ClassicProject.runTask(ITask), providing this analysis either by its name or its object.

Specified by:
run in interface ITask
Overrides:
run in class BasicDynamicAnalysis

handleEvent

public void handleEvent(ByteBufferedFile buffer)
                 throws java.io.IOException,
                        ReadException
Overrides:
handleEvent in class BasicDynamicAnalysis
Throws:
java.io.IOException
ReadException

processEnterMainMethod

public void processEnterMainMethod(int t)

processEnterMethod

public void processEnterMethod(int m,
                               int t)

processLeaveMethod

public void processLeaveMethod(int m,
                               int t)

processEnterLoop

public void processEnterLoop(int w,
                             int t)

processLoopIteration

public void processLoopIteration(int w,
                                 int t)

processLeaveLoop

public void processLeaveLoop(int w,
                             int t)

processBasicBlock

public void processBasicBlock(int b,
                              int t)

processQuad

public void processQuad(int p,
                        int t)

processBefMethodCall

public void processBefMethodCall(int i,
                                 int t,
                                 int o)

processAftMethodCall

public void processAftMethodCall(int i,
                                 int t,
                                 int o)

processBefNew

public void processBefNew(int h,
                          int t,
                          int o)

processAftNew

public void processAftNew(int h,
                          int t,
                          int o)

processNewArray

public void processNewArray(int h,
                            int t,
                            int o)

processGetstaticPrimitive

public void processGetstaticPrimitive(int e,
                                      int t,
                                      int b,
                                      int f)

processGetstaticReference

public void processGetstaticReference(int e,
                                      int t,
                                      int b,
                                      int f,
                                      int o)

processPutstaticPrimitive

public void processPutstaticPrimitive(int e,
                                      int t,
                                      int b,
                                      int f)

processPutstaticReference

public void processPutstaticReference(int e,
                                      int t,
                                      int b,
                                      int f,
                                      int o)

processGetfieldPrimitive

public void processGetfieldPrimitive(int e,
                                     int t,
                                     int b,
                                     int f)

processGetfieldReference

public void processGetfieldReference(int e,
                                     int t,
                                     int b,
                                     int f,
                                     int o)

processPutfieldPrimitive

public void processPutfieldPrimitive(int e,
                                     int t,
                                     int b,
                                     int f)

processPutfieldReference

public void processPutfieldReference(int e,
                                     int t,
                                     int b,
                                     int f,
                                     int o)

processAloadPrimitive

public void processAloadPrimitive(int e,
                                  int t,
                                  int b,
                                  int i)

processAloadReference

public void processAloadReference(int e,
                                  int t,
                                  int b,
                                  int i,
                                  int o)

processAstorePrimitive

public void processAstorePrimitive(int e,
                                   int t,
                                   int b,
                                   int i)

processAstoreReference

public void processAstoreReference(int e,
                                   int t,
                                   int b,
                                   int i,
                                   int o)

processReturnPrimitive

public void processReturnPrimitive(int p,
                                   int t)

processReturnReference

public void processReturnReference(int p,
                                   int t,
                                   int o)

processExplicitThrow

public void processExplicitThrow(int p,
                                 int t,
                                 int o)

processImplicitThrow

public void processImplicitThrow(int p,
                                 int t,
                                 int o)

processThreadStart

public void processThreadStart(int i,
                               int t,
                               int o)

processThreadJoin

public void processThreadJoin(int i,
                              int t,
                              int o)

processAcquireLock

public void processAcquireLock(int l,
                               int t,
                               int o)

processReleaseLock

public void processReleaseLock(int r,
                               int t,
                               int o)

processWait

public void processWait(int i,
                        int t,
                        int o)

processNotify

public void processNotify(int i,
                          int t,
                          int o)