Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

State.java

00001 package gov.nasa.arc.ase.jpf.jvm.examine;
00002 
00003 import gov.nasa.arc.ase.jpf.*;
00004 import gov.nasa.arc.ase.jpf.jvm.*;
00005 import de.fub.bytecode.*;
00006 
00007 public class State implements iState {
00008 
00009   private KernelState state;
00010 
00011   public State() {
00012     state = (KernelState)((VirtualMachine)Engine.vm).getKernelState();
00013   }  
00014   public static iValue createValue(int type, long value, DynamicArea da) {
00015     switch(type) {
00016       case Constants.T_INT : 
00017     return new IntValue(value);
00018       case Constants.T_BOOLEAN : 
00019     return new BoolValue(value);
00020       case Constants.T_SHORT : 
00021     return new ShortValue(value);
00022       case Constants.T_OBJECT: 
00023     return new ObjectValue(value,da);
00024       case Constants.T_FLOAT: 
00025     return new FloatValue(value);
00026       case Constants.T_LONG: 
00027     return new LongValue(value);
00028       case Constants.T_DOUBLE: 
00029     return new DoubleValue(value);
00030       case Constants.T_ARRAY : 
00031     return new ArrayValue(value,da);
00032       default : return null;
00033     }
00034 
00035 
00036   }  
00037   // given thread number, look at top of stack, return method for query
00038   public iMethodState getMethodState(int threadNumber) {
00039     return new MethodState(((ThreadInfo)state.getThreadInfo(threadNumber)).getTopStackFrame(),state.dynamic_area);
00040   }  
00041   // get value of a static field
00042   public iValue getStaticFieldValue(String className, String fieldName) {
00043     // determine type then create intValue, objectValue etc.
00044     StaticArea sa = state.static_area;
00045     long value = sa.getValue(className,fieldName);
00046     return State.createValue(sa.getVariableType(className,fieldName),
00047     value,
00048     state.dynamic_area);
00049   }  
00050   // is a thread active
00051   public boolean isActive(int threadNumber) {
00052     return ((ThreadInfo)state.getThreadInfo(threadNumber)).isAlive();  
00053   }  
00054   public boolean isLoaded(String classname) {
00055     return state.static_area.isLoaded(classname);
00056   }  
00057   public void newState() {
00058     state = (KernelState)((VirtualMachine)Engine.vm).getKernelState();
00059   }  
00060   // number of threads 
00061   public int numOfThreads() {
00062     return state.getThreadCount();
00063   }  
00064 }

Generated at Thu Feb 7 06:55:47 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001