lab8
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| lab8 [2017/03/02 15:00] – franck | lab8 [2020/02/29 21:15] (current) – franck | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Lab 8 ====== | + | ~~NOTOC~~ |
| + | ====== Lab 5 ====== | ||
| Consider the following app. | Consider the following app. | ||
| - | <html> | + | <code java> |
| - | <pre> | + | public class Main { |
| - | public class ComputeSquareRoot | + | |
| public static void main(String[] args) { | public static void main(String[] args) { | ||
| - | double data = 3.1415926; | + | |
| - | | + | |
| } | } | ||
| } | } | ||
| - | </pre> | + | </code> |
| - | </html> | + | |
| + | If we run JPF with the following configuration file | ||
| + | < | ||
| + | target=Main | ||
| + | classpath=(directory that contains Main.class) | ||
| + | </code> | ||
| + | then we obtain output similar to the following. | ||
| + | < | ||
| + | JavaPathfinder core system v8.0 (rev 26e11d1de726c19ba8ae10551e048ec0823aabc6) - (C) 2005-2014 United States Government. All rights reserved. | ||
| + | |||
| + | |||
| + | ====================================================== system under test | ||
| + | Main.main() | ||
| + | |||
| + | ====================================================== search started: 2/29/20 4:01 PM | ||
| + | |||
| + | ====================================================== error 1 | ||
| + | gov.nasa.jpf.vm.NoUncaughtExceptionsProperty | ||
| + | java.lang.UnsatisfiedLinkError: | ||
| + | at java.lang.StrictMath.exp(gov.nasa.jpf.vm.JPF_java_lang_StrictMath) | ||
| + | at Main.main(Main.java: | ||
| + | |||
| + | |||
| + | ====================================================== snapshot #1 | ||
| + | thread java.lang.Thread: | ||
| + | call stack: | ||
| + | at java.lang.StrictMath.exp(StrictMath.java) | ||
| + | at Main.main(Main.java: | ||
| + | |||
| + | |||
| + | ====================================================== results | ||
| + | error #1: gov.nasa.jpf.vm.NoUncaughtExceptionsProperty " | ||
| + | |||
| + | ====================================================== statistics | ||
| + | elapsed time: | ||
| + | states: | ||
| + | search: | ||
| + | choice generators: | ||
| + | heap: | ||
| + | instructions: | ||
| + | max memory: | ||
| + | loaded code: classes=66, | ||
| + | |||
| + | ====================================================== search finished: 2/29/20 4:01 PM | ||
| + | </ | ||
| + | |||
| + | ===== Approach 1: native peer ===== | ||
| + | |||
| + | Implement a native peer class. | ||
| + | |||
| + | < | ||
| + | JavaPathfinder core system v8.0 (rev 26e11d1de726c19ba8ae10551e048ec0823aabc6) - (C) 2005-2014 United States Government. All rights reserved. | ||
| + | |||
| + | |||
| + | ====================================================== system under test | ||
| + | Main.main() | ||
| + | |||
| + | ====================================================== search started: 2/29/20 4:02 PM | ||
| + | native peer | ||
| + | 1.9623624323651344E10 | ||
| + | |||
| + | ====================================================== results | ||
| + | no errors detected | ||
| + | |||
| + | ====================================================== statistics | ||
| + | elapsed time: | ||
| + | states: | ||
| + | search: | ||
| + | choice generators: | ||
| + | heap: | ||
| + | instructions: | ||
| + | max memory: | ||
| + | loaded code: classes=62, | ||
| + | |||
| + | ====================================================== search finished: 2/29/20 4:02 PM | ||
| + | </ | ||
| + | |||
| + | To compile your class, you may want to use | ||
| + | < | ||
| + | javac -cp / | ||
| + | </ | ||
| + | or add / | ||
| + | |||
| + | Submit your native peer class **and** your configuration file (name it Main-native-peer.jpf). | ||
| + | |||
| + | ===== Approach 2: peer ===== | ||
| + | |||
| + | Implement a peer class. | ||
| + | |||
| + | < | ||
| + | JavaPathfinder core system v8.0 (rev 26e11d1de726c19ba8ae10551e048ec0823aabc6) - (C) 2005-2014 United States Government. All rights reserved. | ||
| + | |||
| + | |||
| + | ====================================================== system under test | ||
| + | Main.main() | ||
| + | |||
| + | ====================================================== search started: 2/29/20 4:05 PM | ||
| + | [WARNING] orphan NativePeer method: java.lang.StrictMath.log(D)D | ||
| + | peer | ||
| + | 1.9623624323651325E10 | ||
| + | |||
| + | ====================================================== results | ||
| + | no errors detected | ||
| + | |||
| + | ====================================================== statistics | ||
| + | elapsed time: | ||
| + | states: | ||
| + | search: | ||
| + | choice generators: | ||
| + | heap: | ||
| + | instructions: | ||
| + | max memory: | ||
| + | loaded code: classes=62, | ||
| + | |||
| + | ====================================================== search finished: 2/29/20 4:05 PM | ||
| + | </ | ||
| + | |||
| + | Submit your peer class **and** your configuration file (name it Main-peer.jpf). | ||
| + | |||
| + | ===== Approach 3: jpf-nhandler ===== | ||
| + | |||
| + | Use jpf-nhandler so that JPF produces the following output. | ||
| + | |||
| + | < | ||
| + | JavaPathfinder core system v8.0 (rev 26e11d1de726c19ba8ae10551e048ec0823aabc6) - (C) 2005-2014 United States Government. All rights reserved. | ||
| + | |||
| + | |||
| + | ====================================================== system under test | ||
| + | Main.main() | ||
| + | |||
| + | ====================================================== search started: 2/29/20 4:10 PM | ||
| + | * DELEGATING Unhandled Native -> java.lang.StrictMath.exp | ||
| + | 1.9623624323651344E10 | ||
| + | |||
| + | ====================================================== results | ||
| + | no errors detected | ||
| + | |||
| + | ====================================================== statistics | ||
| + | elapsed time: | ||
| + | states: | ||
| + | search: | ||
| + | choice generators: | ||
| + | heap: | ||
| + | instructions: | ||
| + | max memory: | ||
| + | loaded code: classes=62, | ||
| + | |||
| + | ====================================================== search finished: 2/29/20 4:10 PM | ||
| + | </ | ||
| + | |||
| + | Submit your configuration file (name it Main-nhandler.jpf). | ||
| + | |||
| + | To receive feedback, submit your classes and configuration files using | ||
| + | < | ||
| + | submit 4315 lab5 (name of file) | ||
| + | </ | ||
| + | before Thursday March 12. | ||
| - | - Develop a model class so that the above app can be verified with JPF. [[https:// | ||
| - | - Develop a native peer so that the above app can be verified with JPF. | ||
lab8.1488466854.txt.gz · Last modified: by franck
