X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FBreakpoints.hs;h=b1b011817999521d36344a88c61a4b925e069f61;hb=8d5364c135b7d40ae62c63ff9e65c684a1712694;hp=14d9ea299d2cd7ce9cfeb53ee237a69e4d4c14d8;hpb=376101055fb111ebd52b5ef1fb76e00334b44304;p=ghc-hetmet.git diff --git a/compiler/main/Breakpoints.hs b/compiler/main/Breakpoints.hs index 14d9ea2..b1b0118 100644 --- a/compiler/main/Breakpoints.hs +++ b/compiler/main/Breakpoints.hs @@ -9,7 +9,16 @@ 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# ) data BkptHandler a = BkptHandler { handleBreakpoint :: forall b. Session -> [(Id,HValue)] -> BkptLocation a -> String -> b -> IO b @@ -29,3 +38,16 @@ 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