Skip to content

Instantly share code, notes, and snippets.

@bos
Created November 27, 2010 03:39
Show Gist options
  • Save bos/717542 to your computer and use it in GitHub Desktop.
Save bos/717542 to your computer and use it in GitHub Desktop.
A quick hack for debugging the GHC RTS
import Foreign.C.String
import Foreign.Ptr
import System.Posix.Internals
debug :: String -> IO ()
debug s = do
withCStringLen (s++"\n") $ \(ptr,len) ->
c_safe_write 2 (castPtr ptr) (fromIntegral len)
return ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment