Skip to content

Stack.Decode: Don't error on bitmap size 0

Rodrigo Mesquita requested to merge wip/romes/26640 into master
A RET_BCO may have a bitmap with no payload.
In that case, the bitmap = 0.

One can observe this by using -ddump-bcos and interpreting

```
main = pure ()
```

Observe, for instance, that the BCO for this main function has size 0:

```
ProtoBCO Main.main#0:
   \u []
       break<main:Main,0>() GHC.Internal.Base.pure
                                GHC.Internal.Base.$fApplicativeIO GHC.Internal.Tuple.()
   bitmap:  0 []
   BRK_FUN <breakarray> main:Main 0 <cc>
   PACK     () 0
   PUSH_G   GHC.Internal.Base.$fApplicativeIO
   PUSH_APPLY_PP
   PUSH_G   GHC.Internal.Base.pure
   ENTER
```

Perhaps we never tried to decode a stack in which a BCO like this was
present. However, for the debugger, we want to decode stacks of threads
stopped at breakpoints, and these kind of BCOs do get on a stack under
e.g. `stg_apply_interp_info` frames.

See the accompanying test in the next commit for an example to trigger
the bug this commit fixes.

Fixes #26640

Fixes #26640 (closed)

Merge request reports

Loading