Skip to content

IPE Backtrace decoding crashes when profiling is enabled

Summary

Compiling and running the program with profiling:

import Control.Exception
import Control.Exception.Backtrace

main :: IO ()
main = do
  setBacktraceMechanismState IPEBacktrace True
  throwIO $ ErrorCall "Throw error"

Results in the following error:

ann_frame001: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall:

Enum.toEnum{ClosureType}: tag (1060748) is outside of enumeration's range (0,66)

Can also be reproduced by running the test ann_frame001 with extra_ways(['prof']).

It seems like the stack decoding logic doesn't account for profiling constants, esp the imports

import GHC.Internal.Heap.InfoTable
import GHC.Internal.Stack.Constants

in GHC.Internal.Stack.Decode seem incorrect, as the constants are going to be different depending on profiling.

Steps to reproduce

Please provide a set of concrete steps to reproduce the issue.

Expected behavior

Should not crash :)

Environment

Optional:

  • Operating System: arch linux
  • System Architecture: x86
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information