From 8c58d23464c76f52c6aad7e6653908eb99e64743 Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 11 Nov 2002 15:49:58 +0000 Subject: [PATCH] [project @ 2002-11-11 15:49:58 by simonmar] - embelish the documentation for +RTS -xc a bit - add some more question/answer pairs to the FAQ --- ghc/docs/users_guide/faq.sgml | 75 +++++++++++++++++++++++++++++ ghc/docs/users_guide/profiling.sgml | 2 +- ghc/docs/users_guide/runtime_control.sgml | 17 +++++++ 3 files changed, 93 insertions(+), 1 deletion(-) diff --git a/ghc/docs/users_guide/faq.sgml b/ghc/docs/users_guide/faq.sgml index dd7225b..8055d15 100644 --- a/ghc/docs/users_guide/faq.sgml +++ b/ghc/docs/users_guide/faq.sgml @@ -202,6 +202,81 @@ with g++ and gcc 3.0. + + + My program is failing with head [], or + an array bounds error, or some other random error, and I have no + idea how to find the bug. Can you help? + + + Compile your program with -prof +-auto-all (make sure you have the profiling libraries +installed), and run it with +RTS -xc -RTS to get a +“stack trace” at the point at which the exception was +raised. See for more +details. + + + + + How do I increase the heap size permanently for a given + binary? + + See . + + + + + I'm trying to compile my program for parallel execution + with the , and GHC complains with an + error like “failed to load interface file for + Prelude”. + + GHC doesn't ship with support for parallel execution, + that support is provided separately by the GPH project. + + + + + When is it safe to use + unsafePerformIO? + + We'll give two answers to this question, each of which + may be helpful. These criteria are not rigorous in any real + sense (you'd need a formal semantics for Haskell in order to + give a proper answer to this question), but should give you a + feel for the kind of things you can and cannot do with + unsafePerformIO. + + + + It is safe to implement a function or API using + unsafePerformIO if you could imagine + also implementing the same function or API in Haskell + without using unsafePerformIO (forget + about efficiency, just consider the semantics). + + + + In pure Haskell, the value of a function depends + only on the values of its arguments (and free variables, + if it has any). If you can implement the function using + unsafePerformIO and still retain this + invariant, then you're probably using + unsafePerformIO in a safe way. Note + that you need only consider the + observable values of the arguments + and result. + + + + For more information, see this + thread. + + + diff --git a/ghc/docs/users_guide/profiling.sgml b/ghc/docs/users_guide/profiling.sgml index 6621645..b89cf65 100644 --- a/ghc/docs/users_guide/profiling.sgml +++ b/ghc/docs/users_guide/profiling.sgml @@ -45,7 +45,7 @@ - + Cost centres and cost-centre stacks GHC's profiling system assigns costs diff --git a/ghc/docs/users_guide/runtime_control.sgml b/ghc/docs/users_guide/runtime_control.sgml index f8e43d9..8e2e13e 100644 --- a/ghc/docs/users_guide/runtime_control.sgml +++ b/ghc/docs/users_guide/runtime_control.sgml @@ -430,6 +430,23 @@ -auto-all and running with +RTS -xc -RTS will tell you exactly the call stack at the point the error was raised. + + The output contains one line for each exception raised + in the program (the program might raise and catch several + exceptions during its execution), where each line is of the + form: + + +< cc1, ..., ccn > + + each cci is + a cost centre in the program (see ), and the sequence represents the + “call stack” at the point the exception was + raised. The leftmost item is the innermost function in the + call stack, and the rightmost item is the outermost + function. + -- 1.7.10.4