├── .classpath ├── .gitignore ├── .project ├── Dockerfile ├── LICENSE ├── README.md ├── Vagrantfile ├── build.xml ├── eclipse └── AntBuilder.launch ├── jpf.properties ├── lib ├── ST-4.0.5.jar ├── antlr-3.4-complete.jar ├── gson-2.2.4.jar ├── guava-14.0.1.jar └── jconstraints-0.9.1-SNAPSHOT.jar ├── nbproject └── project.xml ├── scripts └── install.sh └── src ├── annotations └── gov │ └── nasa │ └── jpf │ └── jdart │ └── Symbolic.java ├── classes ├── java │ └── lang │ │ └── Math.java └── readme.txt ├── examples ├── config │ └── jdart.jpf ├── features │ ├── arrays │ │ ├── Input.java │ │ ├── example.jpf │ │ ├── test_m1.jpf │ │ ├── test_m2.jpf │ │ ├── test_m3.jpf │ │ └── test_m4.jpf │ ├── bools │ │ ├── Input.java │ │ ├── example.jpf │ │ └── test_foo.jpf │ ├── double2long │ │ ├── Input.java │ │ ├── example.jpf │ │ └── test_foo.jpf │ ├── exceptions │ │ ├── Input.java │ │ ├── example.jpf │ │ └── test_foo.jpf │ ├── fields │ │ ├── Input.java │ │ ├── example.jpf │ │ └── test_foo.jpf │ ├── functions │ │ ├── Input.java │ │ ├── example.jpf │ │ ├── test_foo_fdefs.jpf │ │ ├── test_foo_plain.jpf │ │ └── test_foo_replay.jpf │ ├── globals │ │ ├── Input.java │ │ ├── example.jpf │ │ └── test_foo.jpf │ ├── loops │ │ ├── Input.java │ │ ├── example.jpf │ │ └── test_foo.jpf │ ├── math │ │ ├── Input.java │ │ ├── example.jpf │ │ ├── test_bar_fdefs.jpf │ │ ├── test_bar_plain.jpf │ │ └── test_foo.jpf │ ├── nested │ │ ├── Input.java │ │ ├── example.jpf │ │ └── test_bar.jpf │ ├── nhandler │ │ ├── Input.java │ │ ├── example.jpf │ │ ├── test_foo_nh_delegate.jpf │ │ ├── test_foo_nh_skip.jpf │ │ └── test_foo_nohandler.jpf │ ├── nonlinear │ │ ├── Input.java │ │ ├── example.jpf │ │ └── test_foo.jpf │ ├── radians │ │ ├── Input.java │ │ ├── example.jpf │ │ └── test_foo.jpf │ ├── shift │ │ ├── Input.java │ │ ├── example.jpf │ │ └── test_shift.jpf │ ├── simple │ │ ├── Input.java │ │ ├── example.jpf │ │ ├── test_bar.jpf │ │ ├── test_baz.jpf │ │ ├── test_ctor.jpf │ │ ├── test_foo.jpf │ │ ├── test_xyz.jpf │ │ ├── test_zoo.jpf │ │ └── using.jpf │ ├── solvers │ │ ├── Input.java │ │ ├── example.jpf │ │ ├── test_eval.jpf │ │ ├── test_fct_atan2.jpf │ │ ├── test_fct_sin.jpf │ │ ├── test_fct_sqrt.jpf │ │ └── test_no_eval.jpf │ └── tableswitch │ │ ├── Input.java │ │ ├── example.jpf │ │ └── test_switch.jpf ├── summaries │ ├── abp │ │ ├── Protocol.java │ │ ├── example.jpf │ │ ├── test_symb_msg.jpf │ │ ├── test_symb_recv.jpf │ │ └── test_symb_reset.jpf │ ├── cev │ │ ├── CEV.java │ │ ├── ErrorLog.java │ │ ├── Reset.java │ │ ├── Spacecraft.java │ │ ├── Test.java │ │ ├── example.jpf │ │ ├── test_resets.jpf │ │ ├── test_symb_abort.jpf │ │ └── test_symb_reset.jpf │ └── json │ │ ├── Input.java │ │ └── summarize.jpf └── testsuites │ ├── TestSuiteExample.java │ └── testgen.jpf ├── main └── gov │ └── nasa │ └── jpf │ ├── jdart │ ├── CompletedAnalysis.java │ ├── ConcolicExplorer.java │ ├── ConcolicInstructionFactory.java │ ├── ConcolicListener.java │ ├── ConcolicMethodExplorer.java │ ├── ConcolicPerturbator.java │ ├── ConcolicUtil.java │ ├── JDart.java │ ├── JDartChoiceGenerator.java │ ├── RootFrame.java │ ├── SymbolicArrayElem.java │ ├── SymbolicField.java │ ├── SymbolicParam.java │ ├── SymbolicVariable.java │ ├── annotations │ │ └── SymbolicPeer.java │ ├── bytecode │ │ ├── ATHROW.java │ │ ├── D2F.java │ │ ├── D2I.java │ │ ├── D2L.java │ │ ├── DADD.java │ │ ├── DCMPG.java │ │ ├── DCMPL.java │ │ ├── DDIV.java │ │ ├── DMUL.java │ │ ├── DNEG.java │ │ ├── DREM.java │ │ ├── DSUB.java │ │ ├── EXECUTENATIVE.java │ │ ├── F2D.java │ │ ├── F2I.java │ │ ├── F2L.java │ │ ├── FADD.java │ │ ├── FCMPG.java │ │ ├── FCMPL.java │ │ ├── FDIV.java │ │ ├── FMUL.java │ │ ├── FNEG.java │ │ ├── FREM.java │ │ ├── FSUB.java │ │ ├── I2B.java │ │ ├── I2C.java │ │ ├── I2D.java │ │ ├── I2F.java │ │ ├── I2L.java │ │ ├── I2S.java │ │ ├── IADD.java │ │ ├── IAND.java │ │ ├── IDIV.java │ │ ├── IFEQ.java │ │ ├── IFGE.java │ │ ├── IFGT.java │ │ ├── IFHelper.java │ │ ├── IFLE.java │ │ ├── IFLT.java │ │ ├── IFNE.java │ │ ├── IFNONNULL.java │ │ ├── IFNULL.java │ │ ├── IF_ICMPEQ.java │ │ ├── IF_ICMPGE.java │ │ ├── IF_ICMPGT.java │ │ ├── IF_ICMPHelper.java │ │ ├── IF_ICMPLE.java │ │ ├── IF_ICMPLT.java │ │ ├── IF_ICMPNE.java │ │ ├── IINC.java │ │ ├── IMUL.java │ │ ├── INEG.java │ │ ├── IOR.java │ │ ├── IREM.java │ │ ├── ISHL.java │ │ ├── ISHR.java │ │ ├── ISUB.java │ │ ├── IUSHR.java │ │ ├── IXOR.java │ │ ├── L2D.java │ │ ├── L2F.java │ │ ├── L2I.java │ │ ├── LADD.java │ │ ├── LAND.java │ │ ├── LCMP.java │ │ ├── LDIV.java │ │ ├── LMUL.java │ │ ├── LNEG.java │ │ ├── LOOKUPSWITCH.java │ │ ├── LOR.java │ │ ├── LREM.java │ │ ├── LSHL.java │ │ ├── LSHR.java │ │ ├── LSUB.java │ │ ├── LUSHR.java │ │ ├── LXOR.java │ │ ├── NATIVERETURN.java │ │ ├── SwitchHelper.java │ │ ├── TABLESWITCH.java │ │ └── package.html │ ├── config │ │ ├── AnalysisConfig.java │ │ ├── ConcolicConfig.java │ │ ├── ConcolicMethodConfig.java │ │ ├── ConcolicValues.java │ │ ├── ConcolicValuesFromConfig.java │ │ ├── ConcolicValuesFromFile.java │ │ ├── MethodSpec.java │ │ └── ParamConfig.java │ ├── constraints │ │ ├── ConstraintsTree.java │ │ ├── InternalConstraintsTree.java │ │ ├── NumericCMP.java │ │ ├── Path.java │ │ ├── PathResult.java │ │ ├── PathState.java │ │ ├── PostCondition.java │ │ └── TrimmedConstraintsTree.java │ ├── objects │ │ ├── ArrayListHandler.java │ │ ├── DefaultObjectHandler.java │ │ ├── HashMapHandler.java │ │ ├── LinkedListHandler.java │ │ ├── PrimitiveArrayHandler.java │ │ ├── ReferenceArrayHandler.java │ │ ├── StringHandler.java │ │ ├── SymbolicObject.java │ │ ├── SymbolicObjectHandler.java │ │ ├── SymbolicObjectsContext.java │ │ └── VectorHandler.java │ ├── regressions │ │ ├── RegressionShell.java │ │ └── TestOracle.java │ ├── solvers │ │ ├── functions │ │ │ ├── FunctionFinder.java │ │ │ ├── FunctionSolver.java │ │ │ ├── FunctionSolverContext.java │ │ │ └── FunctionSolverProvider.java │ │ └── selective │ │ │ ├── CombinationFilter.java │ │ │ ├── ExpressionFilter.java │ │ │ ├── FloatConstantFilter.java │ │ │ ├── FunctionFilter.java │ │ │ ├── SimpleSelectiveSolver.java │ │ │ ├── SimpleSelectiveSolverContext.java │ │ │ └── SimpleSelectiveSolverProvider.java │ ├── summaries │ │ ├── MethodSummarizer.java │ │ ├── MethodSummary.java │ │ ├── SummaryConfig.java │ │ ├── SummaryStore.java │ │ └── json │ │ │ ├── ExpressionHandler.java │ │ │ ├── SubClassHandler.java │ │ │ └── VariableHandler.java │ ├── termination │ │ ├── NeverTerminate.java │ │ ├── NoSolveCycles.java │ │ ├── TerminationStrategy.java │ │ ├── TimedTermination.java │ │ └── UpToFixedNumber.java │ └── testsuites │ │ ├── MethodChecks.java │ │ ├── MethodWrapper.java │ │ ├── TestCase.java │ │ ├── TestSubSuite.java │ │ ├── TestSuite.java │ │ └── TestSuiteGenerator.java │ └── util │ ├── ConfigUtil.java │ ├── Predicates.java │ ├── SimpleProfiler.java │ └── TemplateBasedCompiler.java ├── peers ├── gov │ └── nasa │ │ └── jpf │ │ └── jdart │ │ └── peers │ │ ├── JPF_java_lang_Boolean.java │ │ ├── JPF_java_lang_Byte.java │ │ ├── JPF_java_lang_Character.java │ │ ├── JPF_java_lang_Double.java │ │ ├── JPF_java_lang_Integer.java │ │ ├── JPF_java_lang_Long.java │ │ ├── JPF_java_lang_Math.java │ │ └── JPF_java_lang_Short.java └── readme.txt ├── resources ├── META-INF │ └── constraints │ │ └── solvers └── gov │ └── nasa │ └── jpf │ └── jdart │ ├── summaries │ └── SummaryGeneration.st │ └── testsuites │ ├── SubSuite.st │ └── TestSuite.st └── tests └── gov └── nasa └── jpf └── jdart └── regressions ├── config.jpf ├── termination ├── InfiniteLoop.java ├── Oracle.java ├── PartialAnalysis.java ├── test1.jpf └── test2.jpf └── uncalled ├── Oracle.java ├── Protocol.java └── test1.jpf /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | bin/* 3 | *.class 4 | *.orig 5 | *.DS_Store 6 | /bin/ 7 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jdart 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.ui.externaltools.ExternalToolBuilder 15 | full,incremental, 16 | 17 | 18 | LaunchConfigHandle 19 | <project>/eclipse/AntBuilder.launch 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.jdt.core.javanature 26 | 27 | 28 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | # -*- mode: ruby -*- 3 | # vi: set ft=ruby : 4 | 5 | # Copyright 2016 Marko Dimjašević 6 | # 7 | # The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 8 | # platform is licensed under the Apache License, Version 2.0 (the "License"); you 9 | # may not use this file except in compliance with the License. You may obtain a 10 | # copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 11 | # 12 | # Unless required by applicable law or agreed to in writing, software distributed 13 | # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 14 | # CONDITIONS OF ANY KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations under the License. 16 | 17 | 18 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 19 | VAGRANTFILE_API_VERSION = "2" 20 | 21 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 22 | 23 | if Vagrant.has_plugin?("vagrant-cachier") 24 | config.cache.scope = :box 25 | config.cache.synced_folder_opts = { 26 | type: :nfs, 27 | mount_options: ['rw', 'vers=4', 'tcp', 'nolock'] 28 | } 29 | end 30 | 31 | config.vm.box = "ubuntu/trusty64" 32 | 33 | config.vm.provider :libvirt do |domain| 34 | domain.uri = 'qemu+unix:///system' 35 | domain.disk_bus = "virtio" 36 | domain.memory = 2048 37 | end 38 | 39 | config.vm.provider :virtualbox do |domain| 40 | domain.memory = 2048 41 | end 42 | 43 | config.vm.synced_folder ".", "/home/vagrant/jdart-project/jdart" 44 | 45 | config.vm.provision :shell, :privileged => false, path: "scripts/install.sh" 46 | end 47 | -------------------------------------------------------------------------------- /eclipse/AntBuilder.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /jpf.properties: -------------------------------------------------------------------------------- 1 | # project config for jpf-jdart extension 2 | # only process this properties file if on top of the jpf-core model classes 3 | 4 | @using = jpf-core 5 | 6 | jpf-jdart = ${config_path} 7 | 8 | jpf-jdart.native_classpath=\ 9 | ${jpf-jdart}/lib/ST-4.0.5.jar;\ 10 | ${jpf-jdart}/lib/antlr-3.4-complete.jar;\ 11 | ${jpf-jdart}/lib/gson-2.2.4.jar;\ 12 | ${jpf-jdart}/lib/guava-14.0.1.jar;\ 13 | ${jpf-jdart}/lib/jconstraints-0.9.1-SNAPSHOT.jar;\ 14 | ${jpf-jdart}/build/jpf-jdart.jar;\ 15 | ${jpf-jdart}/build/jpf-jdart-annotations.jar 16 | 17 | jpf-jdart.classpath=\ 18 | ${jpf-jdart}/build/jpf-jdart-classes.jar;\ 19 | ${jpf-jdart}/build/jpf-jdart-annotations.jar;\ 20 | ${jpf-jdart}/build/tests;\ 21 | ${jpf-jdart}/build/examples 22 | 23 | 24 | jpf-jdart.test_classpath=\ 25 | ${jpf-jdart}/build/tests;\ 26 | ${jpf-jdart}/build/classes 27 | 28 | jpf-jdart.sourcepath =\ 29 | ${jpf-jdart}/src/examples 30 | 31 | -------------------------------------------------------------------------------- /lib/ST-4.0.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psycopaths/jdart/673264e6f3f195f8428156aae697ca389cb667c3/lib/ST-4.0.5.jar -------------------------------------------------------------------------------- /lib/antlr-3.4-complete.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psycopaths/jdart/673264e6f3f195f8428156aae697ca389cb667c3/lib/antlr-3.4-complete.jar -------------------------------------------------------------------------------- /lib/gson-2.2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psycopaths/jdart/673264e6f3f195f8428156aae697ca389cb667c3/lib/gson-2.2.4.jar -------------------------------------------------------------------------------- /lib/guava-14.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psycopaths/jdart/673264e6f3f195f8428156aae697ca389cb667c3/lib/guava-14.0.1.jar -------------------------------------------------------------------------------- /lib/jconstraints-0.9.1-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psycopaths/jdart/673264e6f3f195f8428156aae697ca389cb667c3/lib/jconstraints-0.9.1-SNAPSHOT.jar -------------------------------------------------------------------------------- /src/annotations/gov/nasa/jpf/jdart/Symbolic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart; 17 | 18 | import java.lang.annotation.Retention; 19 | import java.lang.annotation.RetentionPolicy; 20 | 21 | /** 22 | * Annotation to specify if a global should be handled as a symbolic value 23 | * true if global; false if concrete (omitted implies concrete) 24 | */ 25 | @Retention(RetentionPolicy.RUNTIME) 26 | public @interface Symbolic { 27 | String value(); 28 | } 29 | -------------------------------------------------------------------------------- /src/classes/readme.txt: -------------------------------------------------------------------------------- 1 | this folder contains JPF executed library classes -> sourcepath -------------------------------------------------------------------------------- /src/examples/config/jdart.jpf: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # 3 | # default jdart tools 4 | # 5 | shell=gov.nasa.jpf.jdart.JDart 6 | symbolic.dp=z3 7 | symbolic.dp.z3.bitvectors=true 8 | 9 | ############################################################################### 10 | # 11 | # logging and jpf output 12 | # 13 | log.finest=jdart 14 | log.info=constraints 15 | 16 | # suppress jpf output 17 | report.console.start= 18 | report.console.finished= 19 | report.console.property_violation= 20 | 21 | jdart.configs.all_fields_symbolic.symbolic.include=this.* 22 | 23 | -------------------------------------------------------------------------------- /src/examples/features/arrays/example.jpf: -------------------------------------------------------------------------------- 1 | 2 | @include = ../../config/jdart.jpf 3 | 4 | 5 | target=features.arrays.Input 6 | 7 | concolic.method.m1=features.arrays.Input.m1(c:char[],i:int) 8 | concolic.method.m2=features.arrays.Input.m2(i:int,c:char[]) 9 | concolic.method.m3=features.arrays.Input.m3(i:int,d:double[]) 10 | concolic.method.m4=features.arrays.Input.m4(i:int,f1:float,f2:float,f3:float) 11 | 12 | -------------------------------------------------------------------------------- /src/examples/features/arrays/test_m1.jpf: -------------------------------------------------------------------------------- 1 | @include = ./example.jpf 2 | 3 | concolic.method=m1 4 | 5 | -------------------------------------------------------------------------------- /src/examples/features/arrays/test_m2.jpf: -------------------------------------------------------------------------------- 1 | @include = ./example.jpf 2 | 3 | concolic.method=m2 4 | 5 | -------------------------------------------------------------------------------- /src/examples/features/arrays/test_m3.jpf: -------------------------------------------------------------------------------- 1 | @include = ./example.jpf 2 | 3 | concolic.method=m3 4 | 5 | -------------------------------------------------------------------------------- /src/examples/features/arrays/test_m4.jpf: -------------------------------------------------------------------------------- 1 | @include = ./example.jpf 2 | 3 | concolic.method=m4 4 | 5 | -------------------------------------------------------------------------------- /src/examples/features/bools/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package features.bools; 17 | 18 | public class Input { 19 | 20 | public class TotallyPsyco extends java.lang.AssertionError { 21 | private static final long serialVersionUID = 1L; 22 | 23 | TotallyPsyco(String msg) { 24 | super(msg); 25 | } 26 | } 27 | 28 | public void foo(int i, boolean b) { 29 | //assert(i == 1); 30 | if (i > 200000) { 31 | if (b == false) { 32 | assert false; 33 | } else { 34 | ; 35 | } 36 | } 37 | // throw new TotallyPsyco("Odd Psyco"); 38 | } 39 | 40 | public static void main(String[] args) { 41 | System.out.println("-------- In main!"); 42 | Input inst = new Input(); 43 | try { 44 | inst.foo(-1024, false); 45 | //inst.foo(1, true); 46 | } catch (Throwable t) { 47 | System.out.println("Caught the rascal <" + t.getMessage() + "> redhanded!"); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/examples/features/bools/example.jpf: -------------------------------------------------------------------------------- 1 | 2 | @include = ../../config/jdart.jpf 3 | 4 | ############################################################################### 5 | # 6 | # experiment setup 7 | # 8 | 9 | target=features.bools.Input 10 | concolic.method.foo=features.bools.Input.foo(i:int,b:boolean) 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/examples/features/bools/test_foo.jpf: -------------------------------------------------------------------------------- 1 | @include = ./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | -------------------------------------------------------------------------------- /src/examples/features/double2long/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package features.double2long; 17 | 18 | public class Input { 19 | 20 | public static double bar(long l) { 21 | assert l < 100L && l > -100L; 22 | return (double)l; 23 | } 24 | 25 | public static double foo(double x) { 26 | if(x < 0.0) { 27 | x *= 10.0; 28 | } 29 | else { 30 | x /= 10.0; 31 | } 32 | long l = (long)x; 33 | return bar(l); 34 | } 35 | 36 | public static void main(String[] args) { 37 | System.out.println("-------- In main!"); 38 | double x = 10.0; 39 | foo(x); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/examples/features/double2long/example.jpf: -------------------------------------------------------------------------------- 1 | 2 | @include = ../../config/jdart.jpf 3 | 4 | ############################################################################### 5 | # 6 | # experiment setup 7 | # 8 | 9 | z3.timeout = 5000 10 | target=features.double2long.Input 11 | concolic.method.foo=features.double2long.Input.foo(x:double) 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/examples/features/double2long/test_foo.jpf: -------------------------------------------------------------------------------- 1 | @include = ./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | -------------------------------------------------------------------------------- /src/examples/features/exceptions/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package features.exceptions; 17 | public class Input { 18 | 19 | public int foo(int i) { 20 | 21 | if (i< 100) { 22 | return i; 23 | } 24 | 25 | try { 26 | throw new RuntimeException(); 27 | } 28 | catch (Throwable t) { 29 | 30 | } 31 | 32 | return i; 33 | } 34 | 35 | public static void main(String[] args) { 36 | System.out.println("-------- In main!"); 37 | Input i = new Input(); 38 | i.foo(1); 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/examples/features/exceptions/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | target=features.exceptions.Input 4 | 5 | concolic.method.foo=features.exceptions.Input.foo(i:int) 6 | concolic.method.foo.config=all_fields_symbolic 7 | -------------------------------------------------------------------------------- /src/examples/features/exceptions/test_foo.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/examples/features/fields/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | 4 | target=features.fields.Input 5 | 6 | concolic.method.foo=features.fields.Input.foo(i:double,b:boolean) 7 | 8 | -------------------------------------------------------------------------------- /src/examples/features/fields/test_foo.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | # Does not work due to NumericCMP. The test case uses Math.sin and Math.cos 4 | concolic.method=foo 5 | 6 | -------------------------------------------------------------------------------- /src/examples/features/functions/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package features.functions; 17 | 18 | 19 | public class Input { 20 | 21 | public void foo(double d1, double d2) { 22 | if (Math.cos(d1) > Math.sin(d2)) { 23 | if (Math.sin(d1) == Math.sin(d2)) { 24 | if (d1 == d2) 25 | assert false; 26 | } 27 | } 28 | } 29 | 30 | public static void main(String[] args) { 31 | System.out.println("-------- In main!"); 32 | Input inst = new Input(); 33 | inst.foo(.5, .7); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/examples/features/functions/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | 4 | target=features.functions.Input 5 | 6 | 7 | concolic.method.foo=features.functions.Input.foo(d1:double,d2:double) 8 | 9 | concolic.method.foo.config=foo 10 | jdart.configs.foo.constraints=(d1 > 0.0 && d1 < 3.0 && d2 > 0.0 && d2 < 3.0) 11 | -------------------------------------------------------------------------------- /src/examples/features/functions/test_foo_fdefs.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | 6 | jdart.configs.foo.use_func_defs=true 7 | z3.options=smt.mbqi=true;smt.macro-finder=true 8 | -------------------------------------------------------------------------------- /src/examples/features/functions/test_foo_plain.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | -------------------------------------------------------------------------------- /src/examples/features/functions/test_foo_replay.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | concolic.method.foo.values=1.0,0.0;\ 6 | 1.0,1.0;\ 7 | 0.0,1.0;\ 8 | 0.0,0.0;\ 9 | 0.5,0.5 10 | 11 | -------------------------------------------------------------------------------- /src/examples/features/globals/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package features.globals; 17 | 18 | import gov.nasa.jpf.jdart.Symbolic; 19 | 20 | 21 | public class Input { 22 | 23 | @Symbolic("true") 24 | boolean b = false; 25 | @Symbolic("true") 26 | int[] k = {1, 2, 3}; 27 | @Symbolic("true") 28 | static double[] d = {1.0, 2.0, 3.0, 4.0}; 29 | @Symbolic("true") 30 | int state = 0; 31 | 32 | public void foo(int i) { 33 | if (i > 200000) { 34 | if (b == true) { 35 | if (k[0] == k[1]) 36 | if (d[1] != d[3]) 37 | d[0] = d[1] + d[3]; 38 | else 39 | d[1] = d[0] + d[3]; 40 | } else { 41 | ; 42 | } 43 | state = k[0]; 44 | } else 45 | state = k[1]; 46 | } 47 | 48 | public static void main(String[] args) { 49 | System.out.println("-------- In main!"); 50 | Input inst = new Input(); 51 | inst.foo(-1024); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/examples/features/globals/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | 4 | target=features.globals.Input 5 | 6 | jdart.configs.globals.symbolic.statics=features.globals.Input 7 | jdart.configs.globals.symbolic.include=features.globals.Input.* 8 | 9 | 10 | concolic.method.foo=features.globals.Input.foo(i:int) 11 | concolic.method.foo.config=globals 12 | 13 | -------------------------------------------------------------------------------- /src/examples/features/globals/test_foo.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | -------------------------------------------------------------------------------- /src/examples/features/loops/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package features.loops; 17 | 18 | public class Input { 19 | 20 | public void foo(int i) { 21 | System.err.println("\n-------- In foo! Parameter = " + i); 22 | 23 | for (int j = 1; j < 4; j++) { 24 | if (i + j > 0) { 25 | System.out.println((i + j) + " is > 0"); 26 | } else { 27 | System.out.println((i + j) + " is <= 0"); 28 | } 29 | } 30 | } 31 | 32 | public static void main(String[] args) { 33 | System.out.println("-------- In main!"); 34 | Input inst = new Input(); 35 | try { 36 | inst.foo(21); 37 | } catch (Throwable t) { 38 | System.err.println(t.toString()); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/examples/features/loops/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | 4 | target=features.loops.Input 5 | 6 | concolic.method.foo=features.loops.Input.foo(i:int) 7 | 8 | -------------------------------------------------------------------------------- /src/examples/features/loops/test_foo.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | -------------------------------------------------------------------------------- /src/examples/features/math/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package features.math; 17 | 18 | public class Input { 19 | 20 | public void foo(double d) { 21 | double f = Math.ceil(d); 22 | if (f == 10) 23 | System.out.println("Math.ceil(" + d + ") == 10"); 24 | else 25 | System.out.println("Math.ceil(" + d + ") != 10"); 26 | } 27 | 28 | public void bar(double d1, double d2) { 29 | double s = java.lang.Math.toRadians(2.2); 30 | if (d1 > d2) { 31 | if (Math.sqrt(d1)*s >= 0) { 32 | 33 | } else { 34 | assert false; 35 | } 36 | } 37 | } 38 | 39 | public static void main(String[] args) { 40 | System.out.println("-------- In main!"); 41 | Input inst = new Input(); 42 | try { 43 | inst.foo(3.14159); 44 | } catch (Throwable t) { 45 | System.out.println("Caught the rascal <" + t.getMessage() + "> redhanded!"); 46 | } 47 | inst.bar(1,2); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/examples/features/math/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | target=features.math.Input 4 | 5 | concolic.method.foo=features.math.Input.foo(d:double) 6 | 7 | concolic.method.bar=features.math.Input.bar(d1:double,d2:double) 8 | concolic.method.bar.config=bar 9 | jdart.configs.bar.constraints=(d1 > 0.0 && d2 > 0.0) 10 | -------------------------------------------------------------------------------- /src/examples/features/math/test_bar_fdefs.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=bar 4 | 5 | jdart.configs.bar.use_func_defs=true 6 | z3.timeout=1000 7 | z3.options=smt.mbqi=true;smt.macro-finder=true 8 | -------------------------------------------------------------------------------- /src/examples/features/math/test_bar_plain.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=bar 4 | 5 | z3.timeout=1000 6 | -------------------------------------------------------------------------------- /src/examples/features/math/test_foo.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | -------------------------------------------------------------------------------- /src/examples/features/nested/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | 4 | target=features.nested.Input 5 | 6 | concolic.method.bar=features.nested.Input.bar(d:double) 7 | 8 | -------------------------------------------------------------------------------- /src/examples/features/nested/test_bar.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=bar 4 | 5 | -------------------------------------------------------------------------------- /src/examples/features/nhandler/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package features.nhandler; 17 | 18 | import java.util.Random; 19 | public class Input { 20 | 21 | public int foo(int i) { 22 | System.err.println("\n-------- In foo! Parameter = " + i); 23 | Random rand = new Random(); 24 | int x = 0; //rand.nextInt(i); 25 | System.out.println("x: " + x); 26 | if (x > 100) { 27 | assert false; 28 | } 29 | 30 | String text = "_J_"; 31 | char c = text.charAt(i); 32 | System.out.println("c: " + c); 33 | if (c == 'A') { 34 | assert false; 35 | } 36 | 37 | return i; 38 | } 39 | 40 | public static void main(String[] args) { 41 | System.out.println("-------- In main!"); 42 | Input i = new Input(); 43 | i.foo(1); 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/examples/features/nhandler/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | target=features.nhandler.Input 4 | 5 | concolic.method.foo=features.nhandler.Input.foo(i:int) 6 | concolic.method.foo.config=all_fields_symbolic 7 | -------------------------------------------------------------------------------- /src/examples/features/nhandler/test_foo_nh_delegate.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | @using jpf-nhandler 3 | nhandler.delegateUnhandledNative=true 4 | 5 | nhandler.spec.delegate = java.util.Random.nextInt,\ 6 | java.lang.String.* 7 | 8 | concolic.method=foo 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/examples/features/nhandler/test_foo_nh_skip.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | @using jpf-nhandler 3 | nhandler.delegateUnhandledNative=true 4 | 5 | nhandler.spec.skip = java.util.Random.nextInt,\ 6 | java.lang.String.* 7 | 8 | concolic.method=foo 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/examples/features/nhandler/test_foo_nohandler.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/examples/features/nonlinear/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package features.nonlinear; 17 | 18 | public class Input { 19 | 20 | public void foo(double x, double y) { 21 | System.err.println("\n-------- In foo! Parameter = " + x + " " + y); 22 | if (x >= 0) { 23 | if (x + 1 == x * y) 24 | System.out.println("Ones and twos!"); 25 | else 26 | System.out.println("Easy to reach!"); 27 | } else { 28 | if (6 * x == x * y) 29 | System.out.println("Wish you were here.. $%@#^%"); 30 | } 31 | } 32 | 33 | public static void main(String[] args) { 34 | System.out.println("-------- In main!"); 35 | Input inst = new Input(); 36 | inst.foo(400, 10.0); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/examples/features/nonlinear/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | 4 | target=features.nonlinear.Input 5 | 6 | concolic.method.foo=features.nonlinear.Input.foo(p:double,q:double) 7 | -------------------------------------------------------------------------------- /src/examples/features/nonlinear/test_foo.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | -------------------------------------------------------------------------------- /src/examples/features/radians/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package features.radians; 17 | 18 | public class Input { 19 | 20 | public void foo(int i) { 21 | System.err.println("\n-------- In foo! Parameter = " + i); 22 | String classPath = System.getProperties().getProperty("java.class.path"); 23 | System.out.println("Class path found: " + classPath); 24 | 25 | double x = java.lang.Math.toRadians(i); 26 | if (x > 0) 27 | System.out.println("Radians is positively radiant!"); 28 | else 29 | System.out.println("Radians is highly negative on all topics$%@#^%"); 30 | } 31 | 32 | public static void main(String[] args) { 33 | System.out.println("-------- In main!"); 34 | Input inst = new Input(); 35 | inst.foo(400); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/examples/features/radians/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | 4 | target=features.radians.Input 5 | 6 | concolic.method.foo=features.radians.Input.foo(i:int) 7 | -------------------------------------------------------------------------------- /src/examples/features/radians/test_foo.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | -------------------------------------------------------------------------------- /src/examples/features/shift/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package features.shift; 17 | 18 | public class Input { 19 | 20 | public static void shiftTest(long val, int shiftAmt) { 21 | assert ((val << shiftAmt) != 0); 22 | assert ((val >> shiftAmt) != 0); 23 | assert ((val >>> (shiftAmt - 1)) != 0); 24 | } 25 | 26 | public static void main(String[] args) { 27 | shiftTest(0L, 0); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/examples/features/shift/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | 4 | target=features.shift.Input 5 | 6 | concolic.method.shift=features.shift.Input.shiftTest(l:long,i:int) 7 | -------------------------------------------------------------------------------- /src/examples/features/shift/test_shift.jpf: -------------------------------------------------------------------------------- 1 | 2 | @include=../../config/jdart.jpf 3 | 4 | target=features.shift.Input 5 | concolic.method.shift=features.shift.Input.shiftTest(l:long,i:int) 6 | concolic.method=shift -------------------------------------------------------------------------------- /src/examples/features/simple/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | target=features.simple.Input 4 | 5 | concolic.method.foo=features.simple.Input.foo(i:int) 6 | concolic.method.foo.config=all_fields_symbolic 7 | 8 | concolic.method.bar=features.simple.Input.bar(d:double) 9 | 10 | concolic.method.zoo=features.simple.Input.zoo(i:int,j:short,f:float) 11 | concolic.method.zoo.config=zoo 12 | 13 | concolic.method.baz=features.simple.Input.baz(d:features.simple.Input$Data) 14 | concolic.method.baz.config=baz 15 | 16 | concolic.method.xyz=features.simple.Input.xyz(m:java.util.Map) 17 | concolic.method.xyz.config=xyz 18 | 19 | concolic.method.ctor=features.simple.Input.(i:int) 20 | concolic.method.ctor.config=ctor 21 | 22 | jdart.configs.xyz.symbolic.include=m[* 23 | 24 | jdart.configs.baz.symbolic.include=d.* 25 | 26 | 27 | jdart.configs.zoo.constraints=\ 28 | f > 256.0f;\ 29 | j >= 0 30 | 31 | jdart.configs.zoo.exploration.initial=true 32 | jdart.configs.zoo.exploration.suspend=*.zoo_sub(* 33 | 34 | -------------------------------------------------------------------------------- /src/examples/features/simple/test_bar.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=bar 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/examples/features/simple/test_baz.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=baz 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/examples/features/simple/test_ctor.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=ctor 4 | -------------------------------------------------------------------------------- /src/examples/features/simple/test_foo.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/examples/features/simple/test_xyz.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=xyz 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/examples/features/simple/test_zoo.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=zoo 4 | 5 | log.fine=jdart 6 | log.finest=constraints 7 | log.level=warning 8 | 9 | report.class=gov.nasa.jpf.report.Reporter 10 | report.publisher=console 11 | report.console.class=gov.nasa.jpf.report.ConsolePublisher 12 | report.console.start=jpf,sut 13 | report.console.transition= 14 | report.console.constraint=constraint,snapshot 15 | report.console.property_violation=error,snapshot 16 | report.console.show_steps=true 17 | report.console.show_method=true 18 | report.console.show_code=false 19 | report.console.finished=result,statistics 20 | 21 | 22 | 23 | jdart.tests.gen=true 24 | jdart.tests.pkg=com/example 25 | jdart.tests.suitename=suite 26 | jdart.tests.dir=/home/luckow/tmp/tests 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/examples/features/simple/using.jpf: -------------------------------------------------------------------------------- 1 | @using = jpf-jdart 2 | 3 | target=features.simple.Input 4 | 5 | # method config jdart 6 | 7 | concolic.method.zoo=features.simple.Input.zoo(i:int,j:short,f:float) 8 | concolic.method=zoo 9 | 10 | # method config jpf 11 | 12 | perturb.params=zoo 13 | perturb.zoo.class=gov.nasa.jpf.jdart.ConcolicPerturbator 14 | perturb.zoo.method=features.simple.Input.zoo(int,short,float) 15 | 16 | # jpf config 17 | 18 | jvm.insn_factory.class=gov.nasa.jpf.jdart.ConcolicInstructionFactory 19 | peer_packages=gov.nasa.jpf.jdart.peers; 20 | listener=gov.nasa.jpf.jdart.ConcolicListener 21 | perturb.class=gov.nasa.jpf.jdart.ConcolicPerturbator 22 | search.multiple_errors=true 23 | jdart.concolic_explorer_instance=gov.nasa.jpf.jdart.ConcolicExplorer@jdart-explorer 24 | 25 | # jdart config 26 | 27 | symbolic.dp=z3 28 | symbolic.dp.z3.bitvectors=true 29 | 30 | # logging 31 | 32 | log.finest=jdart 33 | log.info=constraints 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/examples/features/solvers/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package features.solvers; 17 | 18 | /** 19 | * 20 | */ 21 | public class Input { 22 | 23 | public void foo(double d) { 24 | if (d >= 0.0 && d <= Math.PI * 2) { 25 | if (Math.sin(d) < 0) { 26 | if (Math.cos(d) > 0) { 27 | assert false; 28 | } 29 | } 30 | } 31 | } 32 | 33 | public void bar(double d) { 34 | if (1.1 <= Math.sqrt(d)) { 35 | if (Math.sin(d) > 0.0) { 36 | assert false; 37 | } 38 | } 39 | } 40 | 41 | public void baz(double d1, double d2) { 42 | if (0.0 > Math.atan2(d1,d2)) { 43 | assert false; 44 | } 45 | } 46 | 47 | public static void main(String[] args) { 48 | System.out.println("-------- In main!"); 49 | Input inst = new Input(); 50 | inst.baz(1.0, 0.0); 51 | inst.bar(4.0); 52 | inst.foo( Math.PI * 1.5); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/examples/features/solvers/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | 4 | target=features.solvers.Input 5 | 6 | concolic.method.foo=features.solvers.Input.foo(d:double) 7 | 8 | concolic.method.bar=features.solvers.Input.bar(d:double) 9 | 10 | concolic.method.baz=features.solvers.Input.baz(d1:double,d2:double) 11 | -------------------------------------------------------------------------------- /src/examples/features/solvers/test_eval.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | symbolic.dp=selective 6 | selective.dp=z3 7 | selective.eval=true 8 | -------------------------------------------------------------------------------- /src/examples/features/solvers/test_fct_atan2.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=baz 4 | 5 | symbolic.dp=functions 6 | functions.dp=z3 7 | functions.use_defs=true 8 | functions.domain_bounds=true 9 | 10 | #z3.options=smt.mbqi=true;smt.macro-finder=true 11 | 12 | log.finest=jdart,constraints 13 | log.info= 14 | -------------------------------------------------------------------------------- /src/examples/features/solvers/test_fct_sin.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | symbolic.dp=functions 6 | functions.dp=z3 7 | functions.use_defs=true 8 | functions.domain_bounds=true 9 | 10 | #z3.options=smt.mbqi=true;smt.macro-finder=true 11 | 12 | log.finest=jdart,constraints 13 | log.info= -------------------------------------------------------------------------------- /src/examples/features/solvers/test_fct_sqrt.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=bar 4 | 5 | symbolic.dp=functions 6 | functions.dp=z3 7 | functions.use_defs=true 8 | functions.domain_bounds=true 9 | 10 | #z3.options=smt.mbqi=true;smt.macro-finder=true 11 | 12 | log.finest=jdart,constraints 13 | log.info= 14 | 15 | -------------------------------------------------------------------------------- /src/examples/features/solvers/test_no_eval.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=foo 4 | 5 | symbolic.dp=selective 6 | selective.dp=z3 7 | selective.eval=false -------------------------------------------------------------------------------- /src/examples/features/tableswitch/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package features.tableswitch; 17 | 18 | /** 19 | * 20 | * @author falk 21 | */ 22 | public class Input { 23 | 24 | public void tblSwitch(int i) { 25 | switch (i) { 26 | case 1: 27 | case 2: 28 | case 3: assert i < 3; break; 29 | case 4: assert false; 30 | default: assert true; 31 | } 32 | } 33 | 34 | public static void main(String[] args) { 35 | Input i = new Input(); 36 | i.tblSwitch(2); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/examples/features/tableswitch/example.jpf: -------------------------------------------------------------------------------- 1 | @include=../../config/jdart.jpf 2 | 3 | 4 | target=features.tableswitch.Input 5 | 6 | concolic.method.switch=features.tableswitch.Input.tblSwitch(i:int) 7 | -------------------------------------------------------------------------------- /src/examples/features/tableswitch/test_switch.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=switch 4 | -------------------------------------------------------------------------------- /src/examples/summaries/abp/example.jpf: -------------------------------------------------------------------------------- 1 | @include = ../../config/jdart.jpf 2 | 3 | target=summaries.abp.Protocol 4 | 5 | jdart.configs.msg.symbolic.statics=summaries.abp.Protocol 6 | jdart.configs.msg.symbolic.include=summaries.abp.Protocol.* 7 | 8 | concolic.method.msg=summaries.abp.Protocol.msg(sequence:int,content:int) 9 | concolic.method.msg.config=msg 10 | 11 | concolic.method.recv=summaries.abp.Protocol.recv_ack(value:int) 12 | concolic.method.recv.config=all_fields_symbolic 13 | 14 | concolic.method.reset=summaries.abp.Protocol.reset() 15 | concolic.method.reset.config=all_fields_symbolic 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/examples/summaries/abp/test_symb_msg.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=msg 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/examples/summaries/abp/test_symb_recv.jpf: -------------------------------------------------------------------------------- 1 | 2 | @include=./example.jpf 3 | 4 | concolic.method=recv 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/examples/summaries/abp/test_symb_reset.jpf: -------------------------------------------------------------------------------- 1 | @include=./example.jpf 2 | 3 | concolic.method=reset 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/examples/summaries/cev/ErrorLog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | // 18 | // DISCLAIMER - this file is part of the 'ESAS' demonstration project. As 19 | // such, it is only intended for demonstration purposes, does not contain 20 | // or refer to actual NASA flight software, and is solely derived from 21 | // publicly available information. For further details, please refer to the 22 | // README-ESAS file that is included in this distribution. 23 | // 24 | 25 | package summaries.cev; 26 | 27 | //import java.util.ArrayList; 28 | 29 | /** 30 | * class keeping a log of model errors (which are not to be confused with 31 | * modeled HW failures) 32 | * 33 | * advanced topic: use this to show the danger of not closing the state space: 34 | * if the log list is enabled, it effectively turns off state matching by JPF, 35 | * unless the 'log' data structure is filtered out by the JPF state management 36 | */ 37 | public class ErrorLog { 38 | 39 | //ArrayList log = new ArrayList(); 40 | String error; 41 | 42 | public String log (String msg) { 43 | //log.add(msg); 44 | error = msg; 45 | return msg; 46 | } 47 | 48 | public String last () { 49 | if (error == null) { 50 | return "no error"; 51 | } else { 52 | return error; 53 | } 54 | 55 | /** 56 | if (log.size() > 0){ 57 | return log.get(log.size()-1); 58 | } else { 59 | return "no error"; 60 | } 61 | **/ 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/examples/summaries/cev/Reset.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package summaries.cev; 17 | 18 | import gov.nasa.jpf.jdart.Symbolic; 19 | 20 | 21 | /** 22 | * 23 | */ 24 | public class Reset { 25 | 26 | @Symbolic("true") 27 | public int P1; 28 | 29 | @Symbolic("true") 30 | public int P2; 31 | 32 | @Symbolic("true") 33 | public int P3; 34 | 35 | @Symbolic("true") 36 | public int P4; 37 | 38 | public void sequence() { 39 | CEV cev = new CEV(); 40 | 41 | cev.reset(P1); 42 | cev.reset(P2); 43 | cev.reset(P3); 44 | cev.reset(P4); 45 | } 46 | 47 | 48 | public static void main(String[] args) { 49 | System.out.println("-------- In main!"); 50 | Reset r = new Reset(); 51 | r.sequence(); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/examples/summaries/cev/Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package summaries.cev; 17 | 18 | /** 19 | * 20 | */ 21 | public class Test { 22 | 23 | public static void main(String[] args) { 24 | Spacecraft s = new Spacecraft(); 25 | s.reset(1); 26 | s.doLowActiveAbort(); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/examples/summaries/cev/example.jpf: -------------------------------------------------------------------------------- 1 | @include = ../../config/jdart.jpf 2 | 3 | target=summaries.cev.Test 4 | 5 | jdart.configs.summaries.cev.symbolic.statics=summaries.cev.Spacecraft 6 | jdart.configs.summaries.cev.symbolic.include=summaries.cev.Spacecraft;summaries.cev.Spacecraft.* 7 | 8 | concolic.method.abort=summaries.cev.Spacecraft.doLowActiveAbort() 9 | concolic.method.abort.config=summaries.cev 10 | 11 | concolic.method.reset=summaries.cev.Spacecraft.reset(i:int) 12 | concolic.method.abort.config=summaries.cev 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/examples/summaries/cev/test_resets.jpf: -------------------------------------------------------------------------------- 1 | @include = ../../config/jdart.jpf 2 | 3 | target=summaries.cev.Reset 4 | 5 | concolic.method.seq=summaries.cev.Reset.sequence() 6 | concolic.method.seq.config=all_fields_symbolic 7 | 8 | concolic.method=seq 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/examples/summaries/cev/test_symb_abort.jpf: -------------------------------------------------------------------------------- 1 | 2 | @include=./example.jpf 3 | 4 | concolic.method=abort 5 | 6 | -------------------------------------------------------------------------------- /src/examples/summaries/cev/test_symb_reset.jpf: -------------------------------------------------------------------------------- 1 | 2 | @include=./example.jpf 3 | 4 | concolic.method=reset 5 | 6 | -------------------------------------------------------------------------------- /src/examples/summaries/json/Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package summaries.json; 17 | 18 | import gov.nasa.jpf.jdart.Symbolic; 19 | 20 | /** 21 | * 22 | */ 23 | public class Input { 24 | 25 | public class TotallyPsyco extends RuntimeException { 26 | 27 | } 28 | 29 | @Symbolic("true") 30 | private int state = 0; 31 | 32 | private int concrete = 1; 33 | 34 | public int testConcrete(int p1) { 35 | if (p1 > concrete) { 36 | throw new TotallyPsyco(); 37 | } 38 | return p1 + 100; 39 | } 40 | 41 | public int testSymbolic(int p1, boolean p2) { 42 | if (p1 != state) { 43 | state = p1; 44 | } 45 | return p2 ? 1 : 0; 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/examples/summaries/json/summarize.jpf: -------------------------------------------------------------------------------- 1 | shell=gov.nasa.jpf.jdart.summaries.MethodSummarizer 2 | 3 | concolic.method.m1=summaries.json.Input.testConcrete(i:int) 4 | concolic.method.m1.config=all_fields_symbolic 5 | concolic.method.m2=summaries.json.Input.testSymbolic(i:int,b:boolean) 6 | 7 | summary.methods=m1,m2 8 | 9 | symbolic.dp=NativeZ3 10 | symbolic.dp.z3.bitvectors=true 11 | 12 | log.fine=constraints,jdart 13 | 14 | # following line used to track what JPF executes 15 | #listener=.listener.ExecTracker 16 | 17 | # avoid statistics during learning process by enabling the following two lines 18 | report.console.start= 19 | report.console.finished= 20 | report.console.property_violation= 21 | -------------------------------------------------------------------------------- /src/examples/testsuites/testgen.jpf: -------------------------------------------------------------------------------- 1 | 2 | jpf-jdart.native_classpath=\ 3 | ${jpf-jdart}/lib/ST-4.0.5.jar;\ 4 | ${jpf-jdart}/lib/antlr-3.4-complete.jar;\ 5 | ${jpf-jdart}/lib/gson-2.2.4.jar;\ 6 | ${jpf-jdart}/build/jpf-jdart.jar;\ 7 | ${jpf-jdart}/build/examples;\ 8 | ${jpf-jdart}/build/jpf-jdart-annotations.jar 9 | 10 | shell=testsuites.TestSuiteExample 11 | target=null 12 | log.info=constraints,jdart -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/RootFrame.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart; 17 | 18 | 19 | /** 20 | * Attribute that is used to mark the root frame for 21 | * the concolic analysis. This is used to recognize 22 | * when the concolic execution of the method to be analyzed 23 | * is finished. 24 | * 25 | * 26 | */ 27 | final class RootFrame { 28 | 29 | private static final RootFrame INSTANCE = new RootFrame(); 30 | 31 | public static RootFrame getInstance() { 32 | return INSTANCE; 33 | } 34 | 35 | /* 36 | * (non-Javadoc) 37 | * @see java.lang.Object#clone() 38 | */ 39 | @Override 40 | public RootFrame clone() { 41 | return this; 42 | } 43 | 44 | private RootFrame() { 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/SymbolicVariable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart; 17 | 18 | import gov.nasa.jpf.constraints.api.Valuation; 19 | import gov.nasa.jpf.constraints.api.Variable; 20 | import gov.nasa.jpf.jdart.constraints.PostCondition; 21 | import gov.nasa.jpf.vm.StackFrame; 22 | 23 | /** 24 | * Represents a symbolic (primitive) variable. This can either be 25 | * a (primitive) argument on the stack, a primitive field of some 26 | * object on the heap (including this), or an 27 | * element of a primitive array. 28 | * 29 | * 30 | * @param 31 | */ 32 | public abstract class SymbolicVariable { 33 | protected final Variable variable; 34 | 35 | /** 36 | * Constructor. 37 | * @param variable the associated {@link Variable} 38 | */ 39 | public SymbolicVariable(Variable variable) { 40 | this.variable = variable; 41 | } 42 | 43 | public Variable getVariable() { 44 | return variable; 45 | } 46 | 47 | /** 48 | * Read the initial 49 | * @param initVal 50 | * @param sf 51 | */ 52 | public abstract void readInitial(Valuation initVal, StackFrame sf); 53 | public abstract void apply(Valuation val, StackFrame sf); 54 | public abstract void addToPC(PostCondition pc); 55 | } -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/annotations/SymbolicPeer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.annotations; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | @Retention(RetentionPolicy.RUNTIME) 24 | @Target({ElementType.TYPE,ElementType.METHOD}) 25 | public @interface SymbolicPeer { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/ATHROW.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.jdart.ConcolicMethodExplorer; 19 | import gov.nasa.jpf.vm.Instruction; 20 | import gov.nasa.jpf.vm.ThreadInfo; 21 | import gov.nasa.jpf.vm.UncaughtException; 22 | 23 | 24 | public class ATHROW extends gov.nasa.jpf.jvm.bytecode.ATHROW { 25 | 26 | 27 | /* (non-Javadoc) 28 | * @see gov.nasa.jpf.jvm.bytecode.ATHROW#execute(gov.nasa.jpf.vm.ThreadInfo) 29 | */ 30 | @Override 31 | public Instruction execute(ThreadInfo ti) { 32 | ConcolicMethodExplorer analysis = ConcolicMethodExplorer.getCurrentAnalysis(ti); 33 | 34 | // TODO: Is there really no listener method for uncaught exceptions? 35 | try { 36 | return super.execute(ti); 37 | } 38 | catch(UncaughtException uex) { 39 | if(analysis != null) 40 | analysis.uncaughtException(ti, uex); 41 | throw uex; 42 | } 43 | } 44 | 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/D2F.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.CastExpression; 19 | import gov.nasa.jpf.constraints.types.BuiltinTypes; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.jdart.ConcolicUtil.Pair; 23 | import gov.nasa.jpf.vm.Instruction; 24 | import gov.nasa.jpf.vm.StackFrame; 25 | import gov.nasa.jpf.vm.ThreadInfo; 26 | 27 | /** 28 | * Convert double to float ..., value => ..., result 29 | */ 30 | public class D2F extends gov.nasa.jpf.jvm.bytecode.D2F { 31 | 32 | @Override 33 | public Instruction execute(ThreadInfo ti) { 34 | StackFrame sf = ti.getTopFrame(); 35 | 36 | // value concrete => no symbolic computation needed. 37 | if (sf.getLongOperandAttr() == null) { 38 | return super.execute(ti); 39 | } 40 | 41 | Pair val = ConcolicUtil.popDouble(sf); 42 | 43 | float f = val.conc.floatValue(); 44 | CastExpression cast = CastExpression.create(val.symb, BuiltinTypes.FLOAT); 45 | 46 | Pair result = new Pair(f, cast); 47 | ConcolicUtil.pushFloat(result, sf); 48 | 49 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute D2F: " + result); 50 | return getNext(ti); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/D2I.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.CastExpression; 19 | import gov.nasa.jpf.constraints.types.BuiltinTypes; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.jdart.ConcolicUtil.Pair; 23 | import gov.nasa.jpf.vm.Instruction; 24 | import gov.nasa.jpf.vm.StackFrame; 25 | import gov.nasa.jpf.vm.ThreadInfo; 26 | 27 | /** 28 | * Convert double to int ..., value => ..., result 29 | */ 30 | public class D2I extends gov.nasa.jpf.jvm.bytecode.D2I { 31 | 32 | @Override 33 | public Instruction execute(ThreadInfo ti) { 34 | StackFrame sf = ti.getTopFrame(); 35 | 36 | // value concrete => no symbolic computation needed. 37 | if (sf.getLongOperandAttr() == null) { 38 | return super.execute(ti); 39 | } 40 | 41 | Pair val = ConcolicUtil.popDouble(sf); 42 | 43 | int i = val.conc.intValue(); 44 | CastExpression cast = CastExpression.create(val.symb, BuiltinTypes.SINT32); 45 | 46 | Pair result = new Pair(i, cast); 47 | ConcolicUtil.pushInt(result, sf); 48 | 49 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute D2I: " + result); 50 | return getNext(ti); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/D2L.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.CastExpression; 19 | import gov.nasa.jpf.constraints.types.BuiltinTypes; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | /** 27 | * Convert double to long ..., value => ..., result 28 | */ 29 | public class D2L extends gov.nasa.jpf.jvm.bytecode.D2L { 30 | 31 | @Override 32 | public Instruction execute(ThreadInfo ti) { 33 | StackFrame sf = ti.getTopFrame(); 34 | 35 | // value concrete => no symbolic computation needed. 36 | if (sf.getLongOperandAttr() == null) { 37 | return super.execute(ti); 38 | } 39 | 40 | ConcolicUtil.Pair val = ConcolicUtil.popDouble(sf); 41 | 42 | long l = val.conc.longValue(); 43 | CastExpression cast = CastExpression.create(val.symb, BuiltinTypes.SINT64); 44 | 45 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(l, cast); 46 | ConcolicUtil.pushLong(result, sf); 47 | 48 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute D2L: " + result); 49 | return getNext(ti); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/DADD.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericCompound; 19 | import gov.nasa.jpf.constraints.expressions.NumericOperator; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.jdart.ConcolicUtil.Pair; 23 | import gov.nasa.jpf.vm.Instruction; 24 | import gov.nasa.jpf.vm.StackFrame; 25 | import gov.nasa.jpf.vm.ThreadInfo; 26 | 27 | public class DADD extends gov.nasa.jpf.jvm.bytecode.DADD { 28 | 29 | @Override 30 | public Instruction execute(ThreadInfo ti) { 31 | StackFrame sf = ti.getTopFrame(); 32 | 33 | if (sf.getOperandAttr(1) == null && sf.getOperandAttr(3) == null) { 34 | return super.execute(ti); 35 | } 36 | 37 | Pair right = ConcolicUtil.popDouble(sf); 38 | Pair left = ConcolicUtil.popDouble(sf); 39 | 40 | NumericCompound symb = new NumericCompound( 41 | left.symb, NumericOperator.PLUS, right.symb); 42 | 43 | double conc = left.conc + right.conc; 44 | 45 | Pair result = new Pair(conc, symb); 46 | ConcolicUtil.pushDouble(result, sf); 47 | 48 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute DADD: " + result); 49 | return getNext(ti); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/DNEG.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.UnaryMinus; 19 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 20 | import gov.nasa.jpf.jdart.ConcolicUtil; 21 | import gov.nasa.jpf.vm.Instruction; 22 | import gov.nasa.jpf.vm.StackFrame; 23 | import gov.nasa.jpf.vm.ThreadInfo; 24 | 25 | /** 26 | * Negate double ..., value => ..., result 27 | */ 28 | public class DNEG extends gov.nasa.jpf.jvm.bytecode.DNEG { 29 | 30 | @Override 31 | public Instruction execute(ThreadInfo ti) { 32 | StackFrame sf = ti.getTopFrame(); 33 | 34 | if (sf.getLongOperandAttr() == null) { 35 | return super.execute(ti); 36 | } 37 | 38 | ConcolicUtil.Pair negated = ConcolicUtil.popDouble(sf); 39 | 40 | UnaryMinus symb = new UnaryMinus(negated.symb); 41 | double conc = -negated.conc; 42 | 43 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 44 | ConcolicUtil.pushDouble(result, sf); 45 | 46 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute DNEG: " + result); 47 | return getNext(ti); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/F2D.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.CastExpression; 19 | import gov.nasa.jpf.constraints.types.BuiltinTypes; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | 27 | 28 | /** 29 | * Convert double to float 30 | * ..., value => ..., result 31 | */ 32 | public class F2D extends gov.nasa.jpf.jvm.bytecode.F2D { 33 | 34 | @Override 35 | public Instruction execute (ThreadInfo ti) { 36 | StackFrame sf = ti.getTopFrame(); 37 | 38 | if(sf.getOperandAttr() == null) { 39 | return super.execute(ti); 40 | } 41 | 42 | ConcolicUtil.Pair val = ConcolicUtil.popFloat(sf); 43 | 44 | float f = val.conc; 45 | CastExpression cast = CastExpression.create( 46 | val.symb, BuiltinTypes.DOUBLE); 47 | 48 | ConcolicUtil.Pair result = new ConcolicUtil.Pair( new Double(f), cast); 49 | ConcolicUtil.pushDouble(result, sf); 50 | 51 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute F2D: " + result); 52 | return getNext(ti); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/F2I.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | 19 | 20 | import gov.nasa.jpf.constraints.expressions.CastExpression; 21 | import gov.nasa.jpf.constraints.types.BuiltinTypes; 22 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 23 | import gov.nasa.jpf.jdart.ConcolicUtil; 24 | import gov.nasa.jpf.vm.Instruction; 25 | import gov.nasa.jpf.vm.StackFrame; 26 | import gov.nasa.jpf.vm.ThreadInfo; 27 | 28 | /** 29 | * Convert float to int 30 | * ..., value => ..., result 31 | */ 32 | public class F2I extends gov.nasa.jpf.jvm.bytecode.F2I { 33 | 34 | @Override 35 | public Instruction execute (ThreadInfo ti) { 36 | StackFrame sf = ti.getTopFrame(); 37 | 38 | if(sf.getOperandAttr() == null) { 39 | return super.execute(ti); 40 | } 41 | 42 | ConcolicUtil.Pair val = ConcolicUtil.popFloat(sf); 43 | 44 | float f = val.conc; 45 | CastExpression cast = CastExpression.create( 46 | val.symb, BuiltinTypes.SINT32); 47 | 48 | ConcolicUtil.Pair result = new ConcolicUtil.Pair( (int)f, cast); 49 | ConcolicUtil.pushInt(result, sf); 50 | 51 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute F2I: " + result); 52 | return getNext(ti); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/F2L.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.CastExpression; 19 | import gov.nasa.jpf.constraints.types.BuiltinTypes; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | 27 | /** 28 | * Convert float to long 29 | * ..., value => ..., result 30 | */ 31 | public class F2L extends gov.nasa.jpf.jvm.bytecode.F2L { 32 | 33 | @Override 34 | public Instruction execute (ThreadInfo ti) { 35 | StackFrame sf = ti.getTopFrame(); 36 | 37 | if(sf.getOperandAttr() == null) { 38 | return super.execute(ti); 39 | } 40 | 41 | ConcolicUtil.Pair val = ConcolicUtil.popFloat(sf); 42 | 43 | float f = val.conc; 44 | CastExpression cast = CastExpression.create( 45 | val.symb, BuiltinTypes.SINT64); 46 | 47 | ConcolicUtil.Pair result = new ConcolicUtil.Pair( (long) f, cast); 48 | ConcolicUtil.pushLong(result, sf); 49 | 50 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute F2L: " + result); 51 | return getNext(ti); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/FADD.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericCompound; 19 | import gov.nasa.jpf.constraints.expressions.NumericOperator; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | public class FADD extends gov.nasa.jpf.jvm.bytecode.FADD { 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | StackFrame sf = ti.getTopFrame(); 31 | 32 | if(sf.getOperandAttr(0) ==null && sf.getOperandAttr(1)==null) { 33 | return super.execute(ti); 34 | } 35 | 36 | ConcolicUtil.Pair right = ConcolicUtil.popFloat(sf); 37 | ConcolicUtil.Pair left = ConcolicUtil.popFloat(sf); 38 | 39 | NumericCompound symb = new NumericCompound( 40 | left.symb, NumericOperator.PLUS, right.symb); 41 | 42 | float conc = left.conc + right.conc; 43 | 44 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 45 | ConcolicUtil.pushFloat(result, sf); 46 | 47 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute FADD: " + result); 48 | return getNext(ti); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/FNEG.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.UnaryMinus; 19 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 20 | import gov.nasa.jpf.jdart.ConcolicUtil; 21 | import gov.nasa.jpf.vm.Instruction; 22 | import gov.nasa.jpf.vm.StackFrame; 23 | import gov.nasa.jpf.vm.ThreadInfo; 24 | 25 | /** 26 | * Negate float ..., value => ..., result 27 | */ 28 | public class FNEG extends gov.nasa.jpf.jvm.bytecode.FNEG { 29 | 30 | @Override 31 | public Instruction execute(ThreadInfo ti) { 32 | StackFrame sf = ti.getTopFrame(); 33 | 34 | if (sf.getOperandAttr() == null) { 35 | return super.execute(ti); 36 | } 37 | 38 | ConcolicUtil.Pair negated = ConcolicUtil.popFloat(sf); 39 | 40 | UnaryMinus symb = new UnaryMinus(negated.symb); 41 | float conc = -negated.conc; 42 | 43 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 44 | ConcolicUtil.pushFloat(result, sf); 45 | 46 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute FNEG: " + result); 47 | return getNext(ti); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/I2B.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 19 | import gov.nasa.jpf.jdart.ConcolicUtil; 20 | import gov.nasa.jpf.vm.Instruction; 21 | import gov.nasa.jpf.vm.StackFrame; 22 | import gov.nasa.jpf.vm.ThreadInfo; 23 | 24 | 25 | 26 | /** 27 | * Convert int to byte 28 | * ..., value => ..., result 29 | */ 30 | public class I2B extends gov.nasa.jpf.jvm.bytecode.I2B { 31 | 32 | @Override 33 | public Instruction execute (ThreadInfo ti) { 34 | StackFrame sf = ti.getTopFrame(); 35 | 36 | if(sf.getOperandAttr() == null) { 37 | return super.execute(ti); 38 | } 39 | 40 | ConcolicUtil.Pair val = ConcolicUtil.popByte(sf); 41 | 42 | ConcolicUtil.pushByte(val, sf); 43 | 44 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute I2B: " + val.symb); 45 | return getNext(ti); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/I2C.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 19 | import gov.nasa.jpf.jdart.ConcolicUtil; 20 | import gov.nasa.jpf.vm.Instruction; 21 | import gov.nasa.jpf.vm.StackFrame; 22 | import gov.nasa.jpf.vm.ThreadInfo; 23 | 24 | 25 | /** 26 | * Convert int to character 27 | * ..., value => ..., result 28 | */ 29 | public class I2C extends gov.nasa.jpf.jvm.bytecode.I2C { 30 | 31 | @Override 32 | public Instruction execute (ThreadInfo ti) { 33 | StackFrame sf = ti.getTopFrame(); 34 | 35 | if(sf.getOperandAttr() == null) { 36 | return super.execute(ti); 37 | } 38 | 39 | ConcolicUtil.Pair val = ConcolicUtil.popChar(sf); 40 | 41 | ConcolicUtil.pushChar(val, sf); 42 | 43 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute I2C: " + val.symb); 44 | return getNext(ti); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/I2D.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | 19 | import gov.nasa.jpf.constraints.expressions.CastExpression; 20 | import gov.nasa.jpf.constraints.types.BuiltinTypes; 21 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 22 | import gov.nasa.jpf.jdart.ConcolicUtil; 23 | import gov.nasa.jpf.vm.Instruction; 24 | import gov.nasa.jpf.vm.StackFrame; 25 | import gov.nasa.jpf.vm.ThreadInfo; 26 | 27 | 28 | /** 29 | * Convert int to double 30 | * ..., value => ..., result 31 | */ 32 | public class I2D extends gov.nasa.jpf.jvm.bytecode.I2D { 33 | 34 | @Override 35 | public Instruction execute(ThreadInfo ti) { 36 | StackFrame sf = ti.getTopFrame(); 37 | 38 | // value concrete => no symbolic computation needed. 39 | if (sf.getOperandAttr() == null) { 40 | return super.execute(ti); 41 | } 42 | 43 | ConcolicUtil.Pair val = ConcolicUtil.popInt(sf); 44 | 45 | double i = (double) ((int) val.conc); 46 | CastExpression cast = CastExpression.create(val.symb, BuiltinTypes.DOUBLE); 47 | 48 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(i, cast); 49 | ConcolicUtil.pushDouble(result, sf); 50 | 51 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute I2D: " + result); 52 | return getNext(ti); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/I2F.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.CastExpression; 19 | import gov.nasa.jpf.constraints.types.BuiltinTypes; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | /** 27 | * Convert int to float 28 | * ..., value =>..., result 29 | */ 30 | public class I2F extends gov.nasa.jpf.jvm.bytecode.I2F { 31 | 32 | @Override 33 | public Instruction execute (ThreadInfo ti) { 34 | StackFrame sf = ti.getTopFrame(); 35 | 36 | if(sf.getOperandAttr() == null) { 37 | return super.execute(ti); 38 | } 39 | 40 | ConcolicUtil.Pair val = ConcolicUtil.popInt(sf); 41 | 42 | int i = val.conc; 43 | CastExpression cast = CastExpression.create( 44 | val.symb, BuiltinTypes.FLOAT); 45 | 46 | ConcolicUtil.Pair result = new ConcolicUtil.Pair( (float)i, cast); 47 | ConcolicUtil.pushFloat(result, sf); 48 | 49 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute I2F: " + result); 50 | return getNext(ti); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/I2L.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.CastExpression; 19 | import gov.nasa.jpf.constraints.types.BuiltinTypes; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | 27 | 28 | /** 29 | * Convert int to long 30 | * ..., value => ..., result 31 | */ 32 | public class I2L extends gov.nasa.jpf.jvm.bytecode.I2L { 33 | 34 | @Override 35 | public Instruction execute(ThreadInfo ti) { 36 | StackFrame sf = ti.getTopFrame(); 37 | 38 | // value concrete => no symbolic computation needed. 39 | if (sf.getOperandAttr() == null) { 40 | return super.execute(ti); 41 | } 42 | 43 | ConcolicUtil.Pair val = ConcolicUtil.popInt(sf); 44 | 45 | int i = val.conc; 46 | CastExpression cast = CastExpression.create(val.symb, BuiltinTypes.SINT64); 47 | 48 | ConcolicUtil.Pair result = new ConcolicUtil.Pair( (long)i, cast); 49 | ConcolicUtil.pushLong(result, sf); 50 | 51 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute I2L: " + result); 52 | return getNext(ti); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/I2S.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 19 | import gov.nasa.jpf.jdart.ConcolicUtil; 20 | import gov.nasa.jpf.vm.Instruction; 21 | import gov.nasa.jpf.vm.StackFrame; 22 | import gov.nasa.jpf.vm.ThreadInfo; 23 | 24 | 25 | 26 | /** 27 | * Convert int to short 28 | * ..., value => ..., result 29 | */ 30 | public class I2S extends gov.nasa.jpf.jvm.bytecode.I2S { 31 | 32 | @Override 33 | public Instruction execute(ThreadInfo ti) { 34 | StackFrame sf = ti.getTopFrame(); 35 | 36 | // value concrete => no symbolic computation needed. 37 | if (sf.getOperandAttr() == null) { 38 | return super.execute(ti); 39 | } 40 | 41 | ConcolicUtil.Pair val = ConcolicUtil.popShort(sf); 42 | 43 | ConcolicUtil.pushShort(val, sf); 44 | 45 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute I2S: " + val.symb); 46 | return getNext(ti); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IADD.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericCompound; 19 | import gov.nasa.jpf.constraints.expressions.NumericOperator; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.jdart.ConcolicUtil.Pair; 23 | import gov.nasa.jpf.vm.Instruction; 24 | import gov.nasa.jpf.vm.StackFrame; 25 | import gov.nasa.jpf.vm.ThreadInfo; 26 | 27 | public class IADD extends gov.nasa.jpf.jvm.bytecode.IADD { 28 | 29 | @Override 30 | public Instruction execute (ThreadInfo ti) { 31 | StackFrame sf = ti.getTopFrame(); 32 | 33 | if(sf.getOperandAttr(0) ==null && sf.getOperandAttr(1)==null) { 34 | return super.execute(ti); 35 | } 36 | 37 | ConcolicUtil.Pair right = ConcolicUtil.popInt(sf); 38 | ConcolicUtil.Pair left = ConcolicUtil.popInt(sf); 39 | 40 | NumericCompound symb = new NumericCompound( 41 | left.symb, NumericOperator.PLUS, right.symb); 42 | 43 | int conc = left.conc + right.conc; 44 | 45 | Pair result = new Pair(conc, symb); 46 | ConcolicUtil.pushInt(result, sf); 47 | 48 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute IADD: " + result); 49 | return getNext(ti); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IAND.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.BitvectorExpression; 19 | import gov.nasa.jpf.constraints.expressions.BitvectorOperator; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | public class IAND extends gov.nasa.jpf.jvm.bytecode.IAND { 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | StackFrame sf = ti.getTopFrame(); 31 | 32 | if(sf.getOperandAttr(0) ==null && sf.getOperandAttr(1)==null) { 33 | return super.execute(ti); 34 | } 35 | 36 | ConcolicUtil.Pair right = ConcolicUtil.popInt(sf); 37 | ConcolicUtil.Pair left = ConcolicUtil.popInt(sf); 38 | 39 | BitvectorExpression symb = BitvectorExpression.create( 40 | left.symb, BitvectorOperator.AND, right.symb); 41 | 42 | int conc = left.conc & right.conc; 43 | 44 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 45 | ConcolicUtil.pushInt(result, sf); 46 | 47 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute IAND: " + result); 48 | return getNext(ti); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IFEQ.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericComparator; 19 | import gov.nasa.jpf.vm.Instruction; 20 | import gov.nasa.jpf.vm.ThreadInfo; 21 | 22 | // we should factor out some of the code and put it in a parent class for all "if statements" 23 | 24 | public class IFEQ extends gov.nasa.jpf.jvm.bytecode.IFEQ { 25 | 26 | public IFEQ(int targetPosition) { 27 | super(targetPosition); 28 | } 29 | 30 | @Override 31 | public Instruction execute (ThreadInfo ti) { 32 | Instruction next = IFHelper.execute(this, NumericComparator.EQ, ti); 33 | if(next == null) 34 | return super.execute(ti); 35 | 36 | conditionValue = (next == this.target); 37 | return next; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IFGE.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericComparator; 19 | import gov.nasa.jpf.vm.Instruction; 20 | import gov.nasa.jpf.vm.ThreadInfo; 21 | 22 | // we should factor out some of the code and put it in a parent class for all "if statements" 23 | 24 | public class IFGE extends gov.nasa.jpf.jvm.bytecode.IFGE { 25 | 26 | public IFGE(int targetPosition) { 27 | super(targetPosition); 28 | } 29 | 30 | @Override 31 | public Instruction execute (ThreadInfo ti) { 32 | Instruction next = IFHelper.execute(this, NumericComparator.GE, ti); 33 | if(next == null) 34 | return super.execute(ti); 35 | 36 | conditionValue = (next == this.target); 37 | return next; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IFGT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | 19 | import gov.nasa.jpf.constraints.expressions.NumericComparator; 20 | import gov.nasa.jpf.vm.Instruction; 21 | import gov.nasa.jpf.vm.ThreadInfo; 22 | 23 | // we should factor out some of the code and put it in a parent class for all "if statements" 24 | 25 | public class IFGT extends gov.nasa.jpf.jvm.bytecode.IFGT { 26 | 27 | public IFGT(int targetPosition) { 28 | super(targetPosition); 29 | } 30 | 31 | @Override 32 | public Instruction execute (ThreadInfo ti) { 33 | Instruction next = IFHelper.execute(this, NumericComparator.GT, ti); 34 | if(next == null) 35 | return super.execute(ti); 36 | 37 | conditionValue = (next == this.target); 38 | return next; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IFLE.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericComparator; 19 | import gov.nasa.jpf.vm.Instruction; 20 | import gov.nasa.jpf.vm.ThreadInfo; 21 | 22 | // we should factor out some of the code and put it in a parent class for all "if statements" 23 | 24 | public class IFLE extends gov.nasa.jpf.jvm.bytecode.IFLE { 25 | 26 | public IFLE(int targetPosition) { 27 | super(targetPosition); 28 | } 29 | 30 | @Override 31 | public Instruction execute (ThreadInfo ti) { 32 | Instruction next = IFHelper.execute(this, NumericComparator.LE, ti); 33 | if(next == null) 34 | return super.execute(ti); 35 | 36 | conditionValue = (next == this.target); 37 | return next; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IFLT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | 19 | import gov.nasa.jpf.constraints.expressions.NumericComparator; 20 | import gov.nasa.jpf.vm.Instruction; 21 | import gov.nasa.jpf.vm.ThreadInfo; 22 | 23 | // we should factor out some of the code and put it in a parent class for all "if statements" 24 | 25 | public class IFLT extends gov.nasa.jpf.jvm.bytecode.IFLT { 26 | 27 | public IFLT(int targetPosition) { 28 | super(targetPosition); 29 | } 30 | 31 | @Override 32 | public Instruction execute (ThreadInfo ti) { 33 | Instruction next = IFHelper.execute(this, NumericComparator.LT, ti); 34 | if(next == null) 35 | return super.execute(ti); 36 | 37 | conditionValue = (next == this.target); 38 | return next; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IFNE.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericComparator; 19 | import gov.nasa.jpf.vm.Instruction; 20 | import gov.nasa.jpf.vm.ThreadInfo; 21 | 22 | // we should factor out some of the code and put it in a parent class for all "if statements" 23 | 24 | public class IFNE extends gov.nasa.jpf.jvm.bytecode.IFNE { 25 | 26 | public IFNE(int targetPosition) { 27 | super(targetPosition); 28 | } 29 | 30 | @Override 31 | public Instruction execute (ThreadInfo ti) { 32 | Instruction next = IFHelper.execute(this, NumericComparator.NE, ti); 33 | if(next == null) 34 | return super.execute(ti); 35 | 36 | conditionValue = (next == this.target); 37 | return next; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IFNONNULL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 19 | import gov.nasa.jpf.vm.Instruction; 20 | import gov.nasa.jpf.vm.StackFrame; 21 | import gov.nasa.jpf.vm.ThreadInfo; 22 | 23 | // we should factor out some of the code and put it in a parent class for all "if statements" 24 | // TODO: to review: approximation 25 | 26 | public class IFNONNULL extends gov.nasa.jpf.jvm.bytecode.IFNONNULL { 27 | public IFNONNULL (int targetPc) { 28 | super(targetPc); 29 | } 30 | @Override 31 | public Instruction execute (ThreadInfo ti) { 32 | StackFrame sf = ti.getTopFrame(); 33 | 34 | if(sf.getOperandAttr() == null) { 35 | return super.execute(ti); 36 | } 37 | 38 | // the condition is symbolic 39 | ti.popFrame(); 40 | 41 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute IFNONNULL. " + sf.getOperandAttr()); 42 | conditionValue = true; 43 | 44 | return getNext(ti); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IFNULL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 19 | import gov.nasa.jpf.vm.Instruction; 20 | import gov.nasa.jpf.vm.StackFrame; 21 | import gov.nasa.jpf.vm.ThreadInfo; 22 | 23 | 24 | // we should factor out some of the code and put it in a parent class for all "if statements" 25 | //TODO: to review: approximation 26 | 27 | public class IFNULL extends gov.nasa.jpf.jvm.bytecode.IFNULL { 28 | 29 | public IFNULL (int targetPc) { 30 | super(targetPc); 31 | } 32 | 33 | @Override 34 | public Instruction execute (ThreadInfo ti) { 35 | StackFrame sf = ti.getTopFrame(); 36 | 37 | if(sf.getOperandAttr() == null) { 38 | return super.execute(ti); 39 | } 40 | 41 | // the condition is symbolic 42 | ti.popFrame(); 43 | 44 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute IFNULL. " + sf.getOperandAttr()); 45 | conditionValue = true; 46 | 47 | return getNext(ti); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IF_ICMPEQ.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericComparator; 19 | import gov.nasa.jpf.vm.Instruction; 20 | import gov.nasa.jpf.vm.ThreadInfo; 21 | 22 | public class IF_ICMPEQ extends gov.nasa.jpf.jvm.bytecode.IF_ICMPEQ{ 23 | 24 | public IF_ICMPEQ(int targetPosition) { 25 | super(targetPosition); 26 | } 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | Instruction res = IF_ICMPHelper.execute(this, NumericComparator.EQ, ti); 31 | if(res != null) { 32 | conditionValue = (res == this.target); 33 | return res; 34 | } 35 | return super.execute(ti); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IF_ICMPGE.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericComparator; 19 | import gov.nasa.jpf.vm.Instruction; 20 | import gov.nasa.jpf.vm.ThreadInfo; 21 | 22 | public class IF_ICMPGE extends gov.nasa.jpf.jvm.bytecode.IF_ICMPGE{ 23 | 24 | public IF_ICMPGE(int targetPosition) { 25 | super(targetPosition); 26 | } 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | Instruction res = IF_ICMPHelper.execute(this, NumericComparator.GE, ti); 31 | if(res != null) { 32 | conditionValue = (res == this.target); 33 | return res; 34 | } 35 | 36 | return super.execute(ti); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IF_ICMPGT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericComparator; 19 | import gov.nasa.jpf.vm.Instruction; 20 | import gov.nasa.jpf.vm.ThreadInfo; 21 | 22 | public class IF_ICMPGT extends gov.nasa.jpf.jvm.bytecode.IF_ICMPGT{ 23 | 24 | public IF_ICMPGT(int targetPosition) { 25 | super(targetPosition); 26 | } 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | Instruction res = IF_ICMPHelper.execute(this, NumericComparator.GT, ti); 31 | if(res != null) { 32 | conditionValue = (res == this.target); 33 | return res; 34 | } 35 | 36 | return super.execute(ti); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IF_ICMPLE.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericComparator; 19 | import gov.nasa.jpf.vm.Instruction; 20 | import gov.nasa.jpf.vm.ThreadInfo; 21 | 22 | 23 | public class IF_ICMPLE extends gov.nasa.jpf.jvm.bytecode.IF_ICMPLE{ 24 | 25 | public IF_ICMPLE(int targetPosition) { 26 | super(targetPosition); 27 | } 28 | 29 | @Override 30 | public Instruction execute (ThreadInfo ti) { 31 | Instruction res = IF_ICMPHelper.execute(this, NumericComparator.LE, ti); 32 | if(res != null) { 33 | conditionValue = (res == this.target); 34 | return res; 35 | } 36 | 37 | return super.execute(ti); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IF_ICMPLT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericComparator; 19 | import gov.nasa.jpf.vm.Instruction; 20 | import gov.nasa.jpf.vm.ThreadInfo; 21 | 22 | public class IF_ICMPLT extends gov.nasa.jpf.jvm.bytecode.IF_ICMPLT{ 23 | 24 | public IF_ICMPLT(int targetPosition) { 25 | super(targetPosition); 26 | } 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | Instruction res = IF_ICMPHelper.execute(this, NumericComparator.LT, ti); 31 | if(res != null) { 32 | conditionValue = (res == this.target); 33 | return res; 34 | } 35 | 36 | return super.execute(ti); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IF_ICMPNE.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericComparator; 19 | import gov.nasa.jpf.vm.Instruction; 20 | import gov.nasa.jpf.vm.ThreadInfo; 21 | 22 | public class IF_ICMPNE extends gov.nasa.jpf.jvm.bytecode.IF_ICMPNE{ 23 | 24 | public IF_ICMPNE(int targetPosition) { 25 | super(targetPosition); 26 | } 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | Instruction res = IF_ICMPHelper.execute(this, NumericComparator.NE, ti); 31 | if(res != null) { 32 | conditionValue = (res == this.target); 33 | return res; 34 | } 35 | 36 | return super.execute(ti); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IMUL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericCompound; 19 | import gov.nasa.jpf.constraints.expressions.NumericOperator; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | public class IMUL extends gov.nasa.jpf.jvm.bytecode.IMUL { 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | StackFrame sf = ti.getTopFrame(); 31 | 32 | if(sf.getOperandAttr(0) ==null && sf.getOperandAttr(1)==null) { 33 | return super.execute(ti); 34 | } 35 | 36 | ConcolicUtil.Pair right = ConcolicUtil.popInt(sf); 37 | ConcolicUtil.Pair left = ConcolicUtil.popInt(sf); 38 | 39 | NumericCompound symb = new NumericCompound( 40 | left.symb, NumericOperator.MUL, right.symb); 41 | 42 | int conc = left.conc * right.conc; 43 | 44 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 45 | ConcolicUtil.pushInt(result, sf); 46 | 47 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute IMUL: " + result); 48 | return getNext(ti); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/INEG.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.UnaryMinus; 19 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 20 | import gov.nasa.jpf.jdart.ConcolicUtil; 21 | import gov.nasa.jpf.vm.Instruction; 22 | import gov.nasa.jpf.vm.StackFrame; 23 | import gov.nasa.jpf.vm.ThreadInfo; 24 | 25 | public class INEG extends gov.nasa.jpf.jvm.bytecode.INEG{ 26 | 27 | @Override 28 | public Instruction execute(ThreadInfo ti) { 29 | StackFrame sf = ti.getTopFrame(); 30 | 31 | if (sf.getOperandAttr() == null) { 32 | return super.execute(ti); 33 | } 34 | 35 | ConcolicUtil.Pair negated = ConcolicUtil.popInt(sf); 36 | 37 | UnaryMinus symb = new UnaryMinus(negated.symb); 38 | int conc = -negated.conc; 39 | 40 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 41 | ConcolicUtil.pushInt(result, sf); 42 | 43 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute INEG: " + result); 44 | return getNext(ti); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IOR.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.BitvectorExpression; 19 | import gov.nasa.jpf.constraints.expressions.BitvectorOperator; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | public class IOR extends gov.nasa.jpf.jvm.bytecode.IOR { 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | StackFrame sf = ti.getTopFrame(); 31 | 32 | if(sf.getOperandAttr(0) ==null && sf.getOperandAttr(1)==null) { 33 | return super.execute(ti); 34 | } 35 | 36 | ConcolicUtil.Pair right = ConcolicUtil.popInt(sf); 37 | ConcolicUtil.Pair left = ConcolicUtil.popInt(sf); 38 | 39 | BitvectorExpression symb = BitvectorExpression.create( 40 | left.symb, BitvectorOperator.OR, right.symb); 41 | 42 | int conc = left.conc | right.conc; 43 | 44 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 45 | ConcolicUtil.pushInt(result, sf); 46 | 47 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute IOR: " + result); 48 | return getNext(ti); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IREM.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericCompound; 19 | import gov.nasa.jpf.constraints.expressions.NumericOperator; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | public class IREM extends gov.nasa.jpf.jvm.bytecode.IREM { 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | StackFrame sf = ti.getTopFrame(); 31 | 32 | if(sf.getOperandAttr(0) ==null && sf.getOperandAttr(1)==null) { 33 | return super.execute(ti); 34 | } 35 | 36 | ConcolicUtil.Pair right = ConcolicUtil.popInt(sf); 37 | ConcolicUtil.Pair left = ConcolicUtil.popInt(sf); 38 | 39 | NumericCompound symb = new NumericCompound( 40 | left.symb, NumericOperator.REM, right.symb); 41 | 42 | int conc = left.conc % right.conc; 43 | 44 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 45 | ConcolicUtil.pushInt(result, sf); 46 | 47 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute IREM: " + result); 48 | return getNext(ti); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/ISHL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.BitvectorExpression; 19 | import gov.nasa.jpf.constraints.expressions.BitvectorOperator; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | public class ISHL extends gov.nasa.jpf.jvm.bytecode.ISHL { 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | StackFrame sf = ti.getTopFrame(); 31 | 32 | if(sf.getOperandAttr(0) ==null && sf.getOperandAttr(1)==null) { 33 | return super.execute(ti); 34 | } 35 | 36 | ConcolicUtil.Pair right = ConcolicUtil.popInt(sf); 37 | ConcolicUtil.Pair left = ConcolicUtil.popInt(sf); 38 | 39 | BitvectorExpression symb = BitvectorExpression.create( 40 | left.symb, BitvectorOperator.SHIFTL, right.symb); 41 | 42 | int conc = left.conc << right.conc; 43 | 44 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 45 | ConcolicUtil.pushInt(result, sf); 46 | 47 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute ISHL: " + result); 48 | return getNext(ti); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/ISHR.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.BitvectorExpression; 19 | import gov.nasa.jpf.constraints.expressions.BitvectorOperator; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | public class ISHR extends gov.nasa.jpf.jvm.bytecode.ISHR { 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | StackFrame sf = ti.getTopFrame(); 31 | 32 | if(sf.getOperandAttr(0) ==null && sf.getOperandAttr(1)==null) { 33 | return super.execute(ti); 34 | } 35 | 36 | ConcolicUtil.Pair right = ConcolicUtil.popInt(sf); 37 | ConcolicUtil.Pair left = ConcolicUtil.popInt(sf); 38 | 39 | BitvectorExpression symb = BitvectorExpression.create( 40 | left.symb, BitvectorOperator.SHIFTR, right.symb); 41 | 42 | int conc = left.conc >> right.conc; 43 | 44 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 45 | ConcolicUtil.pushInt(result, sf); 46 | 47 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute ISHR: " + result); 48 | return getNext(ti); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/ISUB.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericCompound; 19 | import gov.nasa.jpf.constraints.expressions.NumericOperator; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | public class ISUB extends gov.nasa.jpf.jvm.bytecode.ISUB { 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | StackFrame sf = ti.getTopFrame(); 31 | 32 | if(sf.getOperandAttr(0) ==null && sf.getOperandAttr(1)==null) { 33 | return super.execute(ti); 34 | } 35 | 36 | ConcolicUtil.Pair right = ConcolicUtil.popInt(sf); 37 | ConcolicUtil.Pair left = ConcolicUtil.popInt(sf); 38 | 39 | NumericCompound symb = new NumericCompound( 40 | left.symb, NumericOperator.MINUS, right.symb); 41 | 42 | int conc = left.conc - right.conc; 43 | 44 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 45 | ConcolicUtil.pushInt(result, sf); 46 | 47 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute ISUB: " + result); 48 | return getNext(ti); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IUSHR.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.BitvectorExpression; 19 | import gov.nasa.jpf.constraints.expressions.BitvectorOperator; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | public class IUSHR extends gov.nasa.jpf.jvm.bytecode.IUSHR { 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | StackFrame sf = ti.getTopFrame(); 31 | 32 | if(sf.getOperandAttr(0) ==null && sf.getOperandAttr(1)==null) { 33 | return super.execute(ti); 34 | } 35 | 36 | ConcolicUtil.Pair right = ConcolicUtil.popInt(sf); 37 | ConcolicUtil.Pair left = ConcolicUtil.popInt(sf); 38 | 39 | BitvectorExpression symb = BitvectorExpression.create( 40 | left.symb, BitvectorOperator.SHIFTUR, right.symb); 41 | 42 | int conc = left.conc >>> right.conc; 43 | 44 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 45 | ConcolicUtil.pushInt(result, sf); 46 | 47 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute IUSHR: " + result); 48 | return getNext(ti); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/IXOR.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.BitvectorExpression; 19 | import gov.nasa.jpf.constraints.expressions.BitvectorOperator; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | public class IXOR extends gov.nasa.jpf.jvm.bytecode.IXOR { 27 | 28 | @Override 29 | public Instruction execute (ThreadInfo ti) { 30 | StackFrame sf = ti.getTopFrame(); 31 | 32 | if(sf.getOperandAttr(0) ==null && sf.getOperandAttr(1)==null) { 33 | return super.execute(ti); 34 | } 35 | 36 | ConcolicUtil.Pair right = ConcolicUtil.popInt(sf); 37 | ConcolicUtil.Pair left = ConcolicUtil.popInt(sf); 38 | 39 | BitvectorExpression symb = BitvectorExpression.create( 40 | left.symb, BitvectorOperator.XOR, right.symb); 41 | 42 | int conc = left.conc ^ right.conc; 43 | 44 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 45 | ConcolicUtil.pushInt(result, sf); 46 | 47 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute IXOR: " + result); 48 | return getNext(ti); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/L2D.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.CastExpression; 19 | import gov.nasa.jpf.constraints.types.BuiltinTypes; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | /** 27 | * Convert long to double 28 | * ..., value => ..., result 29 | */ 30 | public class L2D extends gov.nasa.jpf.jvm.bytecode.L2D { 31 | 32 | @Override 33 | public Instruction execute (ThreadInfo ti) { 34 | StackFrame sf = ti.getTopFrame(); 35 | 36 | if(sf.getOperandAttr() == null) { 37 | return super.execute(ti); 38 | } 39 | 40 | ConcolicUtil.Pair val = ConcolicUtil.popLong(sf); 41 | 42 | long f = val.conc; 43 | CastExpression cast = CastExpression.create( 44 | val.symb, BuiltinTypes.DOUBLE); 45 | 46 | ConcolicUtil.Pair result = new ConcolicUtil.Pair( (double)f , cast); 47 | ConcolicUtil.pushDouble(result, sf); 48 | 49 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute L2D: " + result); 50 | return getNext(ti); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/L2F.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.CastExpression; 19 | import gov.nasa.jpf.constraints.types.BuiltinTypes; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | /** 27 | * Convert long to float 28 | * ..., value => ..., result 29 | */ 30 | public class L2F extends gov.nasa.jpf.jvm.bytecode.L2F { 31 | 32 | @Override 33 | public Instruction execute (ThreadInfo ti) { 34 | StackFrame sf = ti.getTopFrame(); 35 | 36 | if(sf.getOperandAttr() == null) { 37 | return super.execute(ti); 38 | } 39 | 40 | ConcolicUtil.Pair val = ConcolicUtil.popLong(sf); 41 | 42 | long f = val.conc; 43 | CastExpression cast = CastExpression.create( 44 | val.symb, BuiltinTypes.FLOAT); 45 | 46 | ConcolicUtil.Pair result = new ConcolicUtil.Pair( (float)f , cast); 47 | ConcolicUtil.pushFloat(result, sf); 48 | 49 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute L2F: " + result); 50 | return getNext(ti); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/L2I.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.CastExpression; 19 | import gov.nasa.jpf.constraints.types.BuiltinTypes; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | 27 | 28 | /** 29 | * Convert Integer to Long 30 | * ..., value => ..., result 31 | */ 32 | public class L2I extends gov.nasa.jpf.jvm.bytecode.L2I { 33 | 34 | @Override 35 | public Instruction execute (ThreadInfo ti) { 36 | StackFrame sf = ti.getTopFrame(); 37 | 38 | if(sf.getOperandAttr() == null) { 39 | return super.execute(ti); 40 | } 41 | 42 | ConcolicUtil.Pair val = ConcolicUtil.popLong(sf); 43 | 44 | Long f = val.conc; 45 | CastExpression cast = CastExpression.create( 46 | val.symb, BuiltinTypes.SINT32); 47 | 48 | ConcolicUtil.Pair result = new ConcolicUtil.Pair( f.intValue() , cast); 49 | ConcolicUtil.pushInt(result, sf); 50 | 51 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute L2I: " + result); 52 | return getNext(ti); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/LMUL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.NumericCompound; 19 | import gov.nasa.jpf.constraints.expressions.NumericOperator; 20 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 21 | import gov.nasa.jpf.jdart.ConcolicUtil; 22 | import gov.nasa.jpf.vm.Instruction; 23 | import gov.nasa.jpf.vm.StackFrame; 24 | import gov.nasa.jpf.vm.ThreadInfo; 25 | 26 | 27 | /** 28 | * Multiply long 29 | * ..., value1, value2 => ..., result 30 | */ 31 | public class LMUL extends gov.nasa.jpf.jvm.bytecode.LMUL { 32 | 33 | @Override 34 | public Instruction execute (ThreadInfo ti) { 35 | StackFrame sf = ti.getTopFrame(); 36 | 37 | if (sf.getOperandAttr(1) == null && sf.getOperandAttr(3) == null) { 38 | return super.execute(ti); 39 | } 40 | 41 | ConcolicUtil.Pair right = ConcolicUtil.popLong(sf); 42 | ConcolicUtil.Pair left = ConcolicUtil.popLong(sf); 43 | 44 | NumericCompound symb = new NumericCompound( 45 | left.symb, NumericOperator.MUL, right.symb); 46 | 47 | long conc = left.conc * right.conc; 48 | 49 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 50 | ConcolicUtil.pushLong(result, sf); 51 | 52 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute LMUL: " + result); 53 | return getNext(ti); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/LNEG.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.constraints.expressions.UnaryMinus; 19 | import gov.nasa.jpf.jdart.ConcolicInstructionFactory; 20 | import gov.nasa.jpf.jdart.ConcolicUtil; 21 | import gov.nasa.jpf.vm.Instruction; 22 | import gov.nasa.jpf.vm.StackFrame; 23 | import gov.nasa.jpf.vm.ThreadInfo; 24 | 25 | 26 | /** 27 | * Negate long 28 | * ..., value => ..., result 29 | */ 30 | public class LNEG extends gov.nasa.jpf.jvm.bytecode.LNEG { 31 | 32 | @Override 33 | public Instruction execute(ThreadInfo ti) { 34 | StackFrame sf = ti.getTopFrame(); 35 | 36 | if (sf.getLongOperandAttr() == null) { 37 | return super.execute(ti); 38 | } 39 | 40 | ConcolicUtil.Pair negated = ConcolicUtil.popLong(sf); 41 | 42 | UnaryMinus symb = new UnaryMinus(negated.symb); 43 | long conc = -negated.conc; 44 | 45 | ConcolicUtil.Pair result = new ConcolicUtil.Pair(conc, symb); 46 | ConcolicUtil.pushLong(result, sf); 47 | 48 | if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute LNEG: " + result); 49 | return getNext(ti); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/LOOKUPSWITCH.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.vm.Instruction; 19 | import gov.nasa.jpf.vm.ThreadInfo; 20 | 21 | 22 | /** 23 | * Access jump table by key match and jump 24 | * ..., key => ... 25 | */ 26 | public class LOOKUPSWITCH extends gov.nasa.jpf.jvm.bytecode.LOOKUPSWITCH implements SwitchHelper.SwitchInstruction { 27 | 28 | public LOOKUPSWITCH (int defaultTarget, int numberOfTargets) { 29 | super(defaultTarget, numberOfTargets); 30 | } 31 | 32 | @Override 33 | public Instruction execute(ThreadInfo ti) { 34 | return SwitchHelper.execute(this, ti); 35 | } 36 | 37 | @Override 38 | public Instruction executeConcrete(ThreadInfo ti) { 39 | return super.execute(ti); 40 | } 41 | 42 | @Override 43 | public int chooseTarget(int concreteValue) { 44 | for(int i = 0; i < matches.length; i++) { 45 | if(concreteValue == matches[i]) 46 | return (lastIdx = i); 47 | } 48 | return (lastIdx = DEFAULT); 49 | } 50 | 51 | @Override 52 | public int getTargetValue(int targetIdx) { 53 | return matches[targetIdx]; 54 | } 55 | 56 | @Override 57 | public int getTargetPC(int targetIdx) { 58 | return (targetIdx == DEFAULT) ? target : targets[targetIdx]; 59 | } 60 | 61 | @Override 62 | public int getNumTargets() { 63 | return matches.length; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/TABLESWITCH.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.bytecode; 17 | 18 | import gov.nasa.jpf.vm.Instruction; 19 | import gov.nasa.jpf.vm.ThreadInfo; 20 | 21 | /** 22 | * Access jump table by index and jump 23 | * ..., index ... 24 | */ 25 | public class TABLESWITCH extends gov.nasa.jpf.jvm.bytecode.TABLESWITCH implements SwitchHelper.SwitchInstruction { 26 | 27 | private int min; 28 | 29 | public TABLESWITCH(int defaultTarget, int min, int max){ 30 | super(defaultTarget, min, max); 31 | this.min = min; 32 | } 33 | 34 | @Override 35 | public Instruction executeConcrete(ThreadInfo ti) { 36 | return super.execute(ti); 37 | } 38 | 39 | @Override 40 | public int chooseTarget(int concreteValue) { 41 | int i = concreteValue - min; 42 | if(i < 0 || i >= targets.length) 43 | return (lastIdx = DEFAULT); 44 | return (lastIdx = i); 45 | } 46 | 47 | @Override 48 | public int getTargetValue(int targetIdx) { 49 | return targetIdx + min; 50 | } 51 | 52 | @Override 53 | public int getTargetPC(int targetIdx) { 54 | if (targetIdx == DEFAULT) { 55 | return target; 56 | } 57 | return targets[targetIdx]; 58 | } 59 | 60 | @Override 61 | public int getNumTargets() { 62 | return targets.length; 63 | } 64 | 65 | @Override 66 | public Instruction execute(ThreadInfo ti) { 67 | return SwitchHelper.execute(this, ti); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/bytecode/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Package-level Javadoc 6 | 7 | 8 | 9 | This package contains jdart (concrete and symbolic) bytecodes. 10 | 11 |

