private ModuleInfo CreateModuleInfo(ElfLoadedImage image) { using ElfFile? file = image.Open(); int filesize = 0; int timestamp = 0; if (file is null) { using Stream stream = image.AsStream(); PEImage.ReadIndexProperties(stream, out timestamp, out filesize); } // It's true that we are setting "IndexFileSize" to be the raw size on linux for Linux modules, // but this unblocks some SOS scenarios. if (filesize == 0) { filesize = unchecked ((int)image.Size); } // We suppress the warning because the function it wants us to use is not available on all ClrMD platforms #pragma warning disable CA1307 // Specify StringComparison // This substitution is for unloaded modules for which Linux appends " (deleted)" to the module name. string path = image.FileName.Replace(" (deleted)", ""); #pragma warning restore CA1307 // Specify StringComparison // We set buildId to "default" which means we will later lazily evaluate the buildId on demand. return(new ModuleInfo(this, (ulong)image.BaseAddress, path, true, filesize, timestamp, buildId: default)); }
private ModuleInfo CreateModuleInfo(ElfLoadedImage image) { ElfFile?file = image.Open(); int filesize = 0; int timestamp = 0; if (file is null) { using Stream stream = image.CreateStream(); PEImage.ReadIndexProperties(stream, out timestamp, out filesize); } // It's true that we are setting "IndexFileSize" to be the raw size on linux for Linux modules, // but this unblocks some SOS scenarios. if (filesize == 0) { filesize = unchecked ((int)image.Size); } // This substitution is for unloaded modules for which Linux appends " (deleted)" to the module name. string path = image.Path.Replace(" (deleted)", ""); // We set buildId to "default" which means we will later lazily evaluate the buildId on demand. return(new ModuleInfo(this, (ulong)image.BaseAddress, path, true, filesize, timestamp, buildId: default)); }
private ModuleInfo CreateModuleInfo(ElfLoadedImage img) { return(new ModuleInfo { FileName = img.Path, FileSize = (uint)img.Size, ImageBase = (ulong)img.BaseAddress, BuildId = img.Open()?.BuildId }); }
private ModuleInfo CreateModuleInfo(ElfLoadedImage img) { string filename = Path.GetFileName(img.Path); return(new ModuleInfo { FileName = img.Path, FileSize = (uint)img.Size, ImageBase = (ulong)img.BaseAddress, IsRuntime = filename.Equals("libcoreclr.so", StringComparison.OrdinalIgnoreCase) }); }
private ModuleInfo CreateModuleInfo(ElfLoadedImage img) { ElfFile file = img.Open(); return(new ModuleInfo { FileName = img.Path, FileSize = (uint)img.Size, ImageBase = (ulong)img.BaseAddress, BuildId = file?.BuildId, IsManaged = file == null }); }
public void GetVersionInfo(ulong baseAddress, out VersionInfo version) { ElfLoadedImage image = _core.LoadedImages.First(image => (ulong)image.BaseAddress == baseAddress); ElfFile? file = image.Open(); if (file is null) { version = default; } else { LinuxFunctions.GetVersionInfo(this, baseAddress, file, out version); } }
private ModuleInfo CreateModuleInfo(ElfLoadedImage image) { ElfFile?file = image.Open(); uint filesize = (uint)image.Size; uint timestamp = 0; if (file is null) { PEImage pe = image.OpenAsPEImage(); filesize = (uint)pe.IndexFileSize; timestamp = (uint)pe.IndexTimeStamp; } return(new ModuleInfo(this, (ulong)image.BaseAddress, filesize, timestamp, image.Path, file?.BuildId)); }
private static ModuleInfo CreateModuleInfo(ElfLoadedImage image) { ElfFile?file = image.Open(); int filesize = 0; int timestamp = 0; if (file is null) { using PEImage pe = image.OpenAsPEImage(); filesize = pe.IndexFileSize; timestamp = pe.IndexTimeStamp; } // We set buildId to "default" which means we will later lazily evaluate the buildId on demand. return(new ModuleInfo((ulong)image.BaseAddress, image.Path, image._containsExecutable, filesize, timestamp, buildId: default)); }
private ModuleInfo CreateModuleInfo(ElfLoadedImage image) { using ElfFile? file = image.Open(); // We suppress the warning because the function it wants us to use is not available on all ClrMD platforms #pragma warning disable CA1307 // Specify StringComparison // This substitution is for unloaded modules for which Linux appends " (deleted)" to the module name. string path = image.FileName.Replace(" (deleted)", ""); #pragma warning restore CA1307 // Specify StringComparison if (file is not null) { long size = image.Size > long.MaxValue ? long.MaxValue : unchecked ((long)image.Size); return(new ElfModuleInfo(this, file, image.BaseAddress, size, path)); } return(new PEModuleInfo(this, image.BaseAddress, path, false)); }
private ModuleInfo CreateModuleInfo(ElfLoadedImage image) { ElfFile?file = image.Open(); VersionInfo version; int filesize = (int)image.Size; int timestamp = 0; if (file is null) { using PEImage pe = image.OpenAsPEImage(); filesize = pe.IndexFileSize; timestamp = pe.IndexTimeStamp; version = pe.GetFileVersionInfo()?.VersionInfo ?? default; } else { LinuxFunctions.GetVersionInfo(this, (ulong)image.BaseAddress, file, out version); } return(new ModuleInfo((ulong)image.BaseAddress, filesize, timestamp, image.Path, image._containsExecutable, default, version));
private ModuleInfo CreateModuleInfo(ElfLoadedImage image) { ElfFile?file = image.Open(); int filesize = 0; int timestamp = 0; if (file is null) { using Stream stream = image.CreateStream(); PEImage.ReadIndexProperties(stream, out timestamp, out filesize); } else { // It's true that we are setting "IndexFileSize" to be the raw size on linux for Linux modules, // but this unblocks some SOS scenarios. filesize = (int)image.Size; } // We set buildId to "default" which means we will later lazily evaluate the buildId on demand. return(new ModuleInfo(this, (ulong)image.BaseAddress, image.Path, image._containsExecutable, filesize, timestamp, buildId: default)); }
private ModuleInfo CreateModuleInfo(ElfLoadedImage img) { ElfFile file = img.Open(); ModuleInfo result = new ModuleInfo { FileName = img.Path, FileSize = (uint)img.Size, ImageBase = (ulong)img.BaseAddress, BuildId = file?.BuildId, IsManaged = file == null }; if (result.IsManaged) { PEImage pe = img.OpenAsPEImage(); result.FileSize = (uint)pe.IndexFileSize; result.TimeStamp = (uint)pe.IndexTimeStamp; } return(result); }