Daikon Invariant Detector User Manual
Total Page:16
File Type:pdf, Size:1020Kb
Daikon Invariant Detector User Manual Daikon version 5.8.8 July 22, 2020 Copyright c 1998-2020 i Table of Contents 1 Introduction :::::::::::::::::::::::::::::::::::::::::::::::: 1 2 Installing Daikon ::::::::::::::::::::::::::::::::::::::::::: 2 2.1 Requirements for running Daikon:::::::::::::::::::::::::::::::::::::::::::::: 2 2.2 Installation ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 2 3 Example usage for Java, C/C++, C#/F#/Visual Basic, Perl, and Eiffel :::::::::::::::::::::::::::::::::::::::::::: 4 3.1 Detecting invariants in Java programs ::::::::::::::::::::::::::::::::::::::::: 4 3.1.1 StackAr example ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 4 3.1.2 Detecting invariants when running a Java program from a jar file ::::::::: 5 3.1.3 Understanding the invariants ::::::::::::::::::::::::::::::::::::::::::::: 6 3.1.4 A second Java example ::::::::::::::::::::::::::::::::::::::::::::::::::: 6 3.2 Detecting invariants in C/C++ programs:::::::::::::::::::::::::::::::::::::: 8 3.2.1 C examples :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 8 3.2.2 Dealing with large examples :::::::::::::::::::::::::::::::::::::::::::::: 9 3.3 Detecting invariants in C#, F#, and Visual Basic programs :::::::::::::::::: 10 3.4 Detecting invariants in Perl programs :::::::::::::::::::::::::::::::::::::::: 10 3.4.1 Instrumenting Perl programs :::::::::::::::::::::::::::::::::::::::::::: 10 3.4.2 Perl examples ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 10 3.5 Detecting invariants in Eiffel programs ::::::::::::::::::::::::::::::::::::::: 12 3.6 Detecting invariants in Simulink/Stateflow programs:::::::::::::::::::::::::: 12 4 Running Daikon::::::::::::::::::::::::::::::::::::::::::: 13 4.1 Options to control Daikon output :::::::::::::::::::::::::::::::::::::::::::: 13 4.2 Options to control invariant detection :::::::::::::::::::::::::::::::::::::::: 15 4.3 Processing only part of the trace file:::::::::::::::::::::::::::::::::::::::::: 16 4.4 Daikon configuration options ::::::::::::::::::::::::::::::::::::::::::::::::: 16 4.5 Daikon debugging options :::::::::::::::::::::::::::::::::::::::::::::::::::: 17 5 Daikon output::::::::::::::::::::::::::::::::::::::::::::: 18 5.1 Invariant syntax ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 18 5.2 Program points :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 19 5.2.1 OBJECT and CLASS program points ::::::::::::::::::::::::::::::::::: 19 5.3 Variable names :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 20 5.3.1 orig() variable example :::::::::::::::::::::::::::::::::::::::::::::::::: 21 5.4 Interpreting Daikon output::::::::::::::::::::::::::::::::::::::::::::::::::: 22 5.4.1 Redundant invariants ::::::::::::::::::::::::::::::::::::::::::::::::::: 23 5.4.2 Equal variables:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 23 5.4.3 Has only one value variables::::::::::::::::::::::::::::::::::::::::::::: 23 5.4.4 Object inequality ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 23 5.5 Invariant list ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 23 5.6 Invariant filters :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 41 ii 6 Enhancing Daikon output :::::::::::::::::::::::::::::::: 43 6.1 Configuration options :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 43 6.1.1 List of configuration options::::::::::::::::::::::::::::::::::::::::::::: 43 6.1.1.1 Options to enable/disable filters :::::::::::::::::::::::::::::::::::: 43 6.1.1.2 Options to enable/disable specific invariants :::::::::::::::::::::::: 44 6.1.1.3 Other invariant configuration parameters ::::::::::::::::::::::::::: 52 6.1.1.4 Options to enable/disable derived variables ::::::::::::::::::::::::: 55 6.1.1.5 Simplify interface configuration options ::::::::::::::::::::::::::::: 57 6.1.1.6 Splitter options :::::::::::::::::::::::::::::::::::::::::::::::::::: 59 6.1.1.7 Debugging options ::::::::::::::::::::::::::::::::::::::::::::::::: 59 6.1.1.8 Quantity of output ::::::::::::::::::::::::::::::::::::::::::::::::: 60 6.1.1.9 General configuration options::::::::::::::::::::::::::::::::::::::: 61 6.2 Conditional invariants (disjunctions) and implications :::::::::::::::::::::::: 64 6.2.1 Splitter info file format :::::::::::::::::::::::::::::::::::::::::::::::::: 65 6.2.1.1 Program point sections ::::::::::::::::::::::::::::::::::::::::::::: 65 6.2.1.2 Replacement sections ::::::::::::::::::::::::::::::::::::::::::::::: 65 6.2.2 Indiscriminate splitting:::::::::::::::::::::::::::::::::::::::::::::::::: 66 6.2.3 Example splitter info file :::::::::::::::::::::::::::::::::::::::::::::::: 66 6.2.3.1 Example class :::::::::::::::::::::::::::::::::::::::::::::::::::::: 66 6.2.3.2 Resulting .spinfo file:::::::::::::::::::::::::::::::::::::::::::::::: 67 6.3 Enhancing conditional invariant detection :::::::::::::::::::::::::::::::::::: 67 6.3.1 Static analysis for splitters :::::::::::::::::::::::::::::::::::::::::::::: 67 6.3.1.1 Static analysis of Java for splitters:::::::::::::::::::::::::::::::::: 68 6.3.1.2 Static analysis of C for splitters :::::::::::::::::::::::::::::::::::: 68 6.3.2 Cluster analysis for splitters ::::::::::::::::::::::::::::::::::::::::::::: 68 6.3.3 Random selection for splitters ::::::::::::::::::::::::::::::::::::::::::: 69 6.4 Dynamic abstract type inference (DynComp) ::::::::::::::::::::::::::::::::: 70 6.5 Loop invariants :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 70 7 Front ends (instrumentation) :::::::::::::::::::::::::::: 72 7.1 Java front end Chicory ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 72 7.1.1 Chicory options ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 72 7.1.1.1 Program points in Chicory output :::::::::::::::::::::::::::::::::: 73 7.1.1.2 Variables in Chicory output :::::::::::::::::::::::::::::::::::::::: 74 7.1.1.3 Chicory miscellaneous options :::::::::::::::::::::::::::::::::::::: 75 7.1.2 Static fields (global variables) ::::::::::::::::::::::::::::::::::::::::::: 77 7.1.3 Troubleshooting Chicory :::::::::::::::::::::::::::::::::::::::::::::::: 77 7.2 DynComp dynamic comparability (abstract type) analysis for Java ::::::::::: 77 7.2.1 Instrumenting the JDK with DynComp:::::::::::::::::::::::::::::::::: 81 7.2.2 DynComp options::::::::::::::::::::::::::::::::::::::::::::::::::::::: 81 7.2.3 Instrumentation of Object methods:::::::::::::::::::::::::::::::::::::: 83 7.2.4 Troubleshooting DynComp for Java ::::::::::::::::::::::::::::::::::::: 83 7.2.5 Known bugs and limitations ::::::::::::::::::::::::::::::::::::::::::::: 83 7.3 C/C++ front end Kvasir::::::::::::::::::::::::::::::::::::::::::::::::::::: 84 7.3.1 Using Kvasir :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 84 7.3.2 Kvasir options :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 85 7.3.3 DynComp dynamic comparability (abstract type) analysis for C/C++ ::: 89 7.3.4 Tracing only part of a program :::::::::::::::::::::::::::::::::::::::::: 91 7.3.5 Pointer type disambiguation::::::::::::::::::::::::::::::::::::::::::::: 94 7.3.5.1 Pointer type coercion::::::::::::::::::::::::::::::::::::::::::::::: 95 7.3.5.2 Pointer type disambiguation example ::::::::::::::::::::::::::::::: 96 iii 7.3.5.3 Using pointer type disambiguation with partial program tracing::::: 98 7.3.6 C++ support ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 99 7.3.7 Online execution ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 100 7.3.7.1 Online execution with DynComp for C/C++ :::::::::::::::::::::: 101 7.3.8 Installing Kvasir ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 101 7.3.9 Kvasir implementation and limitations ::::::::::::::::::::::::::::::::: 102 7.4 .NET (C#) front end Celeriac :::::::::::::::::::::::::::::::::::::::::::::: 103 7.5 Perl front end dfepl ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 103 7.5.1 dfepl options ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 105 7.6 Comma-separated-value front end convertcsv.pl ::::::::::::::::::::::::::::: 109 7.7 Other front ends :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 109 8 Tools for use with Daikon::::::::::::::::::::::::::::::: 110 8.1 Tools for manipulating invariants ::::::::::::::::::::::::::::::::::::::::::: 110 8.1.1 Printing invariants ::::::::::::::::::::::::::::::::::::::::::::::::::::: 110 8.1.2 MergeInvariants:::::::::::::::::::::::::::::::::::::::::::::::::::::::: 111 8.1.3 Invariant Diff :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 111 8.1.4 Annotate :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 112 8.1.5 AnnotateNullable :::::::::::::::::::::::::::::::::::::::::::::::::::::: 113 8.1.6 Runtime-check instrumenter (runtimechecker) :::::::::::::::::::::::::: 114 8.1.6.1 How to access violations::::::::::::::::::::::::::::::::::::::::::: 115 8.1.6.2 Problems compiling instrumented code :::::::::::::::::::::::::::: 115 8.1.7 InvariantChecker ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 116 8.1.8 LogicalCompare:::::::::::::::::::::::::::::::::::::::::::::::::::::::: 117 8.2 DtraceDiff utility ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 119 8.3 Reading dtrace files ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 120 9 Troubleshooting ::::::::::::::::::::::::::::::::::::::::: 121 9.1 Problems running Daikon ::::::::::::::::::::::::::::::::::::::::::::::::::: 121 9.1.1 Can't run Daikon: could not find or load main