X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FBreakpoints.hs;h=34e07fb3d9c2f75cc1222334c64dc52876394032;hb=209686695e664bc148d4031f746425ffc2d2eecc;hp=14d9ea299d2cd7ce9cfeb53ee237a69e4d4c14d8;hpb=376101055fb111ebd52b5ef1fb76e00334b44304;p=ghc-hetmet.git diff --git a/compiler/main/Breakpoints.hs b/compiler/main/Breakpoints.hs index 14d9ea2..34e07fb 100644 --- a/compiler/main/Breakpoints.hs +++ b/compiler/main/Breakpoints.hs @@ -9,8 +9,18 @@ module Breakpoints where +#ifdef GHCI +import {-#SOURCE#-} ByteCodeLink ( HValue ) +#endif + import {-#SOURCE#-} HscTypes ( Session ) +import Name +import Var ( Id ) +import PrelNames + +import GHC.Exts ( unsafeCoerce# ) +#ifdef GHCI data BkptHandler a = BkptHandler { handleBreakpoint :: forall b. Session -> [(Id,HValue)] -> BkptLocation a -> String -> b -> IO b , isAutoBkptEnabled :: Session -> BkptLocation a -> IO Bool @@ -20,6 +30,7 @@ nullBkptHandler = BkptHandler { isAutoBkptEnabled = \ _ _ -> return False, handleBreakpoint = \_ _ _ _ b -> putStrLn "null Bkpt Handler" >> return b } +#endif type BkptLocation a = (a, SiteNumber) type SiteNumber = Int @@ -29,3 +40,17 @@ type Coord = (Int, Int) noDbgSites :: SiteMap noDbgSites = [] + +-- | Returns the 'identity' jumps +-- Used to deal with spliced code, where we don't want breakpoints +#ifdef GHCI +lookupBogusBreakpointVal :: Name -> Maybe HValue +lookupBogusBreakpointVal name + | name == breakpointJumpName = Just$ unsafeCoerce# (\_ _ _ _ a->a) + | name == breakpointAutoJumpName = Just$ unsafeCoerce# (\_ _ _ _ a->a) + | name == breakpointCondJumpName = Just$ unsafeCoerce# (\_ _ _ _ _ a->a) + | otherwise = Nothing +#else +lookupBogusBreakpointVal _ = Nothing +#endif /* GHCI */ +