[Haskell-cafe] GHC API question
Albert Y. C. Lai
trebla at vex.net
Tue Aug 30 00:50:30 CEST 2011
On 11-08-28 11:38 AM, Chris Smith wrote:
> Okay, I should have waited until morning to post this... so actually,
> things still work fine when I build without profiling. However, when I
> build with profiling, I get the segfault. I'm guessing either I need to
> set different dynamic flags with the profiling build to match the
> options of the compiler that built the executable... or perhaps it's
> still impossible to do what I'm looking for with profiling enabled.
> Does anyone know which is the case?
Inspired by thees facts:
A. all other aspects of GHC are so keen on never mixing profiling-built
code with non-profiling-built code
B. GHC API loads modules from disk, regardless of whether the same
module is already part of the executable. And then, stuff from loaded
modules is expected to be compatible with stuff from the executable, e.g.,
x <- unsafeCoerce `liftM` getHValue blah blah
print x
x is from loaded code, print is from executable code, we mix them.
(After all, presumably the executable got its code from the same origin.)
I hypothesize that your program is made to mix profiling-built code (in
the executable, such as print) with non-profiling-built code (in loaded
modules, such as x). They probably don't mix well.
I don't know how to convince GHC API to load modules from profiling
libraries.
More information about the Haskell-Cafe
mailing list