Ejemplo n.º 1
0
 private static PiecewiseAddressSpaceRange ToRange(MachSegment segment)
 {
     return(new PiecewiseAddressSpaceRange()
     {
         AddressSpace = segment.VirtualContents.DataSource,
         Start = segment.LoadCommand.VMAddress,
         Length = segment.LoadCommand.VMSize
     });
 }
Ejemplo n.º 2
0
        private MachSegment[] ReadSegments()
        {
            List <MachSegment> segs = new List <MachSegment>();

            foreach (Tuple <MachLoadCommand, ulong> cmdAndPos in _loadCommands.Value)
            {
                LoadCommandType segType = Is64Bit ? LoadCommandType.Segment64 : LoadCommandType.Segment;
                if (cmdAndPos.Item1.Command != segType)
                {
                    continue;
                }
                MachSegment seg = new MachSegment(DataSourceReader, cmdAndPos.Item2, _dataSourceIsVirtualAddressSpace);
                segs.Add(seg);
            }

            return(segs.ToArray());
        }
Ejemplo n.º 3
0
        private static PiecewiseAddressSpaceRange ToRange(IAddressSpace virtualAddressSpace, ulong preferredVMBaseAddress, MachSegment segment)
        {
            ulong actualSegmentLoadAddress = preferredVMBaseAddress + segment.LoadCommand.VMAddress - segment.LoadCommand.FileOffset;

            return(new PiecewiseAddressSpaceRange()
            {
                AddressSpace = new RelativeAddressSpace(virtualAddressSpace, actualSegmentLoadAddress, segment.LoadCommand.FileSize),
                Start = segment.LoadCommand.FileOffset,
                Length = segment.LoadCommand.FileSize
            });
        }