lab4a
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| lab4a [2018/01/23 16:18] – franck | lab4a [2019/01/29 01:12] (current) – franck | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Lab 4 ====== | + | ====== Lab 5 ====== |
| + | |||
| + | Implement a listener, named LocalVariableIds, | ||
| - | Implement a listener, named ArrayListener, | ||
| * Consider the interfaces VMListener and SearchListener, | * Consider the interfaces VMListener and SearchListener, | ||
| * Consider subclasses of the class Instruction, | * Consider subclasses of the class Instruction, | ||
| - | * If you do not know how to count the number of reads and writes of array cells within | + | * If you cannot restrict |
| - | * If you do not know how to print the total at the end, then print a star (*) every time a read or write of an array cell occurs. | + | * If you cannot extract |
| To compile your listener, use | To compile your listener, use | ||
| < | < | ||
| - | javac -cp / | + | javac -cp / |
| </ | </ | ||
| or add / | or add / | ||
| Line 15: | Line 16: | ||
| To test your listener, you may want to use the following app. | To test your listener, you may want to use the following app. | ||
| <code java> | <code java> | ||
| - | public class ArraySample | + | public class LocalVariableIdsSample |
| public static void main(String[] args) { | public static void main(String[] args) { | ||
| - | | + | int i = 5; |
| - | | + | boolean b = true; |
| - | | + | double d = 3.0; |
| - | | + | |
| - | | + | |
| } | } | ||
| } | } | ||
| Line 28: | Line 29: | ||
| To run JPF on the above app, use the following configuration file. | To run JPF on the above app, use the following configuration file. | ||
| < | < | ||
| - | target=ArraySample | + | target=LocalVariableIdsSample |
| classpath=. | classpath=. | ||
| - | listener=ArrayListener | + | listener=LocalVariableIds |
| native_classpath=/ | native_classpath=/ | ||
| </ | </ | ||
| - | where / | + | where / |
| If the above configuration file is used with the above app, JPF should produce output similar to the following. | If the above configuration file is used with the above app, JPF should produce output similar to the following. | ||
| < | < | ||
| - | JavaPathfinder core system v8.0 (rev 29) - (C) 2005-2014 United States Government. All rights reserved. | + | JavaPathfinder core system v8.0 (rev 32+) - (C) 2005-2014 United States Government. All rights reserved. |
| ====================================================== system under test | ====================================================== system under test | ||
| - | ArraySample.main() | + | LocalVariableIdsSample.main() |
| - | ====================================================== search started: 2/5/17 1:20 PM | + | ====================================================== search started: 2/8/18 12:04 PM |
| - | ***** | + | |
| - | Total number of reads and writes of array cells: 6 | + | ====================================================== |
| - | ***** | + | Local variable ids |
| + | LocalVariableIdsSample.main([Ljava/ | ||
| + | LocalVariableIdsSample.main([Ljava/ | ||
| + | LocalVariableIdsSample.main([Ljava/ | ||
| ====================================================== results | ====================================================== results | ||
| Line 56: | Line 60: | ||
| search: | search: | ||
| choice generators: | choice generators: | ||
| - | heap: new=347,released=12, | + | heap: new=346,released=11, |
| - | instructions: | + | instructions: |
| - | max memory: | + | max memory: |
| - | loaded code: classes=60, | + | loaded code: classes=60, |
| - | ====================================================== search finished: 2/5/17 1:20 PM | + | ====================================================== search finished: 2/8/18 12:04 PM |
| </ | </ | ||
| - | To receive feedback, submit your listener using the submit command before | + | To receive feedback, submit your listener using the submit command before |
| - | submit 4315 lab4 ArrayListener.java | + | submit 4315 lab5 LocalVariableIds.java |
| + | |||
lab4a.1516724310.txt.gz · Last modified: by franck
