How to use pprTrace ?

Omar Mefire omefire at yahoo.fr
Sat Aug 15 22:48:40 UTC 2015


Thanks Edward !I'll heed your advice. Omar Mefire,  


     Le Samedi 15 août 2015 15h05, Edward Z. Yang <ezyang at mit.edu> a écrit :
   

 If you are really just using trace, and using it on a plain
set of strings from the command line, this shouldn't happen.
Hard to say more without a diff.

Why not experiment with tracing GHC in NOT ghc/Main.hs, or at least
after the code that sets up the global dynamic flags is all done?  If
you add trace statements to the type checker, you can expect pprTrace to
work fine.  As is, you're in a lot of pain for not very much benefit.

Edward

Excerpts from Omar Mefire's message of 2015-08-15 14:56:35 -0700:
> Thanks,It's pretty simple what I wanna print, I'm trying to familiarize myself with debugging GHC so I can get a general feel for how the whole thing works.
> Trying to use Debug.Trace.trace or Debug.Trace.traceStack, I now get the following error :
>       GHC [stage 1] compiler/stage2/build/Module.o-boot      ghc-stage1: panic! (the 'impossible' happened)      (GHC version 7.11.20150810 for x86_64-unknown-linux): v_unsafeGlobalDynFlags: not initialised
>  Omar Mefire, 
> 
> 
>      Le Samedi 15 août 2015 13h45, Edward Z. Yang <ezyang at mit.edu> a écrit :
>    
> 
>  It is just as the message says: you can't use pprTrace too early in the
> execution of a GHC program.  It looks like you're trying to print
> something pretty simple, so why not try a plain old Debug.Trace trace?
> 
> Edward
> 
> Excerpts from Omar Mefire's message of 2015-08-15 13:40:35 -0700:
> > Hi all,I'm trying to step through some ghc code.I am trying to use pprTrace ( for the first time ) and I keep getting an error when I use it :I've added it to the file ghc/Main.hs and the resulting code is this :
> >        let argv1' = map (mkGeneralLocated "on the commandline") argv1       (argv2, staticFlagWarnings) <- pprTrace "argv1 prime" (ppr argv1') $ parseStaticFlags argv1'
> > I want to examine the value of argv1'. After my modification, I go into the ghc/ folder and run : 'make'But doing this leads to an error when I try to run the program :
> >       ghc-stage2: panic! (the 'impossible' happened)      (GHC version 7.11.20150810 for x86_64-unknown-linux): Static flags have not been initialised!          Please call GHC.parseStaticFlags early enough.
> > What am I doing wrong ? Omar Mefire, 
> 


  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20150815/aa574bf4/attachment-0001.html>


More information about the ghc-devs mailing list