Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > 675c8c8167236dfcf8d66da674f931e8 > files > 510

erlang-doc-R15B-03.3.fc17.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- Dialyzer</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth ||
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){
                if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
              } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
              } else {
                return false;
              }
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/dialyzer-2.5.3.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Dialyzer</strong><br><strong>User's Guide</strong><br><small>Version 2.5.3</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Chapters</strong></small></p>
<ul class="flipMenu" imagepath="../../../../doc/js/flipmenu"><li id="loadscrollpos" title="Dialyzer" expanded="true">Dialyzer<ul>
<li><a href="dialyzer_chapter.html">
              Top of chapter
            </a></li>
<li title="Introduction"><a href="dialyzer_chapter.html#id60883">Introduction</a></li>
<li title="Using the Dialyzer from the GUI"><a href="dialyzer_chapter.html#id61298">Using the Dialyzer from the GUI</a></li>
<li title="Using the Dialyzer from the command line"><a href="dialyzer_chapter.html#id61270">Using the Dialyzer from the command line</a></li>
<li title="Using the Dialyzer from Erlang"><a href="dialyzer_chapter.html#id61286">Using the Dialyzer from Erlang</a></li>
<li title="More on the Persistent Lookup Table (PLT)"><a href="dialyzer_chapter.html#id61123">More on the Persistent Lookup Table (PLT)</a></li>
<li title="Feedback and bug reports"><a href="dialyzer_chapter.html#id61801">Feedback and bug reports</a></li>
</ul>
</li></ul>
</div></div>
<div id="content">
<div class="innertube">
<h1>1 Dialyzer</h1>
  

  <h3><a name="id60883">1.1 
        Introduction</a></h3>
    
    <p><strong>Dialyzer</strong> is a static analysis tool that identifies software discrepancies
      such as type errors, unreachable code, unnecessary tests, etc in single Erlang modules
      or entire (sets of) applications.</p>
  

  <h3><a name="id61298">1.2 
        Using the Dialyzer from the GUI</a></h3>
    

    <h4>Choosing the applications or modules</h4>
      
      <p>In the "File" window you will find a listing of the current directory.
        Click your way to the directories/modules you want to add or type the
        correct path in the entry.</p>
      <p>Mark the directories/modules you want to analyze for discrepancies and
        click "Add". You can either add the <span class="code">.beam</span> and <span class="code">.erl</span>-files directly, or
        you can add directories that contain these kinds of files. Note that
        you are only allowed to add the type of files that can be analyzed in
        the current mode of operation (see below), and that you cannot mix
        <span class="code">.beam</span> and <span class="code">.erl</span>-files.</p>
    

    <h4>The analysis modes</h4>
      
      <p>Dialyzer has two modes of analysis, "Byte Code" or "Source Code". 
         These are controlled by the buttons in the top-middle part of the 
         main window, under "Analysis Options".</p>
    

    <h4>Controlling the discrepancies reported by the Dialyzer</h4>
      
      <p>Under the "Warnings" pull-down menu, there are buttons that control
        which discrepancies are reported to the user in the "Warnings" window.
        By clicking on these buttons, one can enable/disable a whole class of
        warnings.  Information about the classes of warnings can be found on
        the "Warnings" item under the "Help" menu (at the rightmost top corner).</p>
      <p>If modules are compiled with inlining, spurious warnings may be emitted.
        In the "Options" menu you can choose to ignore inline-compiled modules
        when analyzing byte code. When starting from source code this is not a
        problem since the inlining is explicitly turned off by Dialyzer. The
        option causes Dialyzer to suppress all warnings from inline-compiled
        modules, since there is currently no way for Dialyzer to find what
        parts of the code have been produced by inlining. </p>
    

    <h4>Running the analysis</h4>
      
      <p>Once you have chosen the modules or directories you want to analyze,
        click the "Run" button to start the analysis. If for some reason you
        want to stop the analysis while it is running, push the "Stop" button.</p>
      <p>The information from the analysis will be displayed in the Log and the
        Warnings windows.</p>
    

    <h4>Include directories and macro definitions</h4>
      
      <p>When analyzing from source you might have to supply Dialyzer with a
        list of include directories and macro definitions (as you can do with
        the <span class="code">erlc</span> flags <span class="code">-I</span> and <span class="code">-D</span>). This can be done either by starting Dialyzer
        with these flags from the command line as in:</p>
      <div class="example"><pre>

      dialyzer -I my_includes -DDEBUG -Dvsn=42 -I one_more_dir
      </pre></div>
      <p>or by adding these explicitly using the "Manage Macro Definitions" or
        "Manage Include Directories" sub-menus in the "Options" menu.</p>
    

    <h4>Saving the information on the Log and Warnings windows</h4>
      
      <p>In the "File" menu there are options to save the contents of the Log
        and the Warnings window. Just choose the options and enter the file to
        save the contents in.</p>
      <p>There are also buttons to clear the contents of each window.</p>
    

    <h4>Inspecting the inferred types of the analyzed functions</h4>
      
      <p>Dialyzer stores the information of the analyzed functions in a
        Persistent Lookup Table (PLT). After an analysis you can inspect this
        information. In the PLT menu you can choose to either search the PLT
        or inspect the contents of the whole PLT. The information is presented
        in edoc format.</p>
    
  

  <h3><a name="id61270">1.3 
        Using the Dialyzer from the command line</a></h3>
    
    <p>See <span class="bold_code"><a href="dialyzer.html">dialyzer(3)</a></span>.</p>
  

  <h3><a name="id61286">1.4 
        Using the Dialyzer from Erlang</a></h3>
    
    <p>See <span class="bold_code"><a href="dialyzer.html">dialyzer(3)</a></span>.</p>
  

  <h3><a name="id61123">1.5 
        More on the Persistent Lookup Table (PLT)</a></h3>
     

    <p> The persistent lookup table, or PLT, is used to store the
    result of an analysis. The PLT can then be used as a starting
    point for later analyses. It is recommended to build a PLT with
    the otp applications that you are using, but also to include your
    own applications that you are using frequently.</p>

    <p>The PLT is built using the --build_plt option to dialyzer. The
    following command builds the recommended minimal PLT for OTP.</p>

    <div class="example"><pre>

    dialyzer --build_plt -r $ERL_TOP/lib/stdlib/ebin $ERL_TOP/lib/kernel/ebin $ERL_TOP/lib/mnesia/ebin
    </pre></div>

    <p>Dialyzer will look if there is an environment variable called
    $DIALYZER_PLT and place the PLT at this location. If no such
    variable is set, Dialyzer will place the PLT at
    $HOME/.dialyzer_plt. The placement can also be specified using the
    --plt, or --output_plt options.</p>

    <p>You can also add information to an existing plt using the
    --add_to_plt option. Suppose you want to also include the compiler
    in the PLT and place it in a new PLT, then give the command</p>

    <div class="example"><pre>

    dialyzer --add_to_plt -r $ERL_TOP/lib/compiler/ebin --output_plt my.plt
    </pre></div>

    <p>Then you would like to add your favorite application my_app to
    the new plt.</p>

    <div class="example"><pre>

    dialyzer --add_to_plt --plt my.plt -r my_app/ebin
    </pre></div>

    <p>But you realize that it is unnecessary to have compiler in this one.</p>

    <div class="example"><pre>

    dialyzer --remove_from_plt --plt my.plt -r $ERL_TOP/lib/compiler/ebin
    </pre></div>

    <p> Later, when you have fixed a bug in your application my_app,
    you want to update the plt so that it will be fresh the next time
    you run Dialyzer, run the command</p>

    <div class="example"><pre>

    dialyzer --check_plt --plt my.plt
    </pre></div>

    <p> Dialyzer will then reanalyze the files that have been changed,
    and the files that depend on these files. Note that this
    consistency check will be performed automatically the next time
    you run Dialyzer with this plt. The --check_plt option is merely
    for doing so without doing any other analysis.</p>

    <p> To get some information about a plt use the option</p>
    <div class="example"><pre>

    dialyzer --plt_info
    </pre></div>

    <p>You can also specify which plt with the --plt option, and get the 
    output printed to a file with --output_file</p>

    <p>Note that when manipulating the plt, no warnings are
    emitted. To turn on warnings during (re)analysis of the plt, use
    the option --get_warnings.</p>

  

  <h3><a name="id61801">1.6 
        Feedback and bug reports</a></h3>
    
    <p>At this point, we very much welcome user feedback (even wish-lists!).
      If you notice something weird, especially if the Dialyzer reports any
      discrepancy that is a false positive, please send an error report
      describing the symptoms and how to reproduce them to:</p>
    <div class="example"><pre>
    tobias.lindahl@it.uu.se, kostis@it.uu.se
    </pre></div>
  
</div>
<div class="footer">
<hr>
<p>Copyright © 2006-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>