Export another utility and type from Macaw.Memory

This type is needed to write some type signatures, and we needed an accessor to
extract segment ranges from a SegmentContents.
This commit is contained in:
Tristan Ravitch 2018-04-23 18:50:39 -07:00
parent b2d955cb3e
commit 8c20e0e156

View File

@ -45,6 +45,8 @@ module Data.Macaw.Memory
, segmentOffset
, segmentFlags
, segmentContents
, SegmentContents
, contentsRanges
, ppMemSegment
, segmentSize
, SegmentRange(..)
@ -443,6 +445,10 @@ contentsSize (SegmentContents m) =
Nothing -> 0
Just ((start, c),_) -> start + rangeSize c
-- | De-construct a 'SegmentContents' into its constituent ranges
contentsRanges :: SegmentContents w -> [(MemWord w, SegmentRange w)]
contentsRanges = Map.toList . segContentsMap
-- | Return list of contents from given word or an error if this we can't cleanly
-- partition a relocation
-- due to a relocation.