X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Debug%2FTrace.hs;h=ebacb6c3d7fa28d37e385a2d240c97b2bd4d8d78;hb=HEAD;hp=40915215c97534fdbc5e3ed67009b8dcb031fe6e;hpb=b50e64c6f56695ce4c5b874e36c26db1c62be46e;p=ghc-base.git diff --git a/Debug/Trace.hs b/Debug/Trace.hs index 4091521..ebacb6c 100644 --- a/Debug/Trace.hs +++ b/Debug/Trace.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE CPP, ForeignFunctionInterface #-} + ----------------------------------------------------------------------------- -- | -- Module : Debug.Trace @@ -13,9 +15,10 @@ ----------------------------------------------------------------------------- module Debug.Trace ( - -- * Tracing - putTraceMsg, -- :: String -> IO () - trace -- :: String -> a -> a + -- * Tracing + putTraceMsg, -- :: String -> IO () + trace, -- :: String -> a -> a + traceShow ) where import Prelude @@ -40,7 +43,10 @@ putTraceMsg msg = do withCString msg $ \cmsg -> debugBelch cfmt cmsg -foreign import ccall unsafe debugBelch :: CString -> CString -> IO () +-- 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 {-# NOINLINE trace #-}