lab4a
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
lab4a [2018/01/23 16:10] – created franck | lab4a [2018/01/23 16:18] (current) – franck | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Lab 4 ====== | ||
- | + | Implement a listener, named ArrayListener, | |
- | Implement a listener, named ArrayListener, | + | |
- | rites of array cells within the main method of an app. A sample run can be foun | + | |
- | d below. | + | |
- | ome hints that may be useful for implementing your listener. | + | |
- | < | + | |
- | < | + | |
- | Consider the interfaces VMListener and SearchListener, | + | |
- | kages gov.nasa.jpf.vm and gov.nasa.jpf.search, | + | |
- | < | + | |
- | Consider subclasses of the class Instruction, | + | |
- | asa.jpf.vm. | + | |
- | < | + | |
- | If you cannot | + | |
- | n method of an app, then count the number of reads and writes of array cells of | + | |
- | the entire app. | + | |
- | < | + | |
- | If you cannot | + | |
- | d or write of an array cell occurs. | + | |
- | </ | + | |
- | + | ||
- | <p> | + | |
To compile your listener, use | To compile your listener, use | ||
- | <pre> | + | <code> |
javac -cp / | javac -cp / | ||
- | </pre> | + | </code> |
- | or add / | + | or add / |
- | 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 ArraySample { |
- | { | + | public static void main(String[] args) { |
- | public static void main(String[] args) | + | |
- | | + | |
int[] array = new int[2]; | int[] array = new int[2]; | ||
array[0] = 1; | array[0] = 1; | ||
Line 45: | Line 24: | ||
} | } | ||
} | } | ||
- | </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=ArraySample | ||
classpath=. | classpath=. | ||
listener=ArrayListener | listener=ArrayListener | ||
native_classpath=/ | native_classpath=/ | ||
- | </pre> | + | </code> |
- | where / | + | where / |
- | ss can be found. | + | |
- | <p> | + | If the above configuration file is used with the above app, JPF should produce |
- | + | <code> | |
- | If the above configuration file is used with the above app, JPF should produce | + | JavaPathfinder core system v8.0 (rev 29) - (C) 2005-2014 United States |
- | utput similar to the following. | + | |
- | <pre> | + | |
- | JavaPathfinder core system v8.0 (rev 29) - (C) 2005-2014 United States | + | |
- | t. All rights reserved. | + | |
Line 71: | Line 43: | ||
ArraySample.main() | ArraySample.main() | ||
- | ====================================================== search started: 2/5/17 1: | + | ====================================================== search started: 2/5/17 1:20 PM |
- | 20 PM | + | |
***** | ***** | ||
Total number of reads and writes of array cells: 6 | Total number of reads and writes of array cells: 6 | ||
Line 84: | Line 55: | ||
states: | states: | ||
search: | search: | ||
- | choice generators: | + | choice generators: |
- | =0), data=0 | + | |
heap: | heap: | ||
instructions: | instructions: | ||
Line 91: | Line 61: | ||
loaded code: classes=60, | loaded code: classes=60, | ||
- | ====================================================== search finished: 2/5/17 1 | + | ====================================================== search finished: 2/5/17 1:20 PM |
- | :20 PM | + | </code> |
- | </pre> | + | |
- | + | ||
- | <P> | + | |
+ | To receive feedback, submit your listener using the submit command before Monday February 5: | ||
submit 4315 lab4 ArrayListener.java | submit 4315 lab4 ArrayListener.java | ||
lab4a.1516723856.txt.gz · Last modified: by franck