UNPKG

@ciao-lang/ts-ciao-interface

Version:

Simple Ciao interface for node.

20 lines 7.18 kB
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="theme-color" content="#273f79"/><link rel="stylesheet" href="lpdoc.css" type="text/css"/><script type="text/javascript" src="lpdoc.js"></script><title>Debugging PLAI analyses &mdash; The CiaoPP Program Processor v1.5</title></head><body><div class="lpdoc-page fixleftbar"><a href="#" id="sidebar-toggle-button" class="lpdoc-navbutton"><span id="sidebar-button-arrow">&#9776;</span></a><div id="sidebar" class="lpdoc-sidebar"><div style="height: 40px; margin-left: auto; margin-right: auto"><img src="ciao-logo_autofig.png" width=auto height=100%></div><div class="lpdoc-nav"><span class="lpdoc-on-right"><a class="lpdoc-navbutton" href="part_internals.html">&#x2191;</a><a class="lpdoc-navbutton" href="preprocess_flags.html">&#x2190;</a><a class="lpdoc-navbutton" href="incanal.html">&#x2192;</a><a class="lpdoc-navbutton" href="ciaopp_ref_mansearch.html">&#x1F50D;</a></span><span><a href="ciaopp_ref_manfulltoc.html">TOC</a></span></div><hr></hr><ul class="lpdoc-itemize-sectpath"><li><a href="ciaopp_ref_man.html">The CiaoPP Program Processor</a> &raquo;<br/> </li><li><a href="part_internals.html">PART IV - CiaoPP Internals</a> &raquo;<br/> </li><li><a href=""><strong>Debugging PLAI analyses</strong></a></li></ul><hr></hr><em>ON THIS PAGE</em><ul><li><a href="#Debug raw analysis result">Debug raw analysis result</a></li><li><a href="#Inspect analysis graphs">Inspect analysis graphs</a></li><li><a href="#Trace fixpoint operations">Trace fixpoint operations</a></li><li><a href="#Activate run-time checks">Activate run-time checks</a></li><li><a href="#Debug fixpoint step by step">Debug fixpoint step by step</a></li><li><a href="#Access PLAI databases directly">Access PLAI databases directly</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>Debugging PLAI analyses</h1><a class="lpdoc-idx-anchor" href="ciaopp_ref_mansearch.html#Debug_plai"></a> <strong>Author(s):</strong> <a class="lpdoc-idx-anchor" id="Isabel Garcia-Contreras" href="ciaopp_ref_mansearch.html#Isabel Garcia-Contreras">Isabel Garcia-Contreras</a>.<p> This module is intended for debugging fixpoints and abstract domains. The debugging modes are sorted by difficulty and knowledge required by the programmer.<p>General comments. To discard errors related with not cleaning properly internal databases it is better not to debug in the ciao/ciaopp toplevel, but rather use the ciaopp command line if possible.<p><div id="Debug raw analysis result"><h2>Debug raw analysis result</h2> <p>Output the analysis result without postprocessing. This is using internal clause representation of ciaopp and internal representation of the abstract domain. For this, simply set the flag <tt>output_lang</tt> to <tt>raw</tt>.<p>For every <strong>reachable</strong> program point there is one or more <tt>true</tt> annotations, one for every inferred call pattern. In the body, annotations with the same number correspond to the execution of the abstract call with that number. A raw assertion will appear with the same id for such abstract call and success.<p>Note that this option is specially useful when developing a new abstract domain. If the predicates <a class="lpdoc-idx-anchor" id="0" href="domains.html#asub_to_info/5"><tt>asub_to_info/5</tt></a>, <a class="lpdoc-idx-anchor" id="1" href="domains.html#asub_to_native/6"><tt>asub_to_native/6</tt></a>, etc are not defined, no useful information appears in the usual.<p></div><div id="Inspect analysis graphs"><h2>Inspect analysis graphs</h2> <p>Dump the analysis graph in some &lt;file&gt;: <pre class="lpdoc-codeblock">ciaopp ?- use_module(ciaopp(p_dump)). ciaopp ?- dump(&lt;file&gt;). </pre> <p>Use the command <tt>ciaopp-dump</tt> to inspect: <pre class="lpdoc-codeblock">$ ciaopp-dump show &lt;file&gt; # Print info of the dump &lt;file&gt;. $ ciaopp-dump fmt &lt;file&gt; # Outputs the analysis result in dot format. $ dot -Tpdf &lt;file&gt;.dot -o &lt;file&gt;.pdf # Generates a graph in pdf of the dot analysis format. </pre> <p></div><div id="Trace fixpoint operations"><h2>Trace fixpoint operations</h2> <p>Output steps to reach fixpoint. It is useful to combine this option with the raw output, as it shows the steps to generate the graphs using the same numbers for ids.<p>In file <tt>src/plai/fixpoint_options.pl</tt>, uncomment <tt>:- use_package(.(notrace)).</tt>, and recompile: <pre class="lpdoc-codeblock">$ ciao build --bin ciaopp </pre> <p><div class="lpdoc-alert"> A clean may be necessary, due to some undetected changes in incremental compilation of programs with included files. <pre class="lpdoc-codeblock">$ ciao clean ciaopp </pre> </div> <p>Then set flag <tt>trace_fixp</tt> to <tt>trace</tt> in the <tt>ciaopp</tt> toplevel or activate it in the command line: <pre class="lpdoc-codeblock">$ ciaopp -A &lt;file&gt; -ftrace_fixp=trace </pre> <p>Additionally, if the flag <tt>timestamp_trace</tt> is set to <tt>on</tt> (can only be set in the <tt>ciaopp</tt> toplevel) a timestamp is printed when tracing. This can help finding perfomance issues.<p></div><div id="Activate run-time checks"><h2>Activate run-time checks</h2> <p>Go to any module, add <tt>:- use_package(rtchecks).</tt> and recompile by <pre class="lpdoc-codeblock">$ ciao build --bin ciaopp </pre> <p>Modules recommended: <ul> <li>Generic domain interface <tt>src/plai/domains.pl</tt>. <li>Any specific domain. of <tt>src/domains/*</tt> (check that it has assertions!). <li>Fixpoints: <tt>src/plai/fixpoint_options.pl</tt>. <li>Generic fixpoint operations: <tt>src/plai/fixpo_ops.pl</tt>. <li>Modular analysis: <tt>src/plai/intermod_options.pl</tt>. <li>Incremental analysis: <tt>src/plai/incanal/incanal_options.pl</tt>. <li>Assertions during fixpoint: <tt>src/plai/apply_assertions.pl</tt>/<tt>src/plai/apply_assertions_old.pl</tt>. </ul> <p> <div class="lpdoc-alert"> In <tt>domains.pl</tt> the assertions were written by looking only at some domains, not all of them. It could happen that they are too restrictive. If you find that an assertion does not hold in run-time, please open an issue. </div> <p></div><div id="Debug fixpoint step by step"><h2>Debug fixpoint step by step</h2> <p>For this, it is recommended to deactivate run-time checks, as the debugger shows also the code for RT checking.<p>Write <tt>:- use_package(trace).</tt> in <tt>src/plai/fixpoint_options.pl</tt> and recompile:<p><pre class="lpdoc-codeblock">$ ciao build --bin ciaopp </pre> <p>In an emacs shell buffer do <tt>M-x ciao-inferior-mode</tt>. Then execute the ciaopp command to debug<p><pre class="lpdoc-codeblock">$ ciaopp -A &lt;file&gt; </pre> <p></div><div id="Access PLAI databases directly"><h2>Access PLAI databases directly</h2> <p><pre class="lpdoc-codeblock">ciaopp ?- use_module(ciaopp(plai/plai_db)). ciaopp ?- complete(SgKey,AbsInt,Sg,Proj,Prime,Id,Parents). ciaopp ?- memo_table(LitKey,AbsInt,Id,Child,Vars_u,Call). </pre> <p></div><br/></div><div class="lpdoc-footer">Generated with LPdoc using Ciao</div></div><div class="lpdoc-clearer"></div></div></body></html>