Пример #1
0
 private static PiecewiseAddressSpaceRange ToRange(MachSegment segment)
 {
     return(new PiecewiseAddressSpaceRange()
     {
         AddressSpace = segment.VirtualContents.DataSource,
         Start = segment.LoadCommand.VMAddress,
         Length = segment.LoadCommand.VMSize
     });
 }
Пример #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());
        }
Пример #3
0
        private static PiecewiseAddressSpaceRange ToRange(IAddressSpace virtualAddressSpace, ulong baseLoadAddress, ulong preferredVMBaseAddress, MachSegment segment)
        {
            ulong actualSegmentLoadAddress = segment.LoadCommand.VMAddress - preferredVMBaseAddress + baseLoadAddress;

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