-xc

Serge D. Mechveliani mechvel at botik.ru
Mon Nov 13 09:15:27 EST 2006


Simon P. Jones  wrote today about the  -xc  option to help with
finding who called  fromJust Noting.
 
Now, I see in the GHC Guide:

------------------------------------------------------------------
-xs

(Only available when the program is compiled for profiling.) When an 
exception is raised in the program, this option causes the current 
cost-centre-stack to be dumped to stderr.
This can be particularly useful for debugging: if your program is 
complaining about a head [] error and you haven't got a clue which bit of 
code is causing it, compiling with -prof -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 >
...
---------------------------------------------------------------------


So, I `made' the project under  -prof -auto-all   and run

              ./Nat1  +RTS -xc -RTS.
It prints
  ...
  (3, Ind n,
   (formula1
    [(1, IndMember,
  <Data.Maybe.CAF>Nat1: Maybe.fromJust: Nothing

This does not help to see who called for  fromJust  in this case.

Maybe this is in  Nat.prof ?  And it is empty. 
Adding  -p  does fill  Nat.prof  with a lot of statistics,
but I guess, this statistics cannot help with the  fromJust  question.

Can people, please, comment some more on this  -xc  usage?

Thank you in advance for explanation,

-----------------
Serge Mechveliani
mechvel at botik.ru






More information about the Glasgow-haskell-users mailing list