public static ImageSegment?LoadSegment(MemorySegment_v1 segment, IPlatform platform, DecompilerEventListener listener) { if (segment.Name is null) { listener.Warn("Memory map segments must have names."); return(null); } if (!platform.TryParseAddress(segment.Address, out var addr)) { listener.Warn( "Unable to parse address '{0}' in memory map segment {1}.", segment.Address !, segment.Name !); return(null); } if (!uint.TryParse(segment.Size, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var size)) { listener.Warn( "Unable to parse hexadecimal size '{0}' in memory map segment {1}.", segment.Size !, segment.Name !); return(null); } var mem = new ByteMemoryArea(addr, new byte[size]); return(new ImageSegment(segment.Name, mem, ConvertAccess(segment.Attributes))); }
public static ImageSegment LoadSegment(MemorySegment_v1 segment, IPlatform platform, IDiagnosticsService diagSvc) { Address addr; if (!platform.TryParseAddress(segment.Address, out addr)) { diagSvc.Warn( string.Format( "Unable to parse address '{0}' in memory map segment {1}.", segment.Address, segment.Name)); return(null); } uint size; if (!uint.TryParse(segment.Size, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out size)) { diagSvc.Warn( string.Format( "Unable to parse hexadecimal size '{0}' in memory map segment {1}.", segment.Size, segment.Name)); return(null); } return(new ImageSegment(segment.Name, addr, size, ConvertAccess(segment.Attributes))); }
public static ImageSegment LoadSegment(MemorySegment_v1 segment, IPlatform platform, IDiagnosticsService diagSvc) { Address addr; if (!platform.TryParseAddress(segment.Address, out addr)) { diagSvc.Warn( "Unable to parse address '{0}' in memory map segment {1}.", segment.Address, segment.Name); return null; } uint size; if (!uint.TryParse(segment.Size, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out size)) { diagSvc.Warn( "Unable to parse hexadecimal size '{0}' in memory map segment {1}.", segment.Size, segment.Name); return null; } return new ImageSegment(segment.Name, addr, size, ConvertAccess(segment.Attributes)); }
public static ImageSegment LoadSegment(MemorySegment_v1 segment, IPlatform platform, IDiagnosticsService diagSvc) { if (!platform.TryParseAddress(segment.Address, out var addr)) { diagSvc.Warn( "Unable to parse address '{0}' in memory map segment {1}.", segment.Address, segment.Name); return(null); } if (!uint.TryParse(segment.Size, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var size)) { diagSvc.Warn( "Unable to parse hexadecimal size '{0}' in memory map segment {1}.", segment.Size, segment.Name); return(null); } var mem = new MemoryArea(addr, new byte[size]); return(new ImageSegment(segment.Name, mem, ConvertAccess(segment.Attributes))); }