Package Specification

12 | 13 |

14 | These bytecodes execute both concretely and symbolically. Meaning the concrete values 15 | are preserved and the symbolic attributes are passed along to the output. 16 |

17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/config/ConcolicValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | package gov.nasa.jpf.jdart.config; 18 | 19 | import gov.nasa.jpf.constraints.api.Valuation; 20 | import gov.nasa.jpf.constraints.api.ValuationEntry; 21 | import gov.nasa.jpf.constraints.api.Variable; 22 | import gov.nasa.jpf.constraints.types.Type; 23 | import gov.nasa.jpf.jdart.ConcolicUtil; 24 | 25 | /** 26 | * 27 | */ 28 | public abstract class ConcolicValues { 29 | 30 | public abstract boolean hasNext(); 31 | 32 | public abstract Valuation next(); 33 | 34 | protected static Valuation parseValuation(String text, MethodSpec spec) { 35 | text = text.trim(); 36 | String[] values = text.split(","); 37 | Valuation vltn = new Valuation(); 38 | assert values.length == spec.getParams().size(); 39 | for (int i=0; i(v, value)); 45 | } 46 | return vltn; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/config/ConcolicValuesFromConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.config; 17 | 18 | import gov.nasa.jpf.constraints.api.Valuation; 19 | import gov.nasa.jpf.constraints.api.ValuationEntry; 20 | import gov.nasa.jpf.constraints.api.Variable; 21 | import gov.nasa.jpf.constraints.types.Type; 22 | import gov.nasa.jpf.jdart.ConcolicUtil; 23 | import java.util.LinkedList; 24 | import java.util.StringTokenizer; 25 | 26 | /** 27 | * 28 | */ 29 | public class ConcolicValuesFromConfig extends ConcolicValues { 30 | 31 | private final LinkedList vals = new LinkedList<>(); 32 | 33 | public ConcolicValuesFromConfig(MethodSpec spec, String text) { 34 | if (text == null) { 35 | return; 36 | } 37 | text = text.trim(); 38 | StringTokenizer tok = new StringTokenizer(text, ";"); 39 | while (tok.hasMoreTokens()) { 40 | String valString = tok.nextToken().trim(); 41 | Valuation vltn = parseValuation(valString, spec); 42 | this.vals.add(vltn); 43 | } 44 | } 45 | 46 | @Override 47 | public boolean hasNext() { 48 | return !vals.isEmpty(); 49 | } 50 | 51 | @Override 52 | public Valuation next() { 53 | return vals.poll(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/constraints/PathState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.constraints; 17 | 18 | /** 19 | * Final state of a program path 20 | */ 21 | public enum PathState { 22 | OK, 23 | ERROR, // path leads to exception 24 | DONT_KNOW, // constrained for path could not be solved 25 | } 26 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/objects/ReferenceArrayHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.objects; 17 | 18 | import gov.nasa.jpf.vm.ClassInfo; 19 | import gov.nasa.jpf.vm.ElementInfo; 20 | import gov.nasa.jpf.vm.Heap; 21 | 22 | /** 23 | * Allows to handle arrays of reference types symbolically. 24 | * 25 | * 26 | */ 27 | class ReferenceArrayHandler implements SymbolicObjectHandler { 28 | 29 | /* 30 | * (non-Javadoc) 31 | * @see gov.nasa.jpf.jdart.objects.SymbolicObjectHandler#initialize(gov.nasa.jpf.vm.ClassInfo) 32 | */ 33 | @Override 34 | public boolean initialize(ClassInfo ci) { 35 | return ci.isReferenceArray(); 36 | } 37 | 38 | /* 39 | * (non-Javadoc) 40 | * @see gov.nasa.jpf.jdart.objects.SymbolicObjectHandler#annotateObject(gov.nasa.jpf.vm.ElementInfo, java.lang.String, gov.nasa.jpf.jdart.objects.SymbolicObjectsContext) 41 | */ 42 | @Override 43 | public void annotateObject(ElementInfo ei, String name, 44 | SymbolicObjectsContext ctx) { 45 | int size = ei.arrayLength(); 46 | 47 | Heap heap = ctx.getHeap(); 48 | for(int i = 0; i < size; i++) { 49 | int elemRef = ei.getReferenceElement(i); 50 | ElementInfo elem = heap.get(elemRef); 51 | if(elem != null) { 52 | ctx.processElement(ei, i, name + "[" + i + "]", false); 53 | } 54 | } 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/objects/StringHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.objects; 17 | 18 | import gov.nasa.jpf.vm.ClassInfo; 19 | import gov.nasa.jpf.vm.ElementInfo; 20 | 21 | /** 22 | * Symbolic object "handler" for {@link String}s. The sole purpose of 23 | * this class is to ensure that {@link String}s are never 24 | * handled symbolically! 25 | * 26 | * 27 | */ 28 | class StringHandler implements SymbolicObjectHandler { 29 | 30 | /* 31 | * (non-Javadoc) 32 | * @see gov.nasa.jpf.jdart.objects.SymbolicObjectHandler#annotateObject(gov.nasa.jpf.vm.ElementInfo, java.lang.String, gov.nasa.jpf.jdart.objects.SymbolicObjectsContext) 33 | */ 34 | @Override 35 | public void annotateObject(ElementInfo ei, String name, 36 | SymbolicObjectsContext ctx) { 37 | // Strings are NEVER symbolic 38 | } 39 | 40 | /* 41 | * (non-Javadoc) 42 | * @see gov.nasa.jpf.jdart.objects.SymbolicObjectHandler#initialize(gov.nasa.jpf.vm.ClassInfo) 43 | */ 44 | @Override 45 | public boolean initialize(ClassInfo ci) { 46 | return String.class.getName().equals(ci.getName()); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/objects/SymbolicObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.objects; 17 | 18 | public final class SymbolicObject { 19 | 20 | private final String name; 21 | 22 | public SymbolicObject(String name) { 23 | this.name = name; 24 | } 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | /* 31 | * (non-Javadoc) 32 | * @see java.lang.Object#toString() 33 | */ 34 | @Override 35 | public String toString() { 36 | return name; 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/objects/SymbolicObjectHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.objects; 17 | 18 | import gov.nasa.jpf.vm.ClassInfo; 19 | import gov.nasa.jpf.vm.ElementInfo; 20 | 21 | /** 22 | * Interface for handlers that enable symbolic handling of objects. 23 | * 24 | * 25 | */ 26 | interface SymbolicObjectHandler { 27 | 28 | /** 29 | * Initializes a class with this handler. Note that this 30 | * method is called at most once per {@link ClassInfo} object. 31 | * 32 | * Any {@link ClassInfo} object may be passed to this method. If 33 | * it refers to one of the classes the handler is designed for, 34 | * initializations should be performed and a value of 35 | * true be returned. Otherwise, false should 36 | * be returned and no action be taken. 37 | * 38 | * @param ci the class info. 39 | * @return true if the handler matches the specified class, 40 | * false otherwise. 41 | */ 42 | public boolean initialize(ClassInfo ci); 43 | 44 | 45 | /** 46 | * Annotates an object with symbolic information, using name 47 | * as the name prefix for this object. 48 | * 49 | * @param ei the object to annotate 50 | * @param name the symbolic name of this object 51 | * @param ctx the context 52 | */ 53 | public void annotateObject(ElementInfo ei, String name, SymbolicObjectsContext ctx); 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/regressions/TestOracle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.regressions; 17 | 18 | import gov.nasa.jpf.jdart.ConcolicExplorer; 19 | 20 | /** 21 | * Test oracle used by regression tests. 22 | * 23 | */ 24 | public interface TestOracle { 25 | 26 | public boolean verdict(ConcolicExplorer exp); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/solvers/selective/CombinationFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.solvers.selective; 17 | 18 | import gov.nasa.jpf.constraints.api.Expression; 19 | 20 | /** 21 | * 22 | */ 23 | public class CombinationFilter implements ExpressionFilter { 24 | 25 | private final ExpressionFilter[] filters; 26 | 27 | public CombinationFilter(ExpressionFilter[] filters) { 28 | this.filters = filters; 29 | } 30 | 31 | @Override 32 | public boolean submitToSolver(Expression e) { 33 | for (ExpressionFilter f : filters) { 34 | if (!f.submitToSolver(e)) { 35 | return false; 36 | } 37 | } 38 | return true; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/solvers/selective/ExpressionFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.solvers.selective; 17 | 18 | import gov.nasa.jpf.constraints.api.Expression; 19 | 20 | /** 21 | * 22 | */ 23 | public interface ExpressionFilter { 24 | 25 | /** 26 | * checks if an expression should be passed to the solver 27 | * 28 | * @param e expression to be tested 29 | * @return true if e should be passed to the solver 30 | */ 31 | public boolean submitToSolver(Expression e); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/solvers/selective/SimpleSelectiveSolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.solvers.selective; 17 | 18 | import gov.nasa.jpf.constraints.api.ConstraintSolver; 19 | import gov.nasa.jpf.constraints.api.Expression; 20 | import gov.nasa.jpf.constraints.api.SolverContext; 21 | import gov.nasa.jpf.constraints.api.Valuation; 22 | 23 | /** 24 | * 25 | */ 26 | public class SimpleSelectiveSolver extends ConstraintSolver { 27 | 28 | private final ConstraintSolver solver; 29 | 30 | private final ExpressionFilter filter; 31 | 32 | private final boolean evaluate; 33 | 34 | public SimpleSelectiveSolver(ConstraintSolver solver, ExpressionFilter filter, boolean evaluate) { 35 | this.solver = solver; 36 | this.filter = filter; 37 | this.evaluate = evaluate; 38 | } 39 | 40 | @Override 41 | public Result solve(Expression exprsn, Valuation vltn) { 42 | if (!filter.submitToSolver(exprsn)) { 43 | return Result.DONT_KNOW; 44 | } 45 | return solver.solve(exprsn, vltn); 46 | } 47 | 48 | @Override 49 | public SimpleSelectiveSolverContext createContext() { 50 | SolverContext ctx = solver.createContext(); 51 | return new SimpleSelectiveSolverContext(ctx, filter, evaluate); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/solvers/selective/SimpleSelectiveSolverProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.solvers.selective; 17 | 18 | import gov.nasa.jpf.constraints.api.ConstraintSolver; 19 | import gov.nasa.jpf.constraints.solvers.ConstraintSolverFactory; 20 | import gov.nasa.jpf.constraints.solvers.ConstraintSolverProvider; 21 | import java.util.Properties; 22 | 23 | /** 24 | * 25 | */ 26 | public class SimpleSelectiveSolverProvider implements ConstraintSolverProvider { 27 | 28 | @Override 29 | public String[] getNames() { 30 | return new String[]{"selective"}; 31 | } 32 | 33 | @Override 34 | public ConstraintSolver createSolver(Properties config) { 35 | String dp = "dontknow"; 36 | if (config.containsKey("selective.dp")) { 37 | dp = config.getProperty("selective.dp"); 38 | } 39 | 40 | boolean eval = true; 41 | if (config.containsKey("selective.eval")) { 42 | eval = Boolean.parseBoolean(config.getProperty("selective.eval")); 43 | } 44 | 45 | ExpressionFilter filter = new CombinationFilter(new ExpressionFilter[] { 46 | new FloatConstantFilter(), new FunctionFilter() 47 | }); 48 | 49 | ConstraintSolver solver = ConstraintSolverFactory.getRootFactory().createSolver(dp, config); 50 | return new SimpleSelectiveSolver(solver, filter, eval); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/summaries/SummaryConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.summaries; 17 | 18 | import gov.nasa.jpf.Config; 19 | import gov.nasa.jpf.jdart.config.ConcolicMethodConfig; 20 | import java.util.ArrayList; 21 | import java.util.Collection; 22 | 23 | /** 24 | * configuration for summary generation. 25 | */ 26 | public class SummaryConfig { 27 | 28 | private final Collection summaryMethods = new ArrayList<>(); 29 | 30 | public SummaryConfig(Config conf) { 31 | if (conf.containsKey("summary.methods")) { 32 | for (String id : conf.getStringSet("summary.methods")) { 33 | summaryMethods.add(ConcolicMethodConfig.read( 34 | id, "concolic.method." + id, conf)); 35 | } 36 | } 37 | } 38 | 39 | public Collection getSummaryMethods() { 40 | return summaryMethods; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/summaries/json/SubClassHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.summaries.json; 17 | 18 | import com.google.gson.JsonDeserializationContext; 19 | import com.google.gson.JsonDeserializer; 20 | import com.google.gson.JsonElement; 21 | import com.google.gson.JsonObject; 22 | import com.google.gson.JsonParseException; 23 | import com.google.gson.JsonSerializationContext; 24 | import com.google.gson.JsonSerializer; 25 | import java.lang.reflect.Type; 26 | 27 | /** 28 | * 29 | */ 30 | public class SubClassHandler implements 31 | JsonSerializer, JsonDeserializer { 32 | 33 | private static final String SUB_CLASS = "__SUB_CLASS"; 34 | 35 | @Override 36 | public JsonElement serialize(T t, Type type, JsonSerializationContext jsc) { 37 | JsonElement je = jsc.serialize(t, t.getClass()); 38 | je.getAsJsonObject().addProperty(SUB_CLASS, t.getClass().getName()); 39 | return je; 40 | } 41 | 42 | @Override 43 | public T deserialize(JsonElement je, Type type, JsonDeserializationContext jdc) 44 | throws JsonParseException { 45 | JsonObject jo = je.getAsJsonObject(); 46 | String className = jo.get(SUB_CLASS).getAsString(); 47 | try { 48 | Class clazz = Class.forName(className); 49 | return jdc.deserialize(je, clazz); 50 | } catch (ClassNotFoundException e) { 51 | throw new JsonParseException(e); 52 | } 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/summaries/json/VariableHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.summaries.json; 17 | 18 | import com.google.gson.JsonDeserializationContext; 19 | import com.google.gson.JsonDeserializer; 20 | import com.google.gson.JsonElement; 21 | import com.google.gson.JsonParseException; 22 | import com.google.gson.JsonPrimitive; 23 | import com.google.gson.JsonSerializationContext; 24 | import com.google.gson.JsonSerializer; 25 | import gov.nasa.jpf.constraints.api.Expression; 26 | import gov.nasa.jpf.constraints.api.Variable; 27 | import gov.nasa.jpf.constraints.parser.ParserUtil; 28 | import java.lang.reflect.Type; 29 | import org.antlr.runtime.RecognitionException; 30 | 31 | /** 32 | * 33 | */ 34 | public class VariableHandler implements 35 | JsonSerializer>, JsonDeserializer> { 36 | 37 | @Override 38 | public JsonElement serialize(Variable v, Type type, JsonSerializationContext jsc) { 39 | return new JsonPrimitive(v.toString(Variable.INCLUDE_VARIABLE_TYPE)); 40 | } 41 | 42 | @Override 43 | public Variable deserialize(JsonElement je, Type type, JsonDeserializationContext jdc) 44 | throws JsonParseException { 45 | try { 46 | Expression expr = ParserUtil.parseVariable(je.getAsJsonPrimitive().getAsString()); 47 | return (Variable) expr; 48 | } catch (RecognitionException ex) { 49 | throw new JsonParseException(ex); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/termination/NeverTerminate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.termination; 17 | 18 | /** 19 | * This never stops 20 | */ 21 | public class NeverTerminate extends TerminationStrategy { 22 | 23 | @Override 24 | public boolean isDone() { 25 | return false; 26 | } 27 | 28 | @Override 29 | public String getReason() { 30 | throw new IllegalStateException("Never terminates. Everything resolved."); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/termination/NoSolveCycles.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.termination; 17 | 18 | /** 19 | * Executes up to a fixed number of times. 20 | * 21 | */ 22 | public class NoSolveCycles extends TerminationStrategy { 23 | 24 | public NoSolveCycles(){ 25 | } 26 | 27 | @Override 28 | public boolean isDone() { 29 | return true; 30 | } 31 | 32 | @Override 33 | public String getReason() { 34 | return "No solve cycles selected."; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/termination/TerminationStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.termination; 17 | 18 | /** 19 | * A TerminationStrategy tells JDart if it should stop running. 20 | * termination is checked after a path is completed. 21 | */ 22 | public abstract class TerminationStrategy { 23 | 24 | /** 25 | * @return whether or not JDart should stop executing. 26 | */ 27 | public abstract boolean isDone(); 28 | 29 | /** 30 | * @return an informative message about why execution was stopped. 31 | */ 32 | public abstract String getReason(); 33 | } 34 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/termination/UpToFixedNumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.termination; 17 | 18 | 19 | 20 | /** 21 | * Executes up to a fixed number of times. 22 | * 23 | */ 24 | public class UpToFixedNumber extends TerminationStrategy { 25 | 26 | private int toGo; 27 | 28 | public UpToFixedNumber(int n){ 29 | if (n <= 0) 30 | throw new IllegalArgumentException("bogus number " + n); 31 | this.toGo= n; 32 | } 33 | 34 | @Override 35 | public boolean isDone() { 36 | toGo -= 1; 37 | return toGo <= 0; 38 | } 39 | 40 | @Override 41 | public String getReason() { 42 | // FIXME: re-introduce actual test for termination 43 | if (true) 44 | // if (ConstraintsTree.done()) 45 | return "Resolved all paths!"; 46 | else 47 | return "Execution Limit Reached"; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/testsuites/MethodWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.testsuites; 17 | 18 | /** 19 | * 20 | */ 21 | public class MethodWrapper { 22 | 23 | private final String call; 24 | 25 | private final String precondition; 26 | 27 | private final MethodChecks checks; 28 | 29 | public MethodWrapper(String call, String precondition, MethodChecks checks) { 30 | this.call = call; 31 | this.precondition = precondition; 32 | this.checks = checks; 33 | } 34 | 35 | public MethodWrapper(String call, String precondition) { 36 | this(call, precondition, new MethodChecks()); 37 | } 38 | 39 | /** 40 | * @return the call 41 | */ 42 | public String getCall() { 43 | return call; 44 | } 45 | 46 | /** 47 | * @return the precondition 48 | */ 49 | public String getPrecondition() { 50 | return precondition; 51 | } 52 | 53 | public MethodChecks getCheck() { 54 | return this.checks; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/testsuites/TestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.testsuites; 17 | 18 | import java.util.Arrays; 19 | import java.util.List; 20 | 21 | /** 22 | * 23 | */ 24 | public class TestCase { 25 | 26 | private List methods; 27 | 28 | public TestCase(MethodWrapper ... methods) { 29 | this.methods = Arrays.asList(methods); 30 | } 31 | 32 | 33 | /** 34 | * @return the methods 35 | */ 36 | public List getMethods() { 37 | return methods; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/testsuites/TestSubSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.testsuites; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * 22 | */ 23 | public class TestSubSuite { 24 | 25 | private List testCases; 26 | 27 | public TestSubSuite(List subList) { 28 | this.testCases = subList; 29 | } 30 | 31 | public List getTests() { 32 | return this.testCases; 33 | } 34 | 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/gov/nasa/jpf/jdart/testsuites/TestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.testsuites; 17 | 18 | import static java.lang.Math.min; 19 | import java.util.Collection; 20 | import java.util.Iterator; 21 | import java.util.LinkedList; 22 | import java.util.List; 23 | 24 | /** 25 | * 26 | */ 27 | public class TestSuite implements Iterable { 28 | 29 | private int subSuiteSize = 1000; 30 | 31 | private List testCases = new LinkedList(); 32 | 33 | public TestSuite(Collection tests) { 34 | this.testCases.addAll(tests); 35 | } 36 | 37 | public TestSuite(Collection tests, int subSuiteSize) { 38 | this.testCases.addAll(tests); 39 | this.subSuiteSize = subSuiteSize; 40 | } 41 | 42 | 43 | public Iterator iterator() { 44 | List subSuites = new LinkedList(); 45 | int offset = 0; 46 | for (int i=0;i TRUE = new Predicate() { 21 | @Override 22 | public boolean isTrue(Object arg) { 23 | return true; 24 | } 25 | }; 26 | public static final Predicate FALSE = new Predicate() { 27 | @Override 28 | public boolean isTrue(Object arg) { 29 | return true; 30 | } 31 | }; 32 | 33 | public static Predicate constPredicate(boolean val) { 34 | return val ? TRUE : FALSE; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/peers/readme.txt: -------------------------------------------------------------------------------- 1 | this folder contains host-VM executed library classes (MJI native peers) -------------------------------------------------------------------------------- /src/resources/META-INF/constraints/solvers: -------------------------------------------------------------------------------- 1 | gov.nasa.jpf.jdart.solvers.selective.SimpleSelectiveSolverProvider 2 | gov.nasa.jpf.jdart.solvers.functions.FunctionSolverProvider -------------------------------------------------------------------------------- /src/resources/gov/nasa/jpf/jdart/summaries/SummaryGeneration.st: -------------------------------------------------------------------------------- 1 | package ; 2 | 3 | public class { 4 | 5 | { 7 | // use for default values 8 | ; 10 | }> 11 | public static void main(String[] args) { 12 | 13 | new ( 14 | 15 | testObject = new (); // has to have default constructor 16 | testObject.( 17 | 18 | , 19 | }> 20 | 21 | ); 22 | \} 23 | \} 24 | }> 25 | } 26 | -------------------------------------------------------------------------------- /src/resources/gov/nasa/jpf/jdart/testsuites/SubSuite.st: -------------------------------------------------------------------------------- 1 | package ; 2 | 3 | import junit.framework.*; 4 | 5 | public class extends TestCase { 6 | 7 | () throws Throwable { 10 | 11 | 13 | if (!()) { 14 | fail("Precondition not met: "); 15 | \} 16 | 17 | obj = new (); 18 | 19 | 20 | 21 | try { 22 | obj.; 23 | fail("Expected exception of type "); 24 | \} catch ( e) { 25 | \} 26 | 27 | obj.; 28 | 29 | // perform checks 30 | 31 | ; 33 | }> 34 | 35 | }> 36 | \} // end of test case 37 | 38 | }> 39 | 40 | \} -------------------------------------------------------------------------------- /src/resources/gov/nasa/jpf/jdart/testsuites/TestSuite.st: -------------------------------------------------------------------------------- 1 | package ; 2 | 3 | import junit.framework.*; 4 | import junit.textui.*; 5 | 6 | public class extends TestCase { 7 | 8 | public static void main(String[] args) { 9 | TestRunner runner = new TestRunner(); 10 | TestResult result = runner.doRun(suite(args), false); 11 | if (! result.wasSuccessful()) { 12 | System.exit(1); 13 | \} 14 | \} 15 | 16 | public (String name) { 17 | super(name); 18 | \} 19 | 20 | public static Test suite(String[] args) { 21 | int min = -1; 22 | int max = -1; 23 | if (args.length == 2) { 24 | min = Integer.parseInt(args[0]); 25 | max = Integer.parseInt(args[1]); 26 | } 27 | TestSuite result = new TestSuite(); 28 | 29 | int c = 0; 30 | int x = 0; 31 | = min && c \<= max)) { 33 | result.addTest(new TestSuite(

.class)); 34 | x++; 35 | \} 36 | c++; 37 | }> 38 | 39 | System.out.println("Running " + x + " of " + c + " sub suites: " + 40 | "[" + min + ", " + max + "]"); 41 | 42 | return result; 43 | \} 44 | 45 | \} 46 | -------------------------------------------------------------------------------- /src/tests/gov/nasa/jpf/jdart/regressions/config.jpf: -------------------------------------------------------------------------------- 1 | 2 | jpf-jdart.native_classpath=\ 3 | ${jpf-jdart}/lib/ST-4.0.5.jar;\ 4 | ${jpf-jdart}/lib/antlr-3.4-complete.jar;\ 5 | ${jpf-jdart}/lib/gson-2.2.4.jar;\ 6 | ${jpf-jdart}/lib/guava-14.0.1.jar;\ 7 | ${jpf-jdart}/lib/jconstraints-0.9.1-SNAPSHOT.jar;\ 8 | ${jpf-jdart}/lib/jConstraints-z3-1.0-SNAPSHOT.jar;\ 9 | ${jpf-jdart}/lib/com.microsoft.z3.jar;\ 10 | ${jpf-jdart}/build/jpf-jdart.jar;\ 11 | ${jpf-jdart}/build/tests;\ 12 | ${jpf-jdart}/build/jpf-jdart-annotations.jar 13 | 14 | 15 | shell=gov.nasa.jpf.jdart.regressions.RegressionShell 16 | symbolic.dp=NativeZ3 17 | symbolic.dp.z3.bitvectors=true 18 | 19 | log.finest=jdart 20 | log.info=constraints 21 | 22 | # suppress jpf output 23 | report.console.start= 24 | report.console.finished= 25 | report.console.property_violation= 26 | 27 | jdart.configs.all_fields_symbolic.symbolic.include=this.* 28 | 29 | -------------------------------------------------------------------------------- /src/tests/gov/nasa/jpf/jdart/regressions/termination/InfiniteLoop.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.regressions.termination; 17 | 18 | /** 19 | * 20 | */ 21 | public class InfiniteLoop { 22 | 23 | public static void concolic() throws Throwable { 24 | Class.forName("__NON_EXISTING_CLASS"); 25 | System.out.println("Not sure if this is ever reached"); 26 | } 27 | 28 | public static void main(String[] args) throws Throwable { 29 | concolic(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/tests/gov/nasa/jpf/jdart/regressions/termination/Oracle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.regressions.termination; 17 | 18 | import gov.nasa.jpf.jdart.ConcolicExplorer; 19 | import gov.nasa.jpf.jdart.regressions.TestOracle; 20 | 21 | /** 22 | * 23 | */ 24 | public class Oracle implements TestOracle { 25 | 26 | @Override 27 | public boolean verdict(ConcolicExplorer exp) { 28 | if (exp.getFirstCompletedAnalysis("test") != null) { 29 | return (exp.getFirstCompletedAnalysis("test").getConstraintsTree() != null); 30 | } 31 | return false; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/tests/gov/nasa/jpf/jdart/regressions/termination/PartialAnalysis.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.regressions.termination; 17 | 18 | import static gov.nasa.jpf.jdart.regressions.termination.InfiniteLoop.concolic; 19 | 20 | /** 21 | * 22 | */ 23 | public class PartialAnalysis { 24 | 25 | public static void test(int i) { 26 | if (i != 1) 27 | if (i != 2) 28 | if (i != 3) 29 | if (i != 4) 30 | if (i != 5) 31 | if (i != 6) 32 | assert false; 33 | } 34 | 35 | public static void main(String[] args) throws Throwable { 36 | test(0); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/tests/gov/nasa/jpf/jdart/regressions/termination/test1.jpf: -------------------------------------------------------------------------------- 1 | @include=../config.jpf 2 | 3 | jdart.termination=gov.nasa.jpf.jdart.termination.TimedTermination,0,0,5 4 | 5 | concolic.method.test=gov.nasa.jpf.jdart.regressions.termination.InfiniteLoop.concolic() 6 | concolic.method=test 7 | 8 | regression.name=Infinite Loop 9 | regression.target=gov.nasa.jpf.jdart.regressions.termination.InfiniteLoop 10 | regression.oracle=gov.nasa.jpf.jdart.regressions.termination.Oracle 11 | -------------------------------------------------------------------------------- /src/tests/gov/nasa/jpf/jdart/regressions/termination/test2.jpf: -------------------------------------------------------------------------------- 1 | @include=../config.jpf 2 | 3 | jdart.termination=gov.nasa.jpf.jdart.termination.UpToFixedNumber,10 4 | 5 | concolic.method.test=gov.nasa.jpf.jdart.regressions.termination.PartialAnalysis.test(i:int) 6 | concolic.method=test 7 | 8 | regression.name=Partial Analysis 9 | regression.target=gov.nasa.jpf.jdart.regressions.termination.PartialAnalysis 10 | regression.oracle=gov.nasa.jpf.jdart.regressions.termination.Oracle 11 | -------------------------------------------------------------------------------- /src/tests/gov/nasa/jpf/jdart/regressions/uncalled/Oracle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015, United States Government, as represented by the 3 | * Administrator of the National Aeronautics and Space Administration. 4 | * All rights reserved. 5 | * 6 | * The PSYCO: A Predicate-based Symbolic Compositional Reasoning environment 7 | * platform is licensed under the Apache License, Version 2.0 (the "License"); you 8 | * may not use this file except in compliance with the License. You may obtain a 9 | * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | package gov.nasa.jpf.jdart.regressions.uncalled; 17 | 18 | import gov.nasa.jpf.jdart.ConcolicExplorer; 19 | import gov.nasa.jpf.jdart.regressions.TestOracle; 20 | 21 | /** 22 | * 23 | */ 24 | public class Oracle implements TestOracle { 25 | 26 | @Override 27 | public boolean verdict(ConcolicExplorer exp) { 28 | if (exp.getFirstCompletedAnalysis("msg") != null) { 29 | return (exp.getFirstCompletedAnalysis("msg").getConstraintsTree() != null); 30 | } 31 | return false; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/tests/gov/nasa/jpf/jdart/regressions/uncalled/test1.jpf: -------------------------------------------------------------------------------- 1 | @include=../config.jpf 2 | 3 | jdart.termination=gov.nasa.jpf.jdart.termination.TimedTermination,0,0,5 4 | 5 | concolic.method.msg=gov.nasa.jpf.jdart.regressions.uncalled.Protocol.msg(sequence:int,content:int) 6 | concolic.method=msg 7 | 8 | regression.name=Uncalled Bug 9 | regression.target=gov.nasa.jpf.jdart.regressions.uncalled.Protocol 10 | regression.oracle=gov.nasa.jpf.jdart.regressions.uncalled.Oracle 11 | --------------------------------------------------------------------------------