Merge remote branch 'origin/master'
[ghc-hetmet.git] / docs / users_guide / debugging.xml
index 2a88767..9c48f7d 100644 (file)
@@ -24,8 +24,9 @@
         a short form…).  You can get all of these at once
         (<emphasis>lots</emphasis> of output) by using
         <option>-v5</option>, or most of them with
-        <option>-v4</option>.  Some of the most useful ones
-        are:</para>
+        <option>-v4</option>.  You can prevent them from clogging up
+        your standard output by passing <option>-ddump-to-file</option>.
+        Some of the most useful ones are:</para>
 
          <variablelist>
            <varlistentry>
 
            <varlistentry>
              <term>
-               <option>-ddump-tc</option>:
-                <indexterm><primary><option>-ddump-tc</option></primary></indexterm>
-             </term>
-             <listitem>
-               <para>typechecker output</para>
-             </listitem>
-           </varlistentry>
-
-           <varlistentry>
-             <term>
                <option>-ddump-splices</option>:
                 <indexterm><primary><option>-ddump-splices</option></primary></indexterm>
              </term>
                 <indexterm><primary><option>-ddump-rules</option></primary></indexterm>
              </term>
              <listitem>
-               <para>dumps all rewrite rules (including those generated
-             by the specialisation pass)</para>
+               <para>dumps all rewrite rules specified in this module; 
+                      see <xref linkend="controlling-rules"/>.
+                </para>
+             </listitem>
+           </varlistentry>
+
+           <varlistentry>
+             <term>
+               <option>-ddump-rule-firings</option>:
+                <indexterm><primary><option>-ddump-rule-firings</option></primary></indexterm>
+             </term>
+             <listitem>
+               <para>dumps the names of all rules that fired in this module</para>
+             </listitem>
+           </varlistentry>
+
+           <varlistentry>
+             <term>
+               <option>-ddump-rule-rewrites</option>:
+                <indexterm><primary><option>-ddump-rule-rewrites</option></primary></indexterm>
+             </term>
+             <listitem>
+               <para>dumps detailed information about all rules that fired in
+                     this module
+               </para>
+             </listitem>
+           </varlistentry>
+
+           <varlistentry>
+             <term>
+               <option>-ddump-vect</option>:
+                <indexterm><primary><option>-ddump-vect</option></primary></indexterm>
+             </term>
+             <listitem>
+               <para>dumps the output of the vectoriser.
+                </para>
              </listitem>
            </varlistentry>
 
 
            <varlistentry>
              <term>
-               <option>-ddump-workwrap</option>:
-                <indexterm><primary><option>-ddump-workwrap</option></primary></indexterm>
+               <option>-ddump-worker-wrapper</option>:
+                <indexterm><primary><option>-ddump-worker-wrapper</option></primary></indexterm>
              </term>
              <listitem>
                <para>worker/wrapper split output</para>
       
       <varlistentry>
        <term>
+          <option>-ddump-simpl-phases</option>:
+          <indexterm><primary><option>-ddump-simpl-phases</option></primary></indexterm>
+        </term>
+       <listitem>
+         <para>Show the output of each run of the simplifier.  Used when even
+        <option>-dverbose-core2core</option> doesn't cut it.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
           <option>-ddump-simpl-iterations</option>:
           <indexterm><primary><option>-ddump-simpl-iterations</option></primary></indexterm>
         </term>
        <listitem>
          <para>Show the output of each <emphasis>iteration</emphasis>
         of the simplifier (each run of the simplifier has a maximum
-        number of iterations, normally 4).  Used when even
-        <option>-dverbose-simpl</option> doesn't cut it.</para>
+        number of iterations, normally 4).  This outputs even more information
+        than <option>-ddump-simpl-phases</option>.</para>
        </listitem>
       </varlistentry>
 
       </varlistentry>
 
       <varlistentry>
-       <term>
+  <term>
           <option>-ddump-tc-trace</option>
           <indexterm><primary><option>-ddump-tc-trace</option></primary></indexterm>
         </term>
-       <listitem>
-         <para>Make the type checker be *real* chatty about what it is
-       upto.</para>
-       </listitem>
+  <listitem>
+    <para>Make the type checker be *real* chatty about what it is
+  upto.</para>
+  </listitem>
+      </varlistentry>
+
+      <varlistentry>
+  <term>
+          <option>-ddump-vt-trace</option>
+          <indexterm><primary><option>-ddump-tv-trace</option></primary></indexterm>
+        </term>
+  <listitem>
+    <para>Make the vectoriser be *real* chatty about what it is
+  upto.</para>
+  </listitem>
       </varlistentry>
 
       <varlistentry>
         of output!) So: when we're really desperate:</para>
 
          <screen>
-% ghc -noC -O -ddump-simpl -dverbose-simpl -dcore-lint Foo.hs
+% ghc -noC -O -ddump-simpl -dverbose-core2core -dcore-lint Foo.hs
 </screen>
 
        </listitem>
 
       <varlistentry>
        <term>
+          <option>-ddump-core-stats</option>
+          <indexterm><primary><option>-ddump-core-stats</option></primary></indexterm>
+        </term>
+       <listitem>
+         <para>Print a one-line summary of the size of the Core program
+                     at the end of the optimisation pipeline.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
           <option>-dfaststring-stats</option>
           <indexterm><primary><option>-dfaststring-stats</option></primary></indexterm>
         </term>
           style.</para>
        </listitem>
       </varlistentry>
+    </variablelist>
+  </sect2>
+
+  <sect2 id="formatting dumps">
+    <title>Formatting dumps</title>
 
