Capturing and keeping track of local bindins in the desugarer
[ghc-hetmet.git] / compiler / main / Breakpoints.hs
index 14d9ea2..b1b0118 100644 (file)
@@ -9,7 +9,16 @@
 \r
 module Breakpoints where\r
 \r
+#ifdef GHCI\r
+import {-#SOURCE#-} ByteCodeLink ( HValue ) \r
+#endif\r
+\r
 import {-#SOURCE#-} HscTypes     ( Session )\r
+import Name\r
+import Var                       ( Id )\r
+import PrelNames\r
+\r
+import GHC.Exts                  ( unsafeCoerce# )\r
 \r
 data BkptHandler a = BkptHandler {\r
      handleBreakpoint  :: forall b. Session -> [(Id,HValue)] -> BkptLocation a ->  String -> b -> IO b\r
@@ -29,3 +38,16 @@ type Coord        = (Int, Int)
 \r
 noDbgSites :: SiteMap\r
 noDbgSites = []\r
+\r
+-- | Returns the 'identity' jumps\r
+--   Used to deal with spliced code, where we don't want breakpoints\r
+#ifdef GHCI\r
+lookupBogusBreakpointVal :: Name -> Maybe HValue\r
+lookupBogusBreakpointVal name \r
+  | name == breakpointJumpName     = Just$ unsafeCoerce# (\_ _ _ _ a->a)\r
+  | name == breakpointAutoJumpName = Just$ unsafeCoerce# (\_ _ _ _ a->a)\r
+  | name == breakpointCondJumpName = Just$ unsafeCoerce# (\_ _ _ _ _ a->a)\r
+  | otherwise = Nothing\r
+#else \r
+lookupBogusBreakpointVal _ = Nothing\r
+#endif //GHCI\r