Skip to content
Snippets Groups Projects

Add search for retainers by info table

Closed Adam Gundry requested to merge wip/13-retainer-search-by-info-table into master
5 files
+ 43
2
Compare changes
  • Side-by-side
  • Inline
Files
5
{-# LANGUAGE ViewPatterns #-}
-- | Functions for computing retainers
module GHC.Debug.Retainers(findRetainersOf, findRetainersOfConstructor, findRetainersOfConstructorExact, findRetainers, addLocationToStack, displayRetainerStack, addLocationToStack', displayRetainerStack') where
module GHC.Debug.Retainers(findRetainersOf, findRetainersOfConstructor, findRetainersOfConstructorExact, findRetainersOfInfoTable, findRetainers, addLocationToStack, displayRetainerStack, addLocationToStack', displayRetainerStack') where
import GHC.Debug.Client
import Control.Monad.State
@@ -45,6 +45,12 @@ findRetainersOfConstructorExact limit rroots clos_name =
return $ (infoName cur_loc) == clos_name
findRetainersOfInfoTable :: Maybe Int -> [ClosurePtr] -> InfoTablePtr -> DebugM [[ClosurePtr]]
findRetainersOfInfoTable limit rroots info_ptr =
findRetainers limit rroots go
where
go _ sc = return $ tableId (info (noSize sc)) == info_ptr
-- | From the given roots, find any path to one of the given pointers.
-- Note: This function can be quite slow! The first argument is a limit to
-- how many paths to find. You should normally set this to a small number
Loading