+    <indexterm><primary>formatting dumps</primary></indexterm>
+
+     <variablelist>
       <varlistentry>
        <term>
           <option>-dppr-user-length</option>
          <para>In error messages, expressions are printed to a
          certain &ldquo;depth&rdquo;, with subexpressions beyond the
          depth replaced by ellipses.  This flag sets the
-         depth.</para>
+         depth.  Its default value is 5.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
+          <option>-dppr-colsNNN</option>
+          <indexterm><primary><option>-dppr-colsNNN</option></primary></indexterm>
+        </term>
+       <listitem>
+         <para>Set the width of debugging output. Use this if your code is wrapping too much.
+               For example: <option>-dppr-cols200</option>.</para>
        </listitem>
       </varlistentry>
 
       <varlistentry>
        <term>
-          <option>-dshow-unused-imports</option>
-          <indexterm><primary><option>-dshow-unused-imports</option></primary></indexterm>
+          <option>-dppr-case-as-let</option>
+          <indexterm><primary><option>-dppr-case-as-let</option></primary></indexterm>
         </term>
        <listitem>
-         <para>Have the renamer report what imports does not
-       contribute.</para>
+         <para>Print single alternative case expressions as though they were strict 
+               let expressions. This is helpful when your code does a lot of unboxing.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term>
+          <option>-dno-debug-output</option>
+          <indexterm><primary><option>-dno-debug-output</option></primary></indexterm>
+        </term>
+        <listitem>
+          <para>Suppress any unsolicited debugging output.  When GHC
+            has been built with the <literal>DEBUG</literal> option it
+            occasionally emits debug output of interest to developers.
+            The extra output can confuse the testing framework and
+            cause bogus test failures, so this flag is provided to
+            turn it off.</para>
+        </listitem>
+      </varlistentry>
+     </variablelist>
+
+  </sect2>
+
+  <sect2 id="supression">
+    <title>Suppressing unwanted information</title>
+
+    <indexterm><primary>suppression</primary></indexterm>
+
+    Core dumps contain a large amount of information. Depending on what you are doing, not all of it will be useful.
+    Use these flags to suppress the parts that you are not interested in.
+
+    <variablelist>
+      <varlistentry>
+       <term>
+          <option>-dsuppress-all</option>
+          <indexterm><primary><option>-dsuppress-all</option></primary></indexterm>
+        </term>
+       <listitem>
+         <para>Suppress everything that can be suppressed, except for unique ids as this often 
+               makes the printout ambiguous. If you just want to see the overall structure of
+               the code, then start here.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
+          <option>-dsuppress-uniques</option>
+          <indexterm><primary><option>-dsuppress-uniques</option></primary></indexterm>
+        </term>
+       <listitem>
+         <para>Suppress the printing of uniques. This may make 
+         the printout ambiguous (e.g. unclear where an occurrence of 'x' is bound), but
+         it makes the output of two compiler runs have many fewer gratuitous differences,
+           so you can realistically apply <command>diff</command>.  Once <command>diff</command>
+         has shown you where to look, you can try again without <option>-dsuppress-uniques</option></para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
+          <option>-dsuppress-idinfo</option>
+          <indexterm><primary><option>-dsuppress-idinfo</option></primary></indexterm>
+        </term>
+       <listitem>
+         <para>Suppress extended information about identifiers where they are bound. This includes
+               strictness information and inliner templates. Using this flag can cut the size 
+               of the core dump in half, due to the lack of inliner templates</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
+          <option>-dsuppress-module-prefixes</option>
+          <indexterm><primary><option>-dsuppress-module-prefixes</option></primary></indexterm>
+        </term>
+       <listitem>
+          <para>Suppress the printing of module qualification prefixes.
+               This is the <constant>Data.List</constant> in <constant>Data.List.length</constant>.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
+          <option>-dsuppress-type-signatures</option>
+          <indexterm><primary><option>-dsuppress-type-signatures</option></primary></indexterm>
+        </term>
+       <listitem>
+          <para>Suppress the printing of type signatures.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
+          <option>-dsuppress-type-applications</option>
+          <indexterm><primary><option>-dsuppress-type-applications</option></primary></indexterm>
+        </term>
+       <listitem>
+          <para>Suppress the printing of type applications.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
+          <option>-dsuppress-coercions</option>
+          <indexterm><primary><option>-dsuppress-coercions</option></primary></indexterm>
+        </term>
+       <listitem>
+          <para>Suppress the printing of type coercions.</para>
        </listitem>
       </varlistentry>
     </variablelist>
@@ -611,28 +794,15 @@ Main.skip2{-r1L6-} =
     of platform-specific code that needs to be written in order to get
     unregisterised compilation going is usually fairly small.</para>
 
-    <variablelist>
-      <varlistentry>
-       <term>
-          <option>-unreg</option>:
-          <indexterm><primary><option>-unreg</option></primary></indexterm>
-        </term>
-       <listitem>
-         <para>Compile via vanilla ANSI C only, turning off
-         platform-specific optimisations.  NOTE: in order to use
-         <option>-unreg</option>, you need to have a set of libraries
-         (including the RTS) built for unregisterised compilation.
-         This amounts to building GHC with way "u" enabled.</para>
-       </listitem>
-      </varlistentry>
-    </variablelist>
+   <para>Unregisterised compilation cannot be selected at
+   compile-time; you have to build GHC with the appropriate options
+   set.  Consult the GHC Building Guide for details.</para>
   </sect2>
 
 </sect1>
 
 <!-- Emacs stuff:
      ;;; Local Variables: ***
-     ;;; mode: xml ***
      ;;; sgml-parent-document: ("users_guide.xml" "book" "chapter" "sect1") ***
      ;;; End: ***
  -->