summaryrefslogtreecommitdiff
path: root/compiler/GHC
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-10-27 19:07:36 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-30 15:43:28 -0400
commitea862ef5b3779476e0aa2d20bbae1946d07430f1 (patch)
treee56376be5270f684ea1f82367183103ae98f8bb5 /compiler/GHC
parent2a4581ffcf3dd80e5933684f46ddfe30447a3ced (diff)
downloadhaskell-ea862ef5b3779476e0aa2d20bbae1946d07430f1.tar.gz
ghci: Make getModBreaks robust against DotO Unlinked
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.
Diffstat (limited to 'compiler/GHC')
-rw-r--r--compiler/GHC/Runtime/Interpreter.hs7
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