[project @ 2001-02-15 17:33:53 by simonmar]
[ghc-hetmet.git] / ghc / docs / users_guide / debugging.sgml
index b0efce5..e6e8029 100644 (file)
@@ -11,123 +11,6 @@ HACKER TERRITORY. HACKER TERRITORY.
 (You were warned.)
 </Para>
 
-<Sect2 id="replacing-phases">
-<Title>Replacing the program for one or more phases.
-</Title>
-
-<Para>
-<IndexTerm><Primary>GHC phases, changing</Primary></IndexTerm>
-<IndexTerm><Primary>phases, changing GHC</Primary></IndexTerm>
-You may specify that a different program be used for one of the phases
-of the compilation system, in place of whatever the driver <Command>ghc</Command> has
-wired into it.  For example, you might want to try a different
-assembler.  The
-<Option>-pgm&lt;phase-code&gt;&lt;program-name&gt;</Option><IndexTerm><Primary>-pgm&lt;phase&gt;&lt;stuff&gt;
-option</Primary></IndexTerm> option to <Command>ghc</Command> will cause it to use <Literal>&lt;program-name&gt;</Literal>
-for phase <Literal>&lt;phase-code&gt;</Literal>, where the codes to indicate the phases are:
-</Para>
-
-<Para>
-<InformalTable>
-<TGroup Cols="2">
-<ColSpec Align="Left" Colsep="0">
-<ColSpec Align="Left" Colsep="0">
-<TBody>
-<Row>
-<Entry><Emphasis>code</Emphasis> </Entry>
-<Entry><Emphasis>phase</Emphasis> </Entry>
-</Row>
-
-<Row>
-<Entry>
-L </Entry>
-<Entry> literate pre-processor </Entry>
-</Row>
-<Row>
-<Entry>
-P </Entry>
-<Entry> C pre-processor (if -cpp only) </Entry>
-</Row>
-<Row>
-<Entry>
-C </Entry>
-<Entry> Haskell compiler </Entry>
-</Row>
-<Row>
-<Entry>
-c </Entry>
-<Entry> C compiler</Entry>
-</Row>
-<Row>
-<Entry>
-a </Entry>
-<Entry> assembler </Entry>
-</Row>
-<Row>
-<Entry>
-l </Entry>
-<Entry> linker </Entry>
-</Row>
-<Row>
-<Entry>
-dep </Entry>
-<Entry> Makefile dependency generator </Entry>
-</Row>
-
-</TBody>
-
-</TGroup>
-</InformalTable>
-</Para>
-
-</Sect2>
-
-<Sect2 id="forcing-options-through">
-<Title>Forcing options to a particular phase.
-</Title>
-
-<Para>
-<IndexTerm><Primary>forcing GHC-phase options</Primary></IndexTerm>
-</Para>
-
-<Para>
-The preceding sections describe driver options that are mostly
-applicable to one particular phase.  You may also <Emphasis>force</Emphasis> a
-specific option <Option>&lt;option&gt;</Option> to be passed to a particular phase
-<Literal>&lt;phase-code&gt;</Literal> by feeding the driver the option
-<Option>-opt&lt;phase-code&gt;&lt;option&gt;</Option>.<IndexTerm><Primary>-opt&lt;phase&gt;&lt;stuff&gt;
-option</Primary></IndexTerm> The codes to indicate the phases are the same as in the
-previous section.
-</Para>
-
-<Para>
-So, for example, to force an <Option>-Ewurble</Option> option to the assembler, you
-would tell the driver <Option>-opta-Ewurble</Option> (the dash before the E is
-required).
-</Para>
-
-<Para>
-Besides getting options to the Haskell compiler with <Option>-optC&lt;blah&gt;</Option>,
-you can get options through to its runtime system with
-<Option>-optCrts&lt;blah&gt;</Option><IndexTerm><Primary>-optCrts&lt;blah&gt; option</Primary></IndexTerm>.
-</Para>
-
-<Para>
-So, for example: when I want to use my normal driver but with my
-profiled compiler binary, I use this script:
-
-<ProgramListing>
-#! /bin/sh
-exec /local/grasp_tmp3/simonpj/ghc-BUILDS/working-alpha/ghc/driver/ghc \
-     -pgmC/local/grasp_tmp3/simonpj/ghc-BUILDS/working-hsc-prof/hsc \
-     -optCrts-i0.5 \
-     -optCrts-PT \
-     "$@"
-</ProgramListing>
-
-</Para>
-
-</Sect2>
 
 <Sect2 id="dumping-output">
 <Title>Dumping out compiler intermediate structures
