X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FBreakpoints.hs;h=fccf1a83c7c84c08f2027f0f85e475b3bf1de813;hb=84923cc7de2a93c22a2f72daf9ac863959efae13;hp=8bb171674d391ebb080442477cc2dd7060ee6bf1;hpb=ead424357937b23f30295608b467aacbc3a8a8bc;p=ghc-hetmet.git diff --git a/compiler/main/Breakpoints.hs b/compiler/main/Breakpoints.hs index 8bb1716..fccf1a8 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 +#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,27 @@ nullBkptHandler = BkptHandler { isAutoBkptEnabled = \ _ _ -> return False, handleBreakpoint = \_ _ _ _ b -> putStrLn "null Bkpt Handler" >> return b } +#endif type BkptLocation a = (a, SiteNumber) type SiteNumber = Int + +type SiteMap = [(SiteNumber, Coord)] +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 */ +