-resume (Session ref) res@(ResumeHandle breakMVar statusMVar names) = do
- stablePtr <- setBreakAction res
- putMVar breakMVar ()
- status <- takeMVar statusMVar
- handleRunStatus ref names status
+resume (Session ref) res@(ResumeHandle breakMVar statusMVar
+ final_names ic names)
+ = do
+ -- restore the original interactive context. This is not entirely
+ -- satisfactory: any new bindings made since the breakpoint stopped
+ -- will be dropped from the interactive context, but not from the
+ -- linker's environment.
+ hsc_env <- readIORef ref
+ writeIORef ref hsc_env{ hsc_IC = ic }
+ Linker.deleteFromLinkEnv names
+
+ stablePtr <- setBreakAction breakMVar statusMVar final_names
+ putMVar breakMVar () -- this awakens the stopped thread...
+ status <- takeMVar statusMVar -- and wait for the result
+ freeStablePtr stablePtr -- be careful not to leak stable pointers!
+ handleRunStatus ref ic names status