@@ -142,17 +25,6 @@ exec /local/grasp_tmp3/simonpj/ghc-BUILDS/working-alpha/ghc/driver/ghc \
 <VariableList>
 
 <VarListEntry>
-<Term><Option>-noC</Option>:</Term>
-<ListItem>
-<Para>
-<IndexTerm><Primary>-noC option</Primary></IndexTerm>
-Don't bother generating C output <Emphasis>or</Emphasis> an interface file.  Usually
-used in conjunction with one or more of the <Option>-ddump-*</Option> options; for
-example: <Command>ghc -noC -ddump-simpl Foo.hs</Command>
-</Para>
-</ListItem>
-</VarListEntry>
-<VarListEntry>
 <Term><Option>-hi</Option>:</Term>
 <ListItem>
 <Para>
@@ -192,10 +64,11 @@ Some of the most useful ones are:
 <Term><Option>-ddump-parsed</Option>:</Term>
 <ListItem>
 <Para>
-oarser output
+parser output
 </Para>
 </ListItem>
 </VarListEntry>
+
 <VarListEntry>
 <Term><Option>-ddump-rn</Option>:</Term>
 <ListItem>
@@ -204,6 +77,7 @@ renamer output
 </Para>
 </ListItem>
 </VarListEntry>
+
 <VarListEntry>
 <Term><Option>-ddump-tc</Option>:</Term>
 <ListItem>
@@ -212,6 +86,20 @@ typechecker output
 </Para>
 </ListItem>
 </VarListEntry>
+
+<VarListEntry>
+<Term><Option>-ddump-types</Option>:</Term>
+<ListItem>
+<Para>
+Dump a type signature for each value defined at the top level
+of the module.  The list is sorted alphabetically.  
+Using <Option>-dppr-debug</Option> dumps a type signature for
+all the imported and system-defined things as well; useful
+for debugging the compiler.
+</Para>
+</ListItem>
+</VarListEntry>
+
 <VarListEntry>
 <Term><Option>-ddump-deriv</Option>:</Term>
 <ListItem>
@@ -656,7 +544,7 @@ disappointed if you try to glob etc. inside <Literal>OPTIONS</Literal>.
 
 <Para>
 NOTE: the contents of OPTIONS are prepended to the command-line
-options, so you *do* have the ability to override OPTIONS settings
+options, so you <Emphasis>do</Emphasis> have the ability to override OPTIONS settings
 via the command line.
 </Para>
 
@@ -670,6 +558,38 @@ file).
 
 </Sect2>
 
+  <sect2 id="unreg">
+    <title>Unregisterised compilation</title>
+    <indexterm><primary>unregisterised compilation</primary></indexterm>
+
+    <para>The term "unregisterised" really means "compile via vanilla
+    C", disabling some of the platform-specific tricks that GHC
+    normally uses to make programs go faster.  When compiling
+    unregisterised, GHC simply generates a C file which is compiled
+    via gcc.</para>
+
+    <para>Unregisterised compilation can be useful when porting GHC to
+    a new machine, since it reduces the prerequisite tools to
+    <command>gcc</command>, <command>as</command>, and
+    <command>ld</command> and nothing more, and furthermore the amount
+    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>:</term>
+       <indexterm><primary><option>-unreg</option></primary></indexterm>
+       <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>
+  </sect2>
+
 </Sect1>
 
 <!-- Emacs stuff: