Hello,
I have a multi-threaded and interactive application that sometimes
stops responding, and it would be helpful being able to inspect the
state when it doesn't.
I thought the GHCi debugger could be useful here, however I see no way
to signal a thread and have GHCi show me its state.
Here is an example GHCi session:
$ cat t.hs
import Control.Concurrent
import Control.Exception
import Control.Monad
import System.IO
spawnThread :: String -> IO ThreadId
spawnThread label =
forkIO $ flip finally (putStrLn $ "bye " ++ label) $
forM_ [0..] $ \i -> threadDelay 1000000
$ ghci-7.10.1 t.hs -fbreak-on-exception -v0
*Main> hSetBuffering stdout LineBuffering
*Main> t0 <- spawnThread "t0"
*Main> throwTo t0 (ErrorCall "end")
*Main>
It looks like I'm not getting the "bye t0" message when stopping the
thread while using -fbreak-on-exception.
Is the debugger supposed to be used like this? Otherwise, is there any
way in which I could inspect the state of a running thread?
Thanks,
Facundo
_______________________________________________
Glasgow-haskell-users mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users