diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-10-27 19:07:36 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-10-27 19:26:02 -0400 |
commit | e9230de42518656cb61e7d403e0482999bfe4ed5 (patch) | |
tree | 0e2b7143933147489ed367e5cb63c974aaa3ec89 | |
parent | 9cc6c1932dbbd3d27405a8ebe5586a0ef09dd7fd (diff) | |
download | haskell-wip/modbreaks.tar.gz |
ghci: Make getModBreaks robust against DotO Unlinkedwip/modbreaks
Previously getModBreaks assumed that an interpreted linkable will have
only a single `BCOs` `Unlinked` entry. However, in general an object may
also contain `DotO`s; ignore these.
Fixes #20570.
-rw-r--r-- | compiler/GHC/Runtime/Interpreter.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/GHC/Runtime/Interpreter.hs b/compiler/GHC/Runtime/Interpreter.hs index 29c5592299..10d2520f18 100644 --- a/compiler/GHC/Runtime/Interpreter.hs +++ b/compiler/GHC/Runtime/Interpreter.hs @@ -724,10 +724,15 @@ fromEvalResult (EvalSuccess a) = return a getModBreaks :: HomeModInfo -> ModBreaks getModBreaks hmi | Just linkable <- hm_linkable hmi, - [BCOs cbc _] <- linkableUnlinked linkable + [cbc] <- mapMaybe onlyBCOs $ linkableUnlinked linkable = fromMaybe emptyModBreaks (bc_breaks cbc) | otherwise = emptyModBreaks -- probably object code + where + -- The linkable may have 'DotO's as well; only consider BCOs. See #20570. + onlyBCOs :: Unlinked -> Maybe CompiledByteCode + onlyBCOs (BCOs cbc _) = Just cbc + onlyBCOs _ = Nothing -- | Interpreter uses Profiling way interpreterProfiled :: Interp -> Bool |