User Tools

Site Tools


lab4a

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
lab4a [2018/01/23 16:10] – created francklab4a [2019/01/29 01:12] (current) franck
Line 1: Line 1:
 +====== Lab 5 ======
  
 +Implement a listener, named LocalVariableIds, that prints the set of IDs of the local variables manipulated in the main method. A sample run can be found below. It shows what type of output your listener should produce. Here are some hints that may be useful for implementing your listener. 
  
-Implement a listener, named ArrayListener, that counts the number of reads and w +  * Consider the interfaces VMListener and SearchListener, which are part of the packages gov.nasa.jpf.vm and gov.nasa.jpf.search, respectively. 
-rites of array cells within the main method of an app.  A sample run can be foun +  Consider subclasses of the class Instruction, which is part of the package gov.nasa.jpf.vm. 
-d below.  It shows what type of output your listener should produce.  Here are s +  If you cannot restrict to the local variables manipulated in the main method, then consider all local variables
-ome hints that may be useful for implementing your listener. +  If you cannot extract the ID of the local variables, then print a star (*) every time a local variable is manipulated
-<ul> +
-<li> +
-Consider the interfaces VMListener and SearchListener, which are part of the pac +
-kages gov.nasa.jpf.vm and gov.nasa.jpf.search, respectively. +
-<li> +
-Consider subclasses of the class Instruction, which is part of the package gov.+
-asa.jpf.vm. +
-<li> +
-If you cannot count the number of reads and writes of array cells within the mai +
-method of an app, then count the number of reads and writes of array cells of  +
-the entire app+
-<lI> +
-If you cannot print the total at the end, then print a star (*) every time a rea +
-d or write of an array cell occurs. +
-</ul> +
- +
-<p>+
  
 To compile your listener, use To compile your listener, use
-<pre+<code
-javac -cp /cs/fac/packages/jpf/jpf-core/build/jpf.jar:ArrayListener.java +javac -cp /cs/fac/packages/jpf/jpf-core/build/jpf.jar:LocalVariableIds.java 
-</pre+</code
-or add /cs/fac/packages/jpf/jpf-core/build/jpf.jar as an external library to Ecl +or add /cs/fac/packages/jpf/jpf-core/build/jpf.jar as an external library to Eclipse.
-ipse. +
- +
-<p>+
  
 To test your listener, you may want to use the following app. To test your listener, you may want to use the following app.
-<pre+<code java
-public class ArraySample +public class LocalVariableIdsSample 
-+    public static void main(String[] args) { 
-    public static void main(String[] args) + int 5
-    + boolean b true
-        int[] array new int[2]+ double d 3.0; 
-        array[0] 1+        i++; 
-        array[1] array[0]+        false;
-        array[0]++; +
-        array[1] 2;+
     }     }
 } }
-</pre>  +</code
- +
-<p>+
  
 To run JPF on the above app, use the following configuration file. To run JPF on the above app, use the following configuration file.
-<pre+<code
-target=ArraySample+target=LocalVariableIdsSample
 classpath=. classpath=.
-listener=ArrayListener+listener=LocalVariableIds
 native_classpath=/eecs/home/franck/ native_classpath=/eecs/home/franck/
-</pre+</code
-where /eecs/home/franck/ is the path to the directory in which ArrayListener.cla +where /eecs/home/franck/ is the path to the directory in which LocalVariableIds.class can be found.
-ss can be found.+
  
-<p>+If the above configuration file is used with the above app, JPF should produce output similar to the following. 
 +<code> 
 +JavaPathfinder core system v8.0 (rev 32+) - (C) 2005-2014 United States Government. All rights reserved.
  
-If the above configuration file is used with the above app, JPF should produce o 
-utput similar to the following. 
-<pre> 
-JavaPathfinder core system v8.0 (rev 29) - (C) 2005-2014 United States Governmen 
-t. All rights reserved. 
  
 +====================================================== system under test
 +LocalVariableIdsSample.main()
  
-====================================================== system under test +====================================================== search started: 2/8/18 12:04 PM
-ArraySample.main()+
  
-====================================================== search started: 2/5/17 1: +====================================================== 
-20 PM +Local variable ids 
-***** +LocalVariableIdsSample.main([Ljava/lang/String;)V.3 
-Total number of reads and writes of array cells: 6 +LocalVariableIdsSample.main([Ljava/lang/String;)V.2 
-*****+LocalVariableIdsSample.main([Ljava/lang/String;)V.1
  
 ====================================================== results ====================================================== results
Line 84: Line 59:
 states:             new=1,visited=0,backtracked=1,end=1 states:             new=1,visited=0,backtracked=1,end=1
 search:             maxDepth=1,constraints=0 search:             maxDepth=1,constraints=0
-choice generators:  thread=1 (signal=0,lock=1,sharedRef=0,threadApi=0,reschedule +choice generators:  thread=1 (signal=0,lock=1,sharedRef=0,threadApi=0,reschedule=0), data=0 
-=0), data=0 +heap:               new=346,released=11,maxLive=0,gcCycles=1 
-heap:               new=347,released=12,maxLive=0,gcCycles=1 +instructions:       3165 
-instructions:       3184 +max memory:         57MB 
-max memory:         238MB +loaded code:        classes=60,methods=1324
-loaded code:        classes=60,methods=1320+
  
-====================================================== search finished: 2/5/17 1 +====================================================== search finished: 2/8/18 12:04 PM 
-:20 PM +</code>
-</pre>+
  
-<P>+To receive feedback, submit your listener using the submit command before Tuesday February 12: 
 +submit 4315 lab5 LocalVariableIds.java
  
  
-submit 4315 lab4 ArrayListener.java 
  
  
lab4a.1516723856.txt.gz · Last modified: by franck