本文整理汇总了Java中gov.nasa.jpf.JPF.getVM方法的典型用法代码示例。如果您正苦于以下问题:Java JPF.getVM方法的具体用法?Java JPF.getVM怎么用?Java JPF.getVM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gov.nasa.jpf.JPF
的用法示例。
在下文中一共展示了JPF.getVM方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PathOutputMonitor
import gov.nasa.jpf.JPF; //导入方法依赖的package包/类
public PathOutputMonitor (Config config, JPF jpf) {
vm = jpf.getVM();
vm.storePathOutput();
jpf.addPublisherExtension(ConsolePublisher.class, this);
printOutput = config.getBoolean("pom.print_output", true);
deferOutput = config.getBoolean("pom.defer_output", true);
psClass = config.getClass("pom.output_spec.class", PathOutputSpec.class);
if (psClass == null) {
psClass = RegexOutputSpec.class;
}
anySpecs = loadSpecs(config, "pom.any");
allSpecs = loadSpecs(config, "pom.all");
noneSpecs = loadSpecs(config, "pom.none");
violatedSpecs = new ArrayList<PathOutputSpec>();
}
示例2: ChoiceTracker
import gov.nasa.jpf.JPF; //导入方法依赖的package包/类
public ChoiceTracker (Config config, JPF jpf) {
this.config = config;
vm = jpf.getVM();
search = jpf.getSearch();
String fname = config.getString("choice.trace");
if (fname == null) {
isReportExtension = true;
jpf.addPublisherExtension(ConsolePublisher.class, this);
// pw is going to be set later
} else {
try {
pw = new PrintWriter(fname);
} catch (FileNotFoundException fnfx) {
System.err.println("cannot write choice trace to file: " + fname);
pw = new PrintWriter(System.out);
}
}
excludes = config.getStringArray("choice.exclude");
cgClasses = config.getClasses("choice.class");
format = config.getEnum("choice.format", Format.values(), Format.CG);
showLocation = config.getBoolean("choice.show_location", true);
}
示例3: TraceStorer
import gov.nasa.jpf.JPF; //导入方法依赖的package包/类
public TraceStorer (Config config, JPF jpf){
traceFileName = config.getString("trace.file", "trace");
storeMultiple = config.getBoolean("trace.multiple", false);
storeDepth = config.getInt("trace.depth", Integer.MAX_VALUE);
verbose = config.getBoolean("trace.verbose", false);
terminateOnStore = config.getBoolean("trace.terminate", false);
storeOnConstraintHit = config.getBoolean("trace.store_constraint", false);
storeCalls = StringSetMatcher.getNonEmpty(config.getStringArray("trace.store_calls"));
storeThreads = StringSetMatcher.getNonEmpty(config.getStringArray("trace.store_threads"));
vm = jpf.getVM();
search = jpf.getSearch();
}
示例4: BudgetChecker
import gov.nasa.jpf.JPF; //导入方法依赖的package包/类
public BudgetChecker (Config conf, JPF jpf) {
//--- get the configured budget limits (0 means not set)
maxTime = conf.getDuration("budget.max_time", 0);
maxHeap = conf.getMemorySize("budget.max_heap", 0);
maxDepth = conf.getInt("budget.max_depth", 0);
maxInsn = conf.getLong("budget.max_insn", 0);
maxState = conf.getInt("budget.max_state", 0);
maxNewStates = conf.getInt("budget.max_new_states", 0);
tStart = System.currentTimeMillis();
if (maxHeap > 0) {
mxb = ManagementFactory.getMemoryMXBean();
muStart = mxb.getHeapMemoryUsage();
mStart = muStart.getUsed();
}
search = jpf.getSearch();
vm = jpf.getVM();
}
示例5: DeadlockAnalyzer
import gov.nasa.jpf.JPF; //导入方法依赖的package包/类
public DeadlockAnalyzer (Config config, JPF jpf){
jpf.addPublisherExtension(ConsolePublisher.class, this);
maxHistory = config.getInt("deadlock.max_history", Integer.MAX_VALUE);
format = config.getString("deadlock.format", "essential");
vm = jpf.getVM();
search = jpf.getSearch();
}
示例6: ChoiceSelector
import gov.nasa.jpf.JPF; //导入方法依赖的package包/类
public ChoiceSelector (Config config, JPF jpf) {
random = new Random( config.getInt("choice.seed", 42));
threadSet = StringSetMatcher.getNonEmpty(config.getStringArray("choice.threads"));
if (threadSet != null) {
threadsAlive = false;
}
calls = StringSetMatcher.getNonEmpty(config.getStringArray("choice.calls"));
callSeen = false;
startDepth = config.getInt("choice.depth", -1);
if (startDepth != -1) {
depthReached = false;
}
// if nothing was specified, we just do single choice (simulation)
if ((threadSet == null) && (calls == null) && (startDepth == -1)) {
threadsAlive = false;
callSeen = false;
depthReached = false;
}
VM vm = jpf.getVM();
trace = ChoicePoint.readTrace(config.getString("choice.use_trace"), vm.getSUTName());
searchAfterTrace = config.getBoolean("choice.search_after_trace", true);
vm.setTraceReplay(trace != null);
}
示例7: MethodAnalyzer
import gov.nasa.jpf.JPF; //导入方法依赖的package包/类
public MethodAnalyzer (Config config, JPF jpf){
jpf.addPublisherExtension(ConsolePublisher.class, this);
maxHistory = config.getInt("method.max_history", Integer.MAX_VALUE);
format = config.getString("method.format", "raw");
skipInit = config.getBoolean("method.skip_init", true);
showDepth = config.getBoolean("method.show_depth", false);
showTransition = config.getBoolean("method.show_transition", false);
includes = StringSetMatcher.getNonEmpty(config.getStringArray("method.include"));
excludes = StringSetMatcher.getNonEmpty(config.getStringArray("method.exclude"));
vm = jpf.getVM();
search = jpf.getSearch();
}
示例8: Reporter
import gov.nasa.jpf.JPF; //导入方法依赖的package包/类
public Reporter (Config conf, JPF jpf) {
this.conf = conf;
this.jpf = jpf;
search = jpf.getSearch();
vm = jpf.getVM();
int probeInterval = conf.getInt("report.probe_interval");
boolean reportStats = conf.getBoolean("report.statistics", false) || (probeInterval > 0);
started = new Date();
addConfiguredPublishers(conf);
for (Publisher publisher : publishers) {
if (reportStats || publisher.hasToReportStatistics()) {
reportStats = true;
}
if (publisher instanceof JPFListener) {
jpf.addListener((JPFListener)publisher);
}
}
if (reportStats){
getRegisteredStatistics();
}
if (probeInterval > 0){
probeTimer = createProbeIntervalTimer(probeInterval);
}
}
示例9: testSystemClassLoader
import gov.nasa.jpf.JPF; //导入方法依赖的package包/类
@Test
public void testSystemClassLoader() {
//--- Sets up the JPF environment
String[] args = { "+vm.class=.vm.MultiProcessVM", "+target.1=HelloWorld", "+target.2=HelloWorld" };
Config config = new Config(args);
JPF jpf = new JPF(config);
VM vm = jpf.getVM();
Heap heap = vm.getHeap();
vm.initialize(); // this should instantiate two SystemClassLoaders
ThreadInfo[] threads = vm.getLiveThreads();
assertTrue( threads.length == 2);
//--- app 0
SystemClassLoaderInfo cl0 = threads[0].getSystemClassLoaderInfo();
assertTrue( cl0 != null);
assertTrue( cl0.parent == null);
int cl0ObjRef = cl0.objRef;
assertTrue( cl0ObjRef != MJIEnv.NULL);
ElementInfo ei0 = heap.get(cl0ObjRef);
assertTrue( ei0.getIntField( ClassLoaderInfo.ID_FIELD) == cl0.getId());
//--- app 1
SystemClassLoaderInfo cl1 = threads[1].getSystemClassLoaderInfo();
assertTrue( cl1 != null);
assertTrue( cl0.parent == null);
int cl1ObjRef = cl1.objRef;
assertTrue( cl1ObjRef != MJIEnv.NULL);
ElementInfo ei1 = heap.get(cl1ObjRef);
assertTrue( ei1.getIntField( ClassLoaderInfo.ID_FIELD) == cl1.getId());
//--- compare them
assertTrue( cl0 != cl1);
assertTrue( cl0.getId() != cl1.getId());
assertTrue( cl0.statics != cl1.statics);
assertTrue( cl0ObjRef != cl1ObjRef);
//--- compare the loaded classes
ClassInfo ci0 = cl0.getResolvedClassInfo("java.lang.Class");
ClassInfo ci1 = cl1.getResolvedClassInfo("java.lang.Class");
assertTrue( ci0 != ci1);
assertTrue( ci0.getUniqueId() != ci1.getUniqueId());
assertTrue( ci0.getName().equals(ci1.getName()));
assertTrue( ci0.getClassFileUrl().equals(ci1.getClassFileUrl()));
//--- should compare on-demand loaded classes here..
}
示例10: StateSpaceDot
import gov.nasa.jpf.JPF; //导入方法依赖的package包/类
public StateSpaceDot(Config conf, JPF jpf) {
VM vm = jpf.getVM();
vm.recordSteps(true);
}
示例11: testSystemClassLoader
import gov.nasa.jpf.JPF; //导入方法依赖的package包/类
@Test
public void testSystemClassLoader() {
//--- Sets up the JPF environment
String[] args = {"+vm.class=.vm.MultiProcessVM", "+target.1=HelloWorld", "+target.2=HelloWorld"};
Config config = new Config(args);
JPF jpf = new JPF(config);
VM vm = jpf.getVM();
Heap heap = vm.getHeap();
vm.initialize(); // this should instantiate two SystemClassLoaders
ThreadInfo[] threads = vm.getLiveThreads();
assertTrue(threads.length == 2);
//--- app 0
SystemClassLoaderInfo cl0 = threads[0].getSystemClassLoaderInfo();
assertTrue(cl0 != null);
assertTrue(cl0.parent == null);
int cl0ObjRef = cl0.objRef;
assertTrue(cl0ObjRef != MJIEnv.NULL);
ElementInfo ei0 = heap.get(cl0ObjRef);
assertTrue(ei0.getIntField(ClassLoaderInfo.ID_FIELD) == cl0.getId());
//--- app 1
SystemClassLoaderInfo cl1 = threads[1].getSystemClassLoaderInfo();
assertTrue(cl1 != null);
assertTrue(cl0.parent == null);
int cl1ObjRef = cl1.objRef;
assertTrue(cl1ObjRef != MJIEnv.NULL);
ElementInfo ei1 = heap.get(cl1ObjRef);
assertTrue(ei1.getIntField(ClassLoaderInfo.ID_FIELD) == cl1.getId());
//--- compare them
assertTrue(cl0 != cl1);
assertTrue(cl0.getId() != cl1.getId());
assertTrue(cl0.statics != cl1.statics);
assertTrue(cl0ObjRef != cl1ObjRef);
//--- compare the loaded classes
ClassInfo ci0 = cl0.getResolvedClassInfo("java.lang.Class");
ClassInfo ci1 = cl1.getResolvedClassInfo("java.lang.Class");
assertTrue(ci0 != ci1);
assertTrue(ci0.getUniqueId() != ci1.getUniqueId());
assertTrue(ci0.getName().equals(ci1.getName()));
assertTrue(ci0.getClassFileUrl().equals(ci1.getClassFileUrl()));
//--- should compare on-demand loaded classes here..
}