{-# LINE 1 "libraries/base/GHC/RTS/Flags.hsc" #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LINE 2 "libraries/base/GHC/RTS/Flags.hsc" #-}
{-# LANGUAGE RecordWildCards   #-}

-- | Accessors to GHC RTS flags.
-- Descriptions of flags can be seen in
-- <https://www.haskell.org/ghc/docs/latest/html/users_guide/runtime-control.html GHC User's Guide>,
-- or by running RTS help message using @+RTS --help@.
--
-- @since 4.8.0.0
--
module GHC.RTS.Flags
  ( RTSFlags (..)
  , GCFlags (..)
  , ConcFlags (..)
  , MiscFlags (..)
  , DebugFlags (..)
  , CCFlags (..)
  , ProfFlags (..)
  , TraceFlags (..)
  , TickyFlags (..)
  , getRTSFlags
  , getGCFlags
  , getConcFlags
  , getMiscFlags
  , getDebugFlags
  , getCCFlags
  , getProfFlags
  , getTraceFlags
  , getTickyFlags
  ) where


{-# LINE 33 "libraries/base/GHC/RTS/Flags.hsc" #-}

{-# LINE 34 "libraries/base/GHC/RTS/Flags.hsc" #-}

import Control.Applicative
import Control.Monad

import Foreign.C.String    (peekCString)
import Foreign.C.Types     (CChar, CInt)
import Foreign.Ptr         (Ptr, nullPtr)
import Foreign.Storable    (peekByteOff)

import GHC.Base
import GHC.Enum
import GHC.IO
import GHC.Real
import GHC.Show
import GHC.Word

-- | @'Time'@ is defined as a @'StgWord64'@ in @stg/Types.h@
type Time = Word64

-- | @'nat'@ defined in @rts/Types.h@
type Nat = Word32
{-# LINE 55 "libraries/base/GHC/RTS/Flags.hsc" #-}

data GiveGCStats
    = NoGCStats
    | CollectGCStats
    | OneLineGCStats
    | SummaryGCStats
    | VerboseGCStats
    deriving (Show)

instance Enum GiveGCStats where
    fromEnum NoGCStats      = 0
{-# LINE 66 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum CollectGCStats = 1
{-# LINE 67 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum OneLineGCStats = 2
{-# LINE 68 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum SummaryGCStats = 3
{-# LINE 69 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum VerboseGCStats = 4
{-# LINE 70 "libraries/base/GHC/RTS/Flags.hsc" #-}

    toEnum 0      = NoGCStats
{-# LINE 72 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 1 = CollectGCStats
{-# LINE 73 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 2 = OneLineGCStats
{-# LINE 74 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 3 = SummaryGCStats
{-# LINE 75 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 4 = VerboseGCStats
{-# LINE 76 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum e = error ("invalid enum for GiveGCStats: " ++ show e)

data GCFlags = GCFlags
    { statsFile             :: Maybe FilePath
    , giveStats             :: GiveGCStats
    , maxStkSize            :: Nat
    , initialStkSize        :: Nat
    , stkChunkSize          :: Nat
    , stkChunkBufferSize    :: Nat
    , maxHeapSize           :: Nat
    , minAllocAreaSize      :: Nat
    , minOldGenSize         :: Nat
    , heapSizeSuggestion    :: Nat
    , heapSizeSuggesionAuto :: Bool
    , oldGenFactor          :: Double
    , pcFreeHeap            :: Double
    , generations           :: Nat
    , steps                 :: Nat
    , squeezeUpdFrames      :: Bool
    , compact               :: Bool -- ^ True <=> "compact all the time"
    , compactThreshold      :: Double
    , sweep                 :: Bool
      -- ^ use "mostly mark-sweep" instead of copying for the oldest generation
    , ringBell              :: Bool
    , frontpanel            :: Bool
    , idleGCDelayTime       :: Time
    , doIdleGC              :: Bool
    , heapBase              :: Word -- ^ address to ask the OS for memory
    , allocLimitGrace       :: Word
    } deriving (Show)

data ConcFlags = ConcFlags
    { ctxtSwitchTime  :: Time
    , ctxtSwitchTicks :: Int
    } deriving (Show)

data MiscFlags = MiscFlags
    { tickInterval          :: Time
    , installSignalHandlers :: Bool
    , machineReadable       :: Bool
    , linkerMemBase         :: Word
      -- ^ address to ask the OS for memory for the linker, 0 ==> off
    } deriving (Show)

-- | Flags to control debugging output & extra checking in various
-- subsystems.
data DebugFlags = DebugFlags
    { scheduler   :: Bool -- ^ 's'
    , interpreter :: Bool -- ^ 'i'
    , weak        :: Bool -- ^ 'w'
    , gccafs      :: Bool -- ^ 'G'
    , gc          :: Bool -- ^ 'g'
    , block_alloc :: Bool -- ^ 'b'
    , sanity      :: Bool -- ^ 'S'
    , stable      :: Bool -- ^ 't'
    , prof        :: Bool -- ^ 'p'
    , linker      :: Bool -- ^ 'l' the object linker
    , apply       :: Bool -- ^ 'a'
    , stm         :: Bool -- ^ 'm'
    , squeeze     :: Bool -- ^ 'z' stack squeezing & lazy blackholing
    , hpc         :: Bool -- ^ 'c' coverage
    , sparks      :: Bool -- ^ 'r'
    } deriving (Show)

data DoCostCentres
    = CostCentresNone
    | CostCentresSummary
    | CostCentresVerbose
    | CostCentresAll
    | CostCentresXML
    deriving (Show)

instance Enum DoCostCentres where
    fromEnum CostCentresNone    = 0
{-# LINE 150 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum CostCentresSummary = 1
{-# LINE 151 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum CostCentresVerbose = 2
{-# LINE 152 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum CostCentresAll     = 3
{-# LINE 153 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum CostCentresXML     = 4
{-# LINE 154 "libraries/base/GHC/RTS/Flags.hsc" #-}

    toEnum 0    = CostCentresNone
{-# LINE 156 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 1 = CostCentresSummary
{-# LINE 157 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 2 = CostCentresVerbose
{-# LINE 158 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 3     = CostCentresAll
{-# LINE 159 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 4     = CostCentresXML
{-# LINE 160 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum e = error ("invalid enum for DoCostCentres: " ++ show e)

data CCFlags = CCFlags
    { doCostCentres :: DoCostCentres
    , profilerTicks :: Int
    , msecsPerTick  :: Int
    } deriving (Show)

data DoHeapProfile
    = NoHeapProfiling
    | HeapByCCS
    | HeapByMod
    | HeapByDescr
    | HeapByType
    | HeapByRetainer
    | HeapByLDV
    | HeapByClosureType
    deriving (Show)

instance Enum DoHeapProfile where
    fromEnum NoHeapProfiling   = 0
{-# LINE 181 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum HeapByCCS         = 1
{-# LINE 182 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum HeapByMod         = 2
{-# LINE 183 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum HeapByDescr       = 4
{-# LINE 184 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum HeapByType        = 5
{-# LINE 185 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum HeapByRetainer    = 6
{-# LINE 186 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum HeapByLDV         = 7
{-# LINE 187 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum HeapByClosureType = 8
{-# LINE 188 "libraries/base/GHC/RTS/Flags.hsc" #-}

    toEnum 0    = NoHeapProfiling
{-# LINE 190 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 1          = HeapByCCS
{-# LINE 191 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 2          = HeapByMod
{-# LINE 192 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 4        = HeapByDescr
{-# LINE 193 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 5         = HeapByType
{-# LINE 194 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 6     = HeapByRetainer
{-# LINE 195 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 7          = HeapByLDV
{-# LINE 196 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 8 = HeapByClosureType
{-# LINE 197 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum e = error ("invalid enum for DoHeapProfile: " ++ show e)

data ProfFlags = ProfFlags
    { doHeapProfile            :: DoHeapProfile
    , heapProfileInterval      :: Time -- ^ time between samples
    , heapProfileIntervalTicks :: Word -- ^ ticks between samples (derived)
    , includeTSOs              :: Bool
    , showCCSOnException       :: Bool
    , maxRetainerSetSize       :: Word
    , ccsLength                :: Word
    , modSelector              :: Maybe String
    , descrSelector            :: Maybe String
    , typeSelector             :: Maybe String
    , ccSelector               :: Maybe String
    , ccsSelector              :: Maybe String
    , retainerSelector         :: Maybe String
    , bioSelector              :: Maybe String
    } deriving (Show)

data DoTrace
    = TraceNone
    | TraceEventLog
    | TraceStderr
    deriving (Show)

instance Enum DoTrace where
    fromEnum TraceNone     = 0
{-# LINE 224 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum TraceEventLog = 1
{-# LINE 225 "libraries/base/GHC/RTS/Flags.hsc" #-}
    fromEnum TraceStderr   = 2
{-# LINE 226 "libraries/base/GHC/RTS/Flags.hsc" #-}

    toEnum 0     = TraceNone
{-# LINE 228 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 1 = TraceEventLog
{-# LINE 229 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum 2   = TraceStderr
{-# LINE 230 "libraries/base/GHC/RTS/Flags.hsc" #-}
    toEnum e = error ("invalid enum for DoTrace: " ++ show e)

data TraceFlags = TraceFlags
    { tracing        :: DoTrace
    , timestamp      :: Bool -- ^ show timestamp in stderr output
    , traceScheduler :: Bool -- ^ trace scheduler events
    , traceGc        :: Bool -- ^ trace GC events
    , sparksSampled  :: Bool -- ^ trace spark events by a sampled method
    , sparksFull     :: Bool -- ^ trace spark events 100% accurately
    , user           :: Bool -- ^ trace user events (emitted from Haskell code)
    } deriving (Show)

data TickyFlags = TickyFlags
    { showTickyStats :: Bool
    , tickyFile      :: Maybe FilePath
    } deriving (Show)

data RTSFlags = RTSFlags
    { gcFlags         :: GCFlags
    , concurrentFlags :: ConcFlags
    , miscFlags       :: MiscFlags
    , debugFlags      :: DebugFlags
    , costCentreFlags :: CCFlags
    , profilingFlags  :: ProfFlags
    , traceFlags      :: TraceFlags
    , tickyFlags      :: TickyFlags
    } deriving (Show)

foreign import ccall safe "getGcFlags"
  getGcFlagsPtr :: IO (Ptr ())

foreign import ccall safe "getConcFlags"
  getConcFlagsPtr :: IO (Ptr ())

foreign import ccall safe "getMiscFlags"
  getMiscFlagsPtr :: IO (Ptr ())

foreign import ccall safe "getDebugFlags"
  getDebugFlagsPtr :: IO (Ptr ())

foreign import ccall safe "getCcFlags"
  getCcFlagsPtr :: IO (Ptr ())

foreign import ccall safe "getProfFlags" getProfFlagsPtr :: IO (Ptr ())

foreign import ccall safe "getTraceFlags"
  getTraceFlagsPtr :: IO (Ptr ())

foreign import ccall safe "getTickyFlags"
  getTickyFlagsPtr :: IO (Ptr ())

getRTSFlags :: IO RTSFlags
getRTSFlags = do
  RTSFlags <$> getGCFlags
           <*> getConcFlags
           <*> getMiscFlags
           <*> getDebugFlags
           <*> getCCFlags
           <*> getProfFlags
           <*> getTraceFlags
           <*> getTickyFlags

peekFilePath :: Ptr () -> IO (Maybe FilePath)
peekFilePath ptr
  | ptr == nullPtr = return Nothing
  | otherwise      = return (Just "<filepath>")

-- | Read a NUL terminated string. Return Nothing in case of a NULL pointer.
peekCStringOpt :: Ptr CChar -> IO (Maybe String)
peekCStringOpt ptr
  | ptr == nullPtr = return Nothing
  | otherwise      = Just <$> peekCString ptr

getGCFlags :: IO GCFlags
getGCFlags = do
  ptr <- getGcFlagsPtr
  GCFlags <$> (peekFilePath =<< (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr)
{-# LINE 307 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (toEnum . fromIntegral <$>
                ((\hsc_ptr -> peekByteOff hsc_ptr 8) ptr :: IO Nat))
{-# LINE 309 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 12) ptr
{-# LINE 310 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr
{-# LINE 311 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 20) ptr
{-# LINE 312 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 24) ptr
{-# LINE 313 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 28) ptr
{-# LINE 314 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 32) ptr
{-# LINE 315 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 40) ptr
{-# LINE 316 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 44) ptr
{-# LINE 317 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 48) ptr
{-# LINE 318 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 56) ptr
{-# LINE 319 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 64) ptr
{-# LINE 320 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 72) ptr
{-# LINE 321 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 76) ptr
{-# LINE 322 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 80) ptr
{-# LINE 323 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 84) ptr
{-# LINE 324 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 88) ptr
{-# LINE 325 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 96) ptr
{-# LINE 326 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 100) ptr
{-# LINE 327 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 104) ptr
{-# LINE 328 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 112) ptr
{-# LINE 329 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 120) ptr
{-# LINE 330 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 128) ptr
{-# LINE 331 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 136) ptr
{-# LINE 332 "libraries/base/GHC/RTS/Flags.hsc" #-}

getConcFlags :: IO ConcFlags
getConcFlags = do
  ptr <- getConcFlagsPtr
  ConcFlags <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 337 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr
{-# LINE 338 "libraries/base/GHC/RTS/Flags.hsc" #-}

getMiscFlags :: IO MiscFlags
getMiscFlags = do
  ptr <- getMiscFlagsPtr
  MiscFlags <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 343 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr
{-# LINE 344 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (\hsc_ptr -> peekByteOff hsc_ptr 12) ptr
{-# LINE 345 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr
{-# LINE 346 "libraries/base/GHC/RTS/Flags.hsc" #-}

getDebugFlags :: IO DebugFlags
getDebugFlags = do
  ptr <- getDebugFlagsPtr
  DebugFlags <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 351 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 4) ptr
{-# LINE 352 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr
{-# LINE 353 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 12) ptr
{-# LINE 354 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr
{-# LINE 355 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 20) ptr
{-# LINE 356 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 24) ptr
{-# LINE 357 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 28) ptr
{-# LINE 358 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 32) ptr
{-# LINE 359 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 36) ptr
{-# LINE 360 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 40) ptr
{-# LINE 361 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 44) ptr
{-# LINE 362 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 48) ptr
{-# LINE 363 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 52) ptr
{-# LINE 364 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 56) ptr
{-# LINE 365 "libraries/base/GHC/RTS/Flags.hsc" #-}

getCCFlags :: IO CCFlags
getCCFlags = do
  ptr <- getCcFlagsPtr
  CCFlags <$> (toEnum . fromIntegral
                <$> ((\hsc_ptr -> peekByteOff hsc_ptr 0) ptr :: IO Nat))
{-# LINE 371 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 4) ptr
{-# LINE 372 "libraries/base/GHC/RTS/Flags.hsc" #-}
          <*> (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr
{-# LINE 373 "libraries/base/GHC/RTS/Flags.hsc" #-}

getProfFlags :: IO ProfFlags
getProfFlags = do
  ptr <- getProfFlagsPtr
  ProfFlags <$> (toEnum <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr)
{-# LINE 378 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr
{-# LINE 379 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr
{-# LINE 380 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (\hsc_ptr -> peekByteOff hsc_ptr 20) ptr
{-# LINE 381 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (\hsc_ptr -> peekByteOff hsc_ptr 24) ptr
{-# LINE 382 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (\hsc_ptr -> peekByteOff hsc_ptr 28) ptr
{-# LINE 383 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (\hsc_ptr -> peekByteOff hsc_ptr 32) ptr
{-# LINE 384 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (peekCStringOpt =<< (\hsc_ptr -> peekByteOff hsc_ptr 40) ptr)
{-# LINE 385 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (peekCStringOpt =<< (\hsc_ptr -> peekByteOff hsc_ptr 48) ptr)
{-# LINE 386 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (peekCStringOpt =<< (\hsc_ptr -> peekByteOff hsc_ptr 56) ptr)
{-# LINE 387 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (peekCStringOpt =<< (\hsc_ptr -> peekByteOff hsc_ptr 64) ptr)
{-# LINE 388 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (peekCStringOpt =<< (\hsc_ptr -> peekByteOff hsc_ptr 72) ptr)
{-# LINE 389 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (peekCStringOpt =<< (\hsc_ptr -> peekByteOff hsc_ptr 80) ptr)
{-# LINE 390 "libraries/base/GHC/RTS/Flags.hsc" #-}
            <*> (peekCStringOpt =<< (\hsc_ptr -> peekByteOff hsc_ptr 88) ptr)
{-# LINE 391 "libraries/base/GHC/RTS/Flags.hsc" #-}

getTraceFlags :: IO TraceFlags
getTraceFlags = do
  ptr <- getTraceFlagsPtr
  TraceFlags <$> (toEnum . fromIntegral
                   <$> ((\hsc_ptr -> peekByteOff hsc_ptr 0) ptr :: IO CInt))
{-# LINE 397 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 4) ptr
{-# LINE 398 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr
{-# LINE 399 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 12) ptr
{-# LINE 400 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr
{-# LINE 401 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 20) ptr
{-# LINE 402 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (\hsc_ptr -> peekByteOff hsc_ptr 24) ptr
{-# LINE 403 "libraries/base/GHC/RTS/Flags.hsc" #-}

getTickyFlags :: IO TickyFlags
getTickyFlags = do
  ptr <- getTickyFlagsPtr
  TickyFlags <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
{-# LINE 408 "libraries/base/GHC/RTS/Flags.hsc" #-}
             <*> (peekFilePath =<< (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr)
{-# LINE 409 "libraries/base/GHC/RTS/Flags.hsc" #-}