X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Debug%2FTrace.hs;h=ebacb6c3d7fa28d37e385a2d240c97b2bd4d8d78;hb=be2750a0a11b919fb03cc070074e430f88bdfa90;hp=16a614e6614a3e729c6229ae57929c400c925394;hpb=e8a5a9136fee6d032580b885457581955884a777;p=ghc-base.git diff --git a/Debug/Trace.hs b/Debug/Trace.hs index 16a614e..ebacb6c 100644 --- a/Debug/Trace.hs +++ b/Debug/Trace.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE CPP, ForeignFunctionInterface #-} + ----------------------------------------------------------------------------- -- | -- Module : Debug.Trace @@ -13,9 +15,9 @@ ----------------------------------------------------------------------------- module Debug.Trace ( - -- * Tracing - putTraceMsg, -- :: String -> IO () - trace, -- :: String -> a -> a + -- * Tracing + putTraceMsg, -- :: String -> IO () + trace, -- :: String -> a -> a traceShow ) where @@ -41,7 +43,9 @@ putTraceMsg msg = do withCString msg $ \cmsg -> debugBelch cfmt cmsg -foreign import ccall unsafe "RtsMessages.h debugBelch" +-- don't use debugBelch() directly, because we cannot call varargs functions +-- using the FFI. +foreign import ccall unsafe "HsBase.h debugBelch2" debugBelch :: CString -> CString -> IO () #endif