diff --git a/eng/CodeAnalysis.ruleset b/eng/CodeAnalysis.ruleset index 6e46bfdde8..ebfe969709 100644 --- a/eng/CodeAnalysis.ruleset +++ b/eng/CodeAnalysis.ruleset @@ -1,10 +1,10 @@ - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a687815b7e..2c1cfdf04c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,9 +4,9 @@ https://github.com/dotnet/symstore 1ff51a5afa61af820a14b3aa84b401d1a79bc783 - + https://github.com/microsoft/clrmd - a64d9ac11086f28fbd4b2b2337c19be7826fbfa9 + be891ed2cc2c8b98d9e0b531b513b75a4d4bfd88 https://github.com/microsoft/clrmd diff --git a/eng/Versions.props b/eng/Versions.props index 84b284e618..6d80f298aa 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -44,8 +44,7 @@ 4.3.0 1.1.0 - 2.0.325901 - 2.0.325901 + 2.1.330601 16.9.0-beta1.21055.5 2.0.64 2.1.1 diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/DataReader.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/DataReader.cs new file mode 100644 index 0000000000..6475838aa6 --- /dev/null +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/DataReader.cs @@ -0,0 +1,206 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Diagnostics.Runtime; +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Diagnostics.DebugServices.Implementation +{ + /// + /// ClrMD runtime service implementation + /// + internal class DataReader : IDataReader + { + private readonly ITarget _target; + private IEnumerable _modules; + private IModuleService _moduleService; + private IThreadService _threadService; + private IMemoryService _memoryService; + + public DataReader(ITarget target) + { + _target = target; + target.OnFlushEvent.Register(() => _modules = null); + } + + #region IDataReader + + string IDataReader.DisplayName => ""; + + bool IDataReader.IsThreadSafe => false; + + OSPlatform IDataReader.TargetPlatform => _target.OperatingSystem; + + Architecture IDataReader.Architecture => _target.Architecture; + + int IDataReader.ProcessId => unchecked((int)_target.ProcessId.GetValueOrDefault()); + + IEnumerable IDataReader.EnumerateModules() => _modules ??= ModuleService.EnumerateModules().Select((module) => new DataReaderModule(module)).ToList(); + + bool IDataReader.GetThreadContext(uint threadId, uint contextFlags, Span context) + { + try + { + byte[] registerContext = ThreadService.GetThreadFromId(threadId).GetThreadContext(); + context = new Span(registerContext); + return true; + } + catch (DiagnosticsException ex) + { + Trace.TraceError($"GetThreadContext: {threadId} exception {ex.Message}"); + } + return false; + } + + void IDataReader.FlushCachedData() + { + } + + #endregion + + #region IMemoryReader + + int IMemoryReader.PointerSize => MemoryService.PointerSize; + + int IMemoryReader.Read(ulong address, Span buffer) + { + MemoryService.ReadMemory(address, buffer, out int bytesRead); + return bytesRead; + } + + bool IMemoryReader.Read(ulong address, out T value) + { + Span buffer = stackalloc byte[Marshal.SizeOf()]; + if (((IMemoryReader)this).Read(address, buffer) == buffer.Length) + { + value = Unsafe.As(ref MemoryMarshal.GetReference(buffer)); + return true; + } + value = default; + return false; + } + + T IMemoryReader.Read(ulong address) + { + ((IMemoryReader)this).Read(address, out T result); + return result; + } + + bool IMemoryReader.ReadPointer(ulong address, out ulong value) + { + return MemoryService.ReadPointer(address, out value); + } + + ulong IMemoryReader.ReadPointer(ulong address) + { + MemoryService.ReadPointer(address, out ulong value); + return value; + } + + #endregion + + private IModuleService ModuleService => _moduleService ??= _target.Services.GetService(); + + private IMemoryService MemoryService => _memoryService ??= _target.Services.GetService(); + + private IThreadService ThreadService => _threadService ??= _target.Services.GetService(); + + private class DataReaderModule : ModuleInfo + { + private readonly IModule _module; + + public DataReaderModule(IModule module) + : base(module.ImageBase, module.FileName) + { + _module = module; + } + + public override long ImageSize => unchecked((long)_module.ImageSize); + + public override int IndexFileSize => unchecked((int)_module.IndexFileSize.GetValueOrDefault(0)); + + public override int IndexTimeStamp => unchecked((int)_module.IndexTimeStamp.GetValueOrDefault(0)); + + public override Version Version + { + get + { + try + { + return _module.GetVersionData() ?? Utilities.EmptyVersion; + } + catch (DiagnosticsException ex) + { + Trace.TraceError($"ModuleInfo.Version: {_module.ImageBase:X16} exception {ex.Message}"); + } + return Utilities.EmptyVersion; + } + } + + public override ImmutableArray BuildId + { + get + { + try + { + return _module.BuildId; + } + catch (DiagnosticsException ex) + { + Trace.TraceError($"ModuleInfo.BuildId: {_module.ImageBase:X16} exception {ex.Message}"); + } + return ImmutableArray.Empty; + } + } + + public override PdbInfo Pdb + { + get + { + try + { + PdbFileInfo pdbFileInfo = _module.GetPdbFileInfos().Where((pdbFileInfo) => pdbFileInfo.IsPortable).LastOrDefault(); + if (pdbFileInfo is null) + { + pdbFileInfo = _module.GetPdbFileInfos().LastOrDefault(); + if (pdbFileInfo is null) + { + return default; + } + } + return new PdbInfo(pdbFileInfo.Path, pdbFileInfo.Guid, pdbFileInfo.Revision); + } + catch (DiagnosticsException ex) + { + Trace.TraceError($"ModuleInfo.Pdb: {_module.ImageBase:X16} exception {ex.Message}"); + } + return default; + } + } + + public override bool IsManaged => _module.IsManaged; + + public override ulong GetExportSymbolAddress(string symbol) + { + var exportSymbols = _module.Services.GetService(); + if (exportSymbols is not null) + { + if (exportSymbols.TryGetSymbolAddress(symbol, out ulong offset)) + { + return offset; + } + } + return 0; + } + + public override IResourceNode ResourceRoot => base.ResourceRoot; + } + } +} diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/ImageMappingMemoryService.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/ImageMappingMemoryService.cs index c27f5d4df1..bc994a00ce 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/ImageMappingMemoryService.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/ImageMappingMemoryService.cs @@ -2,15 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Diagnostics.Runtime.Utilities; using Microsoft.FileFormats; -using Microsoft.FileFormats.ELF; -using Microsoft.FileFormats.MachO; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; using System.Reflection.Metadata; using System.Reflection.PortableExecutable; diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/MetadataMappingMemoryService.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/MetadataMappingMemoryService.cs index e2811bd58c..19b382ee80 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/MetadataMappingMemoryService.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/MetadataMappingMemoryService.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using Microsoft.Diagnostics.Runtime; -using Microsoft.Diagnostics.Runtime.Utilities; using Microsoft.FileFormats; using Microsoft.FileFormats.PE; using System; diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/Module.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/Module.cs index dde7210a41..20ba0b92b7 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/Module.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/Module.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Diagnostics.Runtime.Utilities; +using Microsoft.Diagnostics.Runtime; using Microsoft.FileFormats; using Microsoft.FileFormats.ELF; using Microsoft.FileFormats.MachO; @@ -197,7 +197,7 @@ public string GetSymbolFileName() { if (InitializeValue(Flags.InitializeSymbolFileName)) { - if (Target.OperatingSystem == OSPlatform.Linux) + if (ImageSize > 0 && Target.OperatingSystem == OSPlatform.Linux) { try { @@ -216,8 +216,8 @@ public string GetSymbolFileName() (ex is InvalidVirtualAddressException || ex is ArgumentOutOfRangeException || ex is IndexOutOfRangeException || + ex is OverflowException || ex is BadInputFormatException) - { Trace.TraceWarning("ELF .gnu_debuglink section in {0}: {1}", this, ex.Message); } @@ -226,7 +226,7 @@ ex is IndexOutOfRangeException || return _symbolFileName; } - public abstract VersionData GetVersionData(); + public abstract Version GetVersionData(); public abstract string GetVersionString(); @@ -254,24 +254,15 @@ bool IExportSymbols.TryGetSymbolAddress(string name, out ulong address) } else if (Target.OperatingSystem == OSPlatform.Linux) { - try + if (ImageSize > 0) { - Stream stream = ModuleService.MemoryService.CreateMemoryStream(ImageBase, ImageSize); - ElfFile elfFile = new(stream, position: ImageBase, leaveOpen: false, isVirtual: true); - if (elfFile.Header.IsValid) + ModuleInfo module = ModuleInfo.TryCreate(Target.Services.GetService(), ImageBase, FileName); + if (module is not null) { - if (elfFile.TryGetExportSymbol(name, out ulong offset)) - { - address = ImageBase + offset; - return true; - } - address = 0; - return false; + address = module.GetExportSymbolAddress(name); + return address != 0; } } - catch (InvalidDataException) - { - } } return TryGetSymbolAddressInner(name, out address); } @@ -284,9 +275,9 @@ protected virtual bool TryGetSymbolAddressInner(string name, out ulong address) #endregion - protected VersionData GetVersion() + protected Version GetVersionInner() { - VersionData versionData = null; + Version version = null; PEFile peFile = GetPEInfo(); if (peFile != null) @@ -296,7 +287,7 @@ protected VersionData GetVersion() VsFixedFileInfo fileInfo = peFile.VersionInfo; if (fileInfo != null) { - versionData = fileInfo.ToVersionData(); + version = fileInfo.ToVersion(); } } catch (Exception ex) when (ex is InvalidVirtualAddressException || ex is BadInputFormatException) @@ -325,8 +316,7 @@ protected VersionData GetVersion() string versionToParse = versionString.Substring(0, spaceIndex); try { - Version version = System.Version.Parse(versionToParse); - versionData = new VersionData(version.Major, version.Minor, version.Build, version.Revision); + version = Version.Parse(versionToParse); } catch (ArgumentException ex) { @@ -336,7 +326,7 @@ protected VersionData GetVersion() } } - return versionData; + return version; } protected PEFile GetPEInfo() diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleService.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleService.cs index d58bf78cc5..b69ac6312b 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleService.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleService.cs @@ -212,7 +212,7 @@ internal PEFile GetPEInfo(ulong address, ulong size, out IEnumerable 0 && Target.Host.HostType != HostType.Lldb) { // First try getting the PE info as loaded layout (native Windows DLLs and most managed PEs). peFile = GetPEInfo(isVirtual: true, address, size, out List pdbs, out Module.Flags flags); @@ -367,7 +367,7 @@ protected string GetVersionString(IModule module) } else { - Trace.TraceError($"GetVersionString: unsupported module {module} or platform {Target.OperatingSystem}"); + Trace.TraceError($"GetVersionString: unsupported module {module} on platform {Target.OperatingSystem}"); } } } diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleServiceFromDataReader.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleServiceFromDataReader.cs index 4624b94a22..60f6dc7138 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleServiceFromDataReader.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleServiceFromDataReader.cs @@ -22,21 +22,18 @@ class ModuleFromDataReader : Module // This is what clrmd returns for non-PE modules that don't have a timestamp private const uint InvalidTimeStamp = 0; - private static readonly VersionInfo EmptyVersionInfo = new (0, 0, 0, 0); private readonly ModuleServiceFromDataReader _moduleService; - private readonly IExportReader _exportReader; private readonly ModuleInfo _moduleInfo; private readonly ulong _imageSize; - private VersionData _versionData; + private Version _version; private string _versionString; - public ModuleFromDataReader(ModuleServiceFromDataReader moduleService, IExportReader exportReader, int moduleIndex, ModuleInfo moduleInfo, ulong imageSize) + public ModuleFromDataReader(ModuleServiceFromDataReader moduleService, int moduleIndex, ModuleInfo moduleInfo, ulong imageSize) : base(moduleService.Target) { _moduleService = moduleService; _moduleInfo = moduleInfo; _imageSize = imageSize; - _exportReader = exportReader; ModuleIndex = moduleIndex; } @@ -60,7 +57,7 @@ public override ImmutableArray BuildId { if (_buildId.IsDefault) { - ImmutableArray buildId = _moduleService._dataReader.GetBuildId(ImageBase); + ImmutableArray buildId = _moduleInfo.BuildId; // If the data reader can't get the build id, it returns a empty (instead of default) immutable array. _buildId = buildId.IsDefaultOrEmpty ? base.BuildId : buildId; } @@ -68,23 +65,23 @@ public override ImmutableArray BuildId } } - public override VersionData GetVersionData() + public override Version GetVersionData() { if (InitializeValue(Module.Flags.InitializeVersion)) { - if (_moduleInfo.Version != EmptyVersionInfo) + if (!_moduleInfo.Version.Equals(Utilities.EmptyVersion)) { - _versionData = _moduleInfo.Version.ToVersionData(); + _version = _moduleInfo.Version; } else { if (_moduleService.Target.OperatingSystem != OSPlatform.Windows) { - _versionData = GetVersion(); + _version = GetVersionInner(); } } } - return _versionData; + return _version; } public override string GetVersionString() @@ -108,12 +105,8 @@ public override string LoadSymbols() protected override bool TryGetSymbolAddressInner(string name, out ulong address) { - if (_exportReader is not null) - { - return _exportReader.TryGetSymbolAddress(ImageBase, name, out address); - } - address = 0; - return false; + address = _moduleInfo.GetExportSymbolAddress(name); + return address != 0; } protected override ModuleService ModuleService => _moduleService; @@ -135,35 +128,44 @@ protected override Dictionary GetModulesInner() var modules = new Dictionary(); int moduleIndex = 0; - IExportReader exportReader = _dataReader as IExportReader; ModuleInfo[] moduleInfos = _dataReader.EnumerateModules().OrderBy((info) => info.ImageBase).ToArray(); for (int i = 0; i < moduleInfos.Length; i++) { ModuleInfo moduleInfo = moduleInfos[i]; - ulong imageSize = (uint)moduleInfo.IndexFileSize; - if ((i + 1) < moduleInfos.Length) + ulong imageSize = (ulong)moduleInfo.ImageSize; + + // Only add images that have a size. On Linux these are special files like /run/shm/lttng-ust-wait-8-1000 and non-ELF + // resource(?) files like /usr/share/zoneinfo-icu/44/le/metaZones.res. Haven't see any 0 sized PE or MachO files. + if (imageSize > 0) { - ModuleInfo moduleInfoNext = moduleInfos[i + 1]; - ulong start = moduleInfo.ImageBase; - ulong end = moduleInfo.ImageBase + imageSize; - ulong startNext = moduleInfoNext.ImageBase; + // There are times when the module infos returned by the data reader overlap which breaks the module + // service's address binary search. This code adjusts the module's image size to the next module's + // image base address if there is overlap. + if ((i + 1) < moduleInfos.Length) + { + ModuleInfo moduleInfoNext = moduleInfos[i + 1]; + ulong start = moduleInfo.ImageBase; + ulong end = moduleInfo.ImageBase + imageSize; + ulong startNext = moduleInfoNext.ImageBase; - if (end > startNext) + if (end > startNext) + { + Trace.TraceWarning($"Module {moduleInfo.FileName} {start:X16} - {end:X16} ({imageSize:X8})"); + Trace.TraceWarning($" overlaps with {moduleInfoNext.FileName} {startNext:X16}"); + imageSize = startNext - start; + } + } + var module = new ModuleFromDataReader(this, moduleIndex, moduleInfo, imageSize); + try { - Trace.TraceWarning($"Module {moduleInfo.FileName} {start:X16} - {end:X16} ({imageSize:X8})"); - Trace.TraceWarning($" overlaps with {moduleInfoNext.FileName} {startNext:X16}"); - imageSize = startNext - start; + modules.Add(moduleInfo.ImageBase, module); + } + catch (ArgumentException) + { + Trace.TraceError($"GetModules(): duplicate module base '{module}' dup '{modules[moduleInfo.ImageBase]}'"); } } - var module = new ModuleFromDataReader(this, exportReader, moduleIndex, moduleInfo, imageSize); - try - { - modules.Add(moduleInfo.ImageBase, module); - } - catch (ArgumentException) - { - Trace.TraceError($"GetModules(): duplicate module base '{module}' dup '{modules[moduleInfo.ImageBase]}'"); - } + moduleIndex++; } return modules; diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/Runtime.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/Runtime.cs index 6eb88cb6a9..eb0d608f85 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/Runtime.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/Runtime.cs @@ -70,12 +70,7 @@ public string GetDacFilePath() { if (_dacFilePath is null) { - string dacFileName = GetDacFileName(); - _dacFilePath = GetLocalDacPath(dacFileName); - if (_dacFilePath is null) - { - _dacFilePath = DownloadFile(dacFileName); - } + _dacFilePath = GetLibraryPath(DebugLibraryKind.Dac); } return _dacFilePath; } @@ -84,12 +79,7 @@ public string GetDbiFilePath() { if (_dbiFilePath is null) { - string dbiFileName = GetDbiFileName(); - _dbiFilePath = GetLocalPath(dbiFileName); - if (_dbiFilePath is null) - { - _dbiFilePath = DownloadFile(dbiFileName); - } + _dbiFilePath = GetLibraryPath(DebugLibraryKind.Dbi); } return _dbiFilePath; } @@ -131,62 +121,45 @@ ex is InvalidDataException || return _clrRuntime; } - private string GetDacFileName() + private string GetLibraryPath(DebugLibraryKind kind) { - if (_clrInfo.SingleFileRuntimeInfo.HasValue) - { - return ClrInfoProvider.GetDacFileName(_clrInfo.Flavor, Target.OperatingSystem); - } - Debug.Assert(!string.IsNullOrEmpty(_clrInfo.DacInfo.PlatformSpecificFileName)); - return _clrInfo.DacInfo.PlatformSpecificFileName; - } + Architecture currentArch = RuntimeInformation.ProcessArchitecture; + string libraryPath = null; - private string GetLocalDacPath(string dacFileName) - { - string dacFilePath; - if (!string.IsNullOrEmpty(RuntimeModuleDirectory)) - { - dacFilePath = Path.Combine(RuntimeModuleDirectory, dacFileName); - } - else + foreach (DebugLibraryInfo libraryInfo in _clrInfo.DebuggingLibraries) { - dacFilePath = _clrInfo.DacInfo.LocalDacPath; - - // On MacOS CLRMD doesn't return the full DAC path just the file name so check if it exists - if (string.IsNullOrEmpty(dacFilePath) || !File.Exists(dacFilePath)) + if (libraryInfo.Kind == kind && RuntimeInformation.IsOSPlatform(libraryInfo.Platform) && libraryInfo.TargetArchitecture == currentArch) { - dacFilePath = Path.Combine(Path.GetDirectoryName(RuntimeModule.FileName), dacFileName); + libraryPath = GetLocalPath(libraryInfo.FileName); + if (libraryPath is not null) + { + break; + } + libraryPath = DownloadFile(libraryInfo); + if (libraryPath is not null) + { + break; + } } } - if (!File.Exists(dacFilePath)) - { - dacFilePath = null; - } - return dacFilePath; - } - - private string GetDbiFileName() - { - string name = Target.GetPlatformModuleName("mscordbi"); - // If this is the Linux runtime module name, but we are running on Windows return the cross-OS DBI name. - if (Target.OperatingSystem == OSPlatform.Linux && RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - name = "mscordbi.dll"; - } - return name; + return libraryPath; } private string GetLocalPath(string fileName) { + if (File.Exists(fileName)) + { + return fileName; + } string localFilePath; if (!string.IsNullOrEmpty(RuntimeModuleDirectory)) { - localFilePath = Path.Combine(RuntimeModuleDirectory, fileName); + localFilePath = Path.Combine(RuntimeModuleDirectory, Path.GetFileName(fileName)); } else { - localFilePath = Path.Combine(Path.GetDirectoryName(RuntimeModule.FileName), fileName); + localFilePath = Path.Combine(Path.GetDirectoryName(RuntimeModule.FileName), Path.GetFileName(fileName)); } if (!File.Exists(localFilePath)) { @@ -195,7 +168,7 @@ private string GetLocalPath(string fileName) return localFilePath; } - private string DownloadFile(string fileName) + private string DownloadFile(DebugLibraryInfo libraryInfo) { OSPlatform platform = Target.OperatingSystem; string filePath = null; @@ -207,41 +180,54 @@ private string DownloadFile(string fileName) if (platform == OSPlatform.Windows) { // It is the coreclr.dll's id (timestamp/filesize) in the DacInfo used to download the the dac module. - if (_clrInfo.DacInfo.IndexTimeStamp != 0 && _clrInfo.DacInfo.IndexFileSize != 0) + if (libraryInfo.IndexTimeStamp != 0 && libraryInfo.IndexFileSize != 0) { - key = PEFileKeyGenerator.GetKey(fileName, (uint)_clrInfo.DacInfo.IndexTimeStamp, (uint)_clrInfo.DacInfo.IndexFileSize); + key = PEFileKeyGenerator.GetKey(libraryInfo.FileName, (uint)libraryInfo.IndexTimeStamp, (uint)libraryInfo.IndexFileSize); } else { - Trace.TraceError($"DownloadFile: {fileName}: key not generated - no index timestamp/filesize"); + Trace.TraceError($"DownloadFile: {libraryInfo}: key not generated - no index timestamp/filesize"); } } else { // Use the runtime's build id to download the the dac module. - if (!_clrInfo.DacInfo.ClrBuildId.IsDefaultOrEmpty) + if (!libraryInfo.IndexBuildId.IsDefaultOrEmpty) { - byte[] buildId = _clrInfo.DacInfo.ClrBuildId.ToArray(); + byte[] buildId = libraryInfo.IndexBuildId.ToArray(); IEnumerable keys = null; + KeyTypeFlags flags = KeyTypeFlags.None; + string fileName = null; + + switch (libraryInfo.ArchivedUnder) + { + case SymbolProperties.Self: + flags = KeyTypeFlags.IdentityKey; + fileName = libraryInfo.FileName; + break; + case SymbolProperties.Coreclr: + flags = KeyTypeFlags.DacDbiKeys; + break; + } if (platform == OSPlatform.Linux) { - keys = ELFFileKeyGenerator.GetKeys(KeyTypeFlags.DacDbiKeys, "libcoreclr.so", buildId, symbolFile: false, symbolFileName: null); + keys = ELFFileKeyGenerator.GetKeys(flags, fileName ?? "libcoreclr.so", buildId, symbolFile: false, symbolFileName: null); } else if (platform == OSPlatform.OSX) { - keys = MachOFileKeyGenerator.GetKeys(KeyTypeFlags.DacDbiKeys, "libcoreclr.dylib", buildId, symbolFile: false, symbolFileName: null); + keys = MachOFileKeyGenerator.GetKeys(flags, fileName ?? "libcoreclr.dylib", buildId, symbolFile: false, symbolFileName: null); } else { - Trace.TraceError($"DownloadFile: {fileName}: platform not supported - {platform}"); + Trace.TraceError($"DownloadFile: {libraryInfo}: platform not supported - {platform}"); } - key = keys?.SingleOrDefault((k) => Path.GetFileName(k.FullPathName) == fileName); + key = keys?.SingleOrDefault((k) => Path.GetFileName(k.FullPathName) == Path.GetFileName(libraryInfo.FileName)); } else { - Trace.TraceError($"DownloadFile: {fileName}: key not generated - no index time stamp or file size"); + Trace.TraceError($"DownloadFile: {libraryInfo}: key not generated - no index time stamp or file size"); } } @@ -253,7 +239,7 @@ private string DownloadFile(string fileName) } else { - Trace.TraceInformation($"DownLoadFile: {fileName}: symbol store not enabled"); + Trace.TraceInformation($"DownLoadFile: {libraryInfo}: symbol store not enabled"); } return filePath; } @@ -282,8 +268,9 @@ public override string ToString() { var sb = new StringBuilder(); string config = s_runtimeTypeNames[(int)RuntimeType]; - sb.AppendLine($"#{Id} {config} runtime at {RuntimeModule.ImageBase:X16} size {RuntimeModule.ImageSize:X8}"); - if (_clrInfo.SingleFileRuntimeInfo.HasValue) { + string index = _clrInfo.BuildId.IsDefaultOrEmpty ? $"{_clrInfo.IndexTimeStamp:X8} {_clrInfo.IndexFileSize:X8}" : _clrInfo.BuildId.ToHex(); + sb.AppendLine($"#{Id} {config} runtime at {RuntimeModule.ImageBase:X16} size {RuntimeModule.ImageSize:X8} index {index}"); + if (_clrInfo.IsSingleFile) { sb.AppendLine($" Single-file runtime module path: {RuntimeModule.FileName}"); } else { diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/RuntimeService.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/RuntimeService.cs index 8892e8bb3c..74e93da88d 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/RuntimeService.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/RuntimeService.cs @@ -5,29 +5,20 @@ using Microsoft.Diagnostics.Runtime; using System; using System.Collections.Generic; -using System.Collections.Immutable; -using System.Diagnostics; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using System.Text; -using Architecture = System.Runtime.InteropServices.Architecture; namespace Microsoft.Diagnostics.DebugServices.Implementation { /// /// ClrMD runtime service implementation /// - public class RuntimeService : IRuntimeService, IDataReader, IExportReader + public class RuntimeService : IRuntimeService { private readonly ITarget _target; private readonly IDisposable _onFlushEvent; private DataTarget _dataTarget; private List _runtimes; private IContextService _contextService; - private IModuleService _moduleService; - private IThreadService _threadService; - private IMemoryService _memoryService; public RuntimeService(ITarget target) { @@ -63,8 +54,8 @@ public IEnumerable EnumerateRuntimes() _runtimes = new List(); if (_dataTarget is null) { - _dataTarget = new DataTarget(new CustomDataTarget(this)) { - BinaryLocator = null + _dataTarget = new DataTarget(new CustomDataTarget(_target.Services.GetService())) { + FileLocator = null }; } if (_dataTarget is not null) @@ -80,169 +71,10 @@ public IEnumerable EnumerateRuntimes() #endregion - #region IDataReader - - string IDataReader.DisplayName => ""; - - bool IDataReader.IsThreadSafe => false; - - OSPlatform IDataReader.TargetPlatform => _target.OperatingSystem; - - Microsoft.Diagnostics.Runtime.Architecture IDataReader.Architecture - { - get - { - return _target.Architecture switch - { - Architecture.X64 => Microsoft.Diagnostics.Runtime.Architecture.Amd64, - Architecture.X86 => Microsoft.Diagnostics.Runtime.Architecture.X86, - Architecture.Arm => Microsoft.Diagnostics.Runtime.Architecture.Arm, - Architecture.Arm64 => Microsoft.Diagnostics.Runtime.Architecture.Arm64, - _ => throw new PlatformNotSupportedException($"{_target.Architecture}"), - }; - } - } - - int IDataReader.ProcessId => unchecked((int)_target.ProcessId.GetValueOrDefault()); - - IEnumerable IDataReader.EnumerateModules() => - ModuleService.EnumerateModules().Select((module) => CreateModuleInfo(module)).ToList(); - - private ModuleInfo CreateModuleInfo(IModule module) => - new ModuleInfo( - this, - module.ImageBase, - module.FileName, - isVirtual: true, - unchecked((int)module.IndexFileSize.GetValueOrDefault(0)), - unchecked((int)module.IndexTimeStamp.GetValueOrDefault(0)), - new ImmutableArray()); - - ImmutableArray IDataReader.GetBuildId(ulong baseAddress) - { - try - { - return ModuleService.GetModuleFromBaseAddress(baseAddress).BuildId; - } - catch (DiagnosticsException ex) - { - Trace.TraceError($"GetBuildId: {baseAddress:X16} exception {ex.Message}"); - } - return ImmutableArray.Empty; - } - - bool IDataReader.GetVersionInfo(ulong baseAddress, out Microsoft.Diagnostics.Runtime.VersionInfo version) - { - try - { - VersionData versionData = ModuleService.GetModuleFromBaseAddress(baseAddress).GetVersionData(); - if (versionData is not null) - { - version = versionData.ToVersionInfo(); - return true; - } - } - catch (DiagnosticsException ex) - { - Trace.TraceError($"GetVersionInfo: {baseAddress:X16} exception {ex.Message}"); - } - version = default; - return false; - } - - bool IDataReader.GetThreadContext(uint threadId, uint contextFlags, Span context) - { - try - { - byte[] registerContext = ThreadService.GetThreadFromId(threadId).GetThreadContext(); - context = new Span(registerContext); - return true; - } - catch (DiagnosticsException ex) - { - Trace.TraceError($"GetThreadContext: {threadId} exception {ex.Message}"); - } - return false; - } - - void IDataReader.FlushCachedData() - { - } - - #endregion - - #region IMemoryReader - - int IMemoryReader.PointerSize => MemoryService.PointerSize; - - int IMemoryReader.Read(ulong address, Span buffer) - { - MemoryService.ReadMemory(address, buffer, out int bytesRead); - return bytesRead; - } - - bool IMemoryReader.Read(ulong address, out T value) - { - Span buffer = stackalloc byte[Marshal.SizeOf()]; - if (((IMemoryReader)this).Read(address, buffer) == buffer.Length) - { - value = Unsafe.As(ref MemoryMarshal.GetReference(buffer)); - return true; - } - value = default; - return false; - } - - T IMemoryReader.Read(ulong address) - { - ((IMemoryReader)this).Read(address, out T result); - return result; - } - - bool IMemoryReader.ReadPointer(ulong address, out ulong value) - { - return MemoryService.ReadPointer(address, out value); - } - - ulong IMemoryReader.ReadPointer(ulong address) - { - MemoryService.ReadPointer(address, out ulong value); - return value; - } - - #endregion - - #region IExportReader - - bool IExportReader.TryGetSymbolAddress(ulong baseAddress, string name, out ulong offset) - { - try - { - IExportSymbols exportSymbols = ModuleService.GetModuleFromBaseAddress(baseAddress).Services.GetService(); - if (exportSymbols is not null) - { - return exportSymbols.TryGetSymbolAddress(name, out offset); - } - } - catch (DiagnosticsException) - { - } - offset = 0; - return false; - } - - #endregion - private IRuntime CurrentRuntime => ContextService.Services.GetService(); private IContextService ContextService => _contextService ??= _target.Services.GetService(); - private IModuleService ModuleService => _moduleService ??= _target.Services.GetService(); - - private IMemoryService MemoryService => _memoryService ??= _target.Services.GetService(); - - private IThreadService ThreadService => _threadService ??= _target.Services.GetService(); - public override string ToString() { var sb = new StringBuilder(); diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs index b7fba25079..ca57687a7d 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs @@ -701,7 +701,8 @@ private string DownloadELF(IModule module, KeyTypeFlags flags) return null; } - SymbolStoreKey fileKey = ELFFileKeyGenerator.GetKeys(flags, module.FileName, module.BuildId.ToArray(), symbolFile: false, module.GetSymbolFileName()).SingleOrDefault(); + string symbolFileName = (flags & KeyTypeFlags.SymbolKey) != 0 ? module.GetSymbolFileName() : null; + SymbolStoreKey fileKey = ELFFileKeyGenerator.GetKeys(flags, module.FileName, module.BuildId.ToArray(), symbolFile: false, symbolFileName).SingleOrDefault(); if (fileKey is null) { Trace.TraceWarning($"DownloadELF: no index generated for module {module.FileName} "); diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/Target.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/Target.cs index 61337d2aed..e4d66bcd1b 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/Target.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/Target.cs @@ -37,6 +37,7 @@ public Target(IHost host, int id, string dumpPath) // Add the per-target services ServiceProvider.AddService(this); + ServiceProvider.AddServiceFactory(() => new DataReader(this)); ServiceProvider.AddServiceFactory(() => new RuntimeService(this)); } diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/TargetFromDataReader.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/TargetFromDataReader.cs index 55dbe636de..ee499a3022 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/TargetFromDataReader.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/TargetFromDataReader.cs @@ -31,21 +31,14 @@ public TargetFromDataReader(IDataReader dataReader, OSPlatform targetOS, IHost h OperatingSystem = targetOS; IsDump = true; - OnFlushEvent.Register(dataReader.FlushCachedData); - - Architecture = dataReader.Architecture switch - { - Microsoft.Diagnostics.Runtime.Architecture.Amd64 => Architecture.X64, - Microsoft.Diagnostics.Runtime.Architecture.X86 => Architecture.X86, - Microsoft.Diagnostics.Runtime.Architecture.Arm => Architecture.Arm, - Microsoft.Diagnostics.Runtime.Architecture.Arm64 => Architecture.Arm64, - _ => throw new PlatformNotSupportedException($"{dataReader.Architecture}"), - }; + Architecture = dataReader.Architecture; if (dataReader.ProcessId != -1) { ProcessId = (uint)dataReader.ProcessId; } + OnFlushEvent.Register(dataReader.FlushCachedData); + // Add the thread, memory, and module services IMemoryService rawMemoryService = new MemoryServiceFromDataReader(_dataReader); ServiceProvider.AddServiceFactory(() => new ThreadServiceFromDataReader(this, _dataReader)); diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/Utilities.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/Utilities.cs index 2646ea90cf..d1d71c81e1 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/Utilities.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/Utilities.cs @@ -4,14 +4,26 @@ using Microsoft.FileFormats.PE; using System; +using System.Collections.Immutable; using System.Diagnostics; using System.IO; +using System.Linq; using System.Reflection.PortableExecutable; namespace Microsoft.Diagnostics.DebugServices.Implementation { public static class Utilities - { + { + /// + /// An empty Version instance. + /// + public static readonly Version EmptyVersion = new(); + + /// + /// Format a immutable array of bytes into hex (i.e build id). + /// + public static string ToHex(this ImmutableArray array) => string.Concat(array.Select((b) => b.ToString("x2"))); + /// /// Combines two hash codes into a single hash code, in an order-dependent manner. /// @@ -33,25 +45,9 @@ public static int CombineHashCodes(int hashCode0, int hashCode1) /// /// Convert from symstore VsFixedFileInfo to DebugServices VersionData /// - public static VersionData ToVersionData(this VsFixedFileInfo fileInfo) + public static Version ToVersion(this VsFixedFileInfo fileInfo) { - return new VersionData(fileInfo.FileVersionMajor, fileInfo.FileVersionMinor, fileInfo.FileVersionRevision, fileInfo.FileVersionBuild); - } - - /// - /// Convert from clrmd VersionInfo to DebugServices VersionData - /// - public static VersionData ToVersionData(this Microsoft.Diagnostics.Runtime.VersionInfo versionInfo) - { - return new VersionData(versionInfo.Major, versionInfo.Minor, versionInfo.Revision, versionInfo.Patch); - } - - /// - /// Convert from DebugServices VersionData to clrmd VersionInfo - /// - public static Microsoft.Diagnostics.Runtime.VersionInfo ToVersionInfo(this VersionData versionData) - { - return new Microsoft.Diagnostics.Runtime.VersionInfo(versionData.Major, versionData.Minor, versionData.Revision, versionData.Patch); + return new Version(fileInfo.FileVersionMajor, fileInfo.FileVersionMinor, fileInfo.FileVersionBuild, fileInfo.FileVersionRevision); } /// @@ -108,6 +104,7 @@ public static Stream TryOpenFile(string path) Trace.TraceError($"TryOpenFile: {ex.Message}"); } } + return null; } } diff --git a/src/Microsoft.Diagnostics.DebugServices/IModule.cs b/src/Microsoft.Diagnostics.DebugServices/IModule.cs index b40badf316..6de913c552 100644 --- a/src/Microsoft.Diagnostics.DebugServices/IModule.cs +++ b/src/Microsoft.Diagnostics.DebugServices/IModule.cs @@ -86,7 +86,7 @@ public interface IModule /// /// Returns the version information for the modules. /// - VersionData GetVersionData(); + Version GetVersionData(); /// /// Returns the file version string containing the build version and commit id. diff --git a/src/Microsoft.Diagnostics.DebugServices/VersionData.cs b/src/Microsoft.Diagnostics.DebugServices/VersionData.cs deleted file mode 100644 index 5a2625d264..0000000000 --- a/src/Microsoft.Diagnostics.DebugServices/VersionData.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Diagnostics.DebugServices -{ - /// - /// Represents the version of a module - /// - public sealed class VersionData : IEquatable, IComparable - { - /// - /// In a version 'A.B.C.D', this field represents 'A'. - /// - public int Major { get; } - - /// - /// In a version 'A.B.C.D', this field represents 'B'. - /// - public int Minor { get; } - - /// - /// In a version 'A.B.C.D', this field represents 'C'. - /// - public int Revision { get; } - - /// - /// In a version 'A.B.C.D', this field represents 'D'. - /// - public int Patch { get; } - - public VersionData(int major, int minor, int revision, int patch) - { - if (major < 0) - throw new ArgumentOutOfRangeException(nameof(major)); - - if (minor < 0) - throw new ArgumentOutOfRangeException(nameof(minor)); - - if (revision < 0) - throw new ArgumentOutOfRangeException(nameof(revision)); - - if (patch < 0) - throw new ArgumentOutOfRangeException(nameof(patch)); - - Major = major; - Minor = minor; - Revision = revision; - Patch = patch; - } - - /// - public bool Equals(VersionData other) => Major == other.Major && Minor == other.Minor && Revision == other.Revision && Patch == other.Patch; - - /// - public override bool Equals(object obj) => obj is VersionData other && Equals(other); - - /// - public override int GetHashCode() - { - unchecked - { - int hashCode = Major; - hashCode = (hashCode * 397) ^ Minor; - hashCode = (hashCode * 397) ^ Revision; - hashCode = (hashCode * 397) ^ Patch; - return hashCode; - } - } - - /// - public int CompareTo(VersionData other) - { - if (Major != other.Major) - return Major.CompareTo(other.Major); - - if (Minor != other.Minor) - return Minor.CompareTo(other.Minor); - - if (Revision != other.Revision) - return Revision.CompareTo(other.Revision); - - return Patch.CompareTo(other.Patch); - } - - public override string ToString() => $"{Major}.{Minor}.{Revision}.{Patch}"; - - public static bool operator ==(VersionData left, VersionData right) => left.Equals(right); - - public static bool operator !=(VersionData left, VersionData right) => !(left == right); - - public static bool operator <(VersionData left, VersionData right) => left.CompareTo(right) < 0; - - public static bool operator <=(VersionData left, VersionData right) => left.CompareTo(right) <= 0; - - public static bool operator >(VersionData left, VersionData right) => right < left; - - public static bool operator >=(VersionData left, VersionData right) => right <= left; - } -} \ No newline at end of file diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/ClrModulesCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/ClrModulesCommand.cs index 35fabd1ebe..4c253cdfba 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/ClrModulesCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/ClrModulesCommand.cs @@ -4,6 +4,7 @@ using Microsoft.Diagnostics.DebugServices; using Microsoft.Diagnostics.Runtime; +using System; using System.IO; using System.Text.RegularExpressions; @@ -39,14 +40,15 @@ public override void Invoke() WriteLine(" AssemblyName: {0}", module.AssemblyName); WriteLine(" ImageBase: {0:X16}", module.ImageBase); WriteLine(" Size: {0:X8}", module.Size); - WriteLine(" Address: {0:X16}", module.Address); + WriteLine(" ModuleAddress: {0:X16}", module.Address); + WriteLine(" AssemblyAddress: {0:X16}", module.AssemblyAddress); WriteLine(" IsPEFile: {0}", module.IsPEFile); WriteLine(" Layout: {0}", module.Layout); WriteLine(" IsDynamic: {0}", module.IsDynamic); WriteLine(" MetadataAddress: {0:X16}", module.MetadataAddress); WriteLine(" MetadataSize: {0:X16}", module.MetadataLength); WriteLine(" PdbInfo: {0}", module.Pdb?.ToString() ?? ""); - VersionData version = null; + Version version = null; try { version = ModuleService.GetModuleFromBaseAddress(module.ImageBase).GetVersionData(); diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/Host/RuntimesCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/Host/RuntimesCommand.cs index 8b05aa50b5..40820a0e25 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/Host/RuntimesCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/Host/RuntimesCommand.cs @@ -39,7 +39,7 @@ public override void Invoke() foreach (IRuntime runtime in RuntimeService.EnumerateRuntimes()) { if (NetFx && runtime.RuntimeType == RuntimeType.Desktop || - NetCore && runtime.RuntimeType == RuntimeType.NetCore) + NetCore && runtime.RuntimeType == RuntimeType.NetCore) { ContextService.SetCurrentRuntime(runtime.Id); WriteLine("Switched to {0} runtime successfully", name); @@ -61,45 +61,20 @@ public override void Invoke() ClrInfo clrInfo = runtime.Services.GetService(); if (clrInfo is not null) { - unsafe + WriteLine(" Libraries:"); + foreach (DebugLibraryInfo library in clrInfo.DebuggingLibraries) { - if (clrInfo.SingleFileRuntimeInfo.HasValue) - { - RuntimeInfo runtimeInfo = clrInfo.SingleFileRuntimeInfo.Value; - WriteLine(" Signature: {0}", Encoding.ASCII.GetString(runtimeInfo.Signature, RuntimeInfo.SignatureValueLength - 1)); - WriteLine(" Version: {0}", runtimeInfo.Version); - if (Target.OperatingSystem == OSPlatform.Windows) - { - WriteLine(" Runtime: {0}", GetWindowsIndex(runtimeInfo.RuntimeModuleIndex)); - WriteLine(" DBI: {0}", GetWindowsIndex(runtimeInfo.DbiModuleIndex)); - WriteLine(" DAC: {0}", GetWindowsIndex(runtimeInfo.DacModuleIndex)); - } - else - { - WriteLine(" Runtime: {0}", GetUnixIndex(runtimeInfo.RuntimeModuleIndex)); - WriteLine(" DBI: {0}", GetUnixIndex(runtimeInfo.DbiModuleIndex)); - WriteLine(" DAC: {0}", GetUnixIndex(runtimeInfo.DacModuleIndex)); - } - } + string index = library.IndexBuildId.IsDefaultOrEmpty ? $"{library.IndexTimeStamp:X8} {library.IndexFileSize:X8}" : library.IndexBuildId.ToHex(); + WriteLine($" {library.Kind} {library.FileName} {library.Platform} {library.TargetArchitecture} {library.ArchivedUnder} {index}"); } } } } } + } - private unsafe string GetWindowsIndex(byte* index) - { - uint timeStamp = BitConverter.ToUInt32(new ReadOnlySpan(index + sizeof(byte), sizeof(uint)).ToArray(), 0); - uint fileSize = BitConverter.ToUInt32(new ReadOnlySpan(index + sizeof(byte) + sizeof(uint), sizeof(uint)).ToArray(), 0); - return string.Format("TimeStamp {0:X8} FileSize {1:X8}", timeStamp, fileSize); - } - - private unsafe string GetUnixIndex(byte* index) - { - var buildId = new ReadOnlySpan(index + sizeof(byte), index[0]).ToArray().ToImmutableArray(); - return string.Format("BuildId {0}", ToHex(buildId)); - } - - private string ToHex(ImmutableArray array) => string.Concat(array.Select((b) => b.ToString("x2"))); + public static class Utilities + { + public static string ToHex(this ImmutableArray array) => string.Concat(array.Select((b) => b.ToString("x2"))); } } diff --git a/src/Microsoft.Diagnostics.TestHelpers/TestHost/TestDataReader.cs b/src/Microsoft.Diagnostics.TestHelpers/TestHost/TestDataReader.cs index 192fe06fbc..98be1acec9 100644 --- a/src/Microsoft.Diagnostics.TestHelpers/TestHost/TestDataReader.cs +++ b/src/Microsoft.Diagnostics.TestHelpers/TestHost/TestDataReader.cs @@ -103,6 +103,11 @@ public static void GetValue(Type type, string valueString, ref object result) } } + /// + /// Version 1.0.0 constant + /// + public static readonly Version Version100 = new Version("1.0.0"); + /// /// Test data file version /// @@ -187,52 +192,6 @@ private static ImmutableDictionary Build(XElement node) } return members.ToImmutableDictionary(); } - } - - public static class TestDataExtensions - { - /// - /// Helper function to get a test data value - /// - /// type to convert test data value - /// values collection to lookup name - /// value name - /// result value of type T - /// - public static bool TryGetValue( - this ImmutableDictionary values, string name, out T value) - { - if (values.TryGetValue(name, out TestDataReader.Value testValue)) - { - value = testValue.GetValue(); - return true; - } - value = default; - return false; - } - - /// - /// Finds the match item (i.e. IModule, IThread, etc.) in the test data. - /// - /// field or property type - /// Modules, Threads, Registers, etc. test data - /// name of property to use for search - /// - /// test data values - public static ImmutableDictionary Find( - this ImmutableArray> items, string propety, T propertyValue) - where T : IComparable - { - foreach (var item in items) - { - TestDataReader.Value value = item[propety]; - if (propertyValue.CompareTo(value.GetValue()) == 0) - { - return item; - } - } - return default; - } /// /// Compares the test data values with the properties in the instance with the same name. This is @@ -240,13 +199,17 @@ public static bool TryGetValue( /// /// test data for the item /// object to compare - public static void CompareMembers( - this ImmutableDictionary values, object instance) + public void CompareMembers(ImmutableDictionary values, object instance) { foreach (KeyValuePair testData in values) { + string testDataKey = testData.Key; + if (Version <= Version100 && testDataKey == "VersionData") + { + testDataKey = "GetVersionData"; + } MemberInfo[] members = instance.GetType().GetMember( - testData.Key, + testDataKey, MemberTypes.Field | MemberTypes.Property | MemberTypes.Method, BindingFlags.Public | BindingFlags.Instance); @@ -278,7 +241,7 @@ public static void CompareMembers( { if (testData.Value.IsSubValue) { - Trace.TraceInformation($"CompareMembers {testData.Key} sub value:"); + Trace.TraceInformation($"CompareMembers {testDataKey} sub value:"); CompareMembers(testData.Value.Values.Single(), memberValue); } else @@ -305,15 +268,15 @@ public static void CompareMembers( memberValue = memberValue?.ToString() ?? string.Empty; } object testDataValue = testData.Value.GetValue(memberType); - Trace.TraceInformation($"CompareMembers {testData.Key}: expected '{testDataValue}' actual '{memberValue}'"); + Trace.TraceInformation($"CompareMembers {testDataKey}: expected '{testDataValue}' actual '{memberValue}'"); // Disable checking the VersionData property because downloading the necessary binary to map into the address is unreliable // See issue: https://github.com/dotnet/diagnostics/issues/2955 - if (testData.Key == "VersionData") + if (testDataKey == "GetVersionData") { if (!object.Equals(testDataValue, memberValue)) { - Trace.TraceError($"CompareMembers VersionData: expected '{testDataValue}' != actual '{memberValue}'"); + Trace.TraceError($"CompareMembers GetVersionData(): expected '{testDataValue}' != actual '{memberValue}'"); } } else @@ -324,15 +287,61 @@ public static void CompareMembers( } else { - Trace.TraceWarning($"CompareMembers {testData.Key} member not found"); + Trace.TraceWarning($"CompareMembers {testDataKey} member not found"); return; } } else { - Trace.TraceWarning($"CompareMembers {testData.Key} not found"); + Trace.TraceWarning($"CompareMembers {testDataKey} not found"); + } + } + } + } + + public static class TestDataExtensions + { + /// + /// Helper function to get a test data value + /// + /// type to convert test data value + /// values collection to lookup name + /// value name + /// result value of type T + /// + public static bool TryGetValue( + this ImmutableDictionary values, string name, out T value) + { + if (values.TryGetValue(name, out TestDataReader.Value testValue)) + { + value = testValue.GetValue(); + return true; + } + value = default; + return false; + } + + /// + /// Finds the match item (i.e. IModule, IThread, etc.) in the test data. + /// + /// field or property type + /// Modules, Threads, Registers, etc. test data + /// name of property to use for search + /// + /// test data values + public static ImmutableDictionary Find( + this ImmutableArray> items, string propety, T propertyValue) + where T : IComparable + { + foreach (var item in items) + { + TestDataReader.Value value = item[propety]; + if (propertyValue.CompareTo(value.GetValue()) == 0) + { + return item; } } + return default; } } } diff --git a/src/Microsoft.Diagnostics.TestHelpers/TestHost/TestDataWriter.cs b/src/Microsoft.Diagnostics.TestHelpers/TestHost/TestDataWriter.cs index adc4c668ff..537275ce3a 100644 --- a/src/Microsoft.Diagnostics.TestHelpers/TestHost/TestDataWriter.cs +++ b/src/Microsoft.Diagnostics.TestHelpers/TestHost/TestDataWriter.cs @@ -20,7 +20,7 @@ public class TestDataWriter public TestDataWriter() { Root = new XElement("TestData"); - Root.Add(new XElement("Version", "1.0.0")); + Root.Add(new XElement("Version", "1.0.1")); Target = new XElement("Target"); Root.Add(Target); } @@ -93,7 +93,7 @@ public void Write(string testDataFile) private void AddModuleMembers(XElement element, IModule module, string symbolModuleName) { - AddMembers(element, typeof(IModule), module, nameof(IModule.ModuleIndex), nameof(IModule.GetPdbFileInfos), nameof(IModule.GetVersionString)); + AddMembers(element, typeof(IModule), module, nameof(IModule.ModuleIndex), nameof(IModule.GetPdbFileInfos), nameof(IModule.GetVersionString), nameof(IModule.GetSymbolFileName)); if (symbolModuleName != null && IsModuleEqual(module, symbolModuleName)) { @@ -230,7 +230,7 @@ private void AddMembers(XElement element, Type type, object instance, params str result = string.Format($"0x{{0:X{digits}}}", memberValue); } } - else if (memberType.IsValueType || memberType == typeof(VersionData) || memberType == typeof(PdbFileInfo)) + else if (memberType.IsValueType || memberType == typeof(Version) || memberType == typeof(PdbFileInfo)) { result = memberValue?.ToString(); } diff --git a/src/SOS/SOS.Extensions/ConsoleServiceFromDebuggerServices.cs b/src/SOS/SOS.Extensions/ConsoleServiceFromDebuggerServices.cs index 927f21b8f2..4a6c52ae38 100644 --- a/src/SOS/SOS.Extensions/ConsoleServiceFromDebuggerServices.cs +++ b/src/SOS/SOS.Extensions/ConsoleServiceFromDebuggerServices.cs @@ -1,5 +1,5 @@ using Microsoft.Diagnostics.DebugServices; -using Microsoft.Diagnostics.Runtime.Interop; +using SOS.Hosting.DbgEng.Interop; using System.Threading; namespace SOS.Extensions diff --git a/src/SOS/SOS.Extensions/DebuggerServices.cs b/src/SOS/SOS.Extensions/DebuggerServices.cs index eb8d85b19c..98ba7995d8 100644 --- a/src/SOS/SOS.Extensions/DebuggerServices.cs +++ b/src/SOS/SOS.Extensions/DebuggerServices.cs @@ -4,11 +4,10 @@ using Microsoft.Diagnostics.DebugServices; using Microsoft.Diagnostics.Runtime; -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng.Interop; using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/src/SOS/SOS.Extensions/ModuleServiceFromDebuggerServices.cs b/src/SOS/SOS.Extensions/ModuleServiceFromDebuggerServices.cs index ef097f3f3d..f94977be0c 100644 --- a/src/SOS/SOS.Extensions/ModuleServiceFromDebuggerServices.cs +++ b/src/SOS/SOS.Extensions/ModuleServiceFromDebuggerServices.cs @@ -4,8 +4,9 @@ using Microsoft.Diagnostics.DebugServices; using Microsoft.Diagnostics.DebugServices.Implementation; -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng.Interop; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Runtime.InteropServices; @@ -23,7 +24,7 @@ class ModuleFromDebuggerServices : Module, IModuleSymbols private const uint InvalidTimeStamp = 0xFFFFFFFE; private readonly ModuleServiceFromDebuggerServices _moduleService; - private VersionData _versionData; + private Version _version; private string _versionString; public ModuleFromDebuggerServices( @@ -61,7 +62,7 @@ public ModuleFromDebuggerServices( public override uint? IndexTimeStamp { get; } - public override VersionData GetVersionData() + public override Version GetVersionData() { if (InitializeValue(Module.Flags.InitializeVersion)) { @@ -70,19 +71,19 @@ public override VersionData GetVersionData() { int major = (int)(fileInfo.dwFileVersionMS >> 16); int minor = (int)(fileInfo.dwFileVersionMS & 0xffff); - int revision = (int)(fileInfo.dwFileVersionLS >> 16); - int patch = (int)(fileInfo.dwFileVersionLS & 0xffff); - _versionData = new VersionData(major, minor, revision, patch); + int build = (int)(fileInfo.dwFileVersionLS >> 16); + int revision = (int)(fileInfo.dwFileVersionLS & 0xffff); + _version = new Version(major, minor, build, revision); } else { if (_moduleService.Target.OperatingSystem != OSPlatform.Windows) { - _versionData = GetVersion(); + _version = GetVersionInner(); } } } - return _versionData; + return _version; } public override string GetVersionString() diff --git a/src/SOS/SOS.Extensions/SOS.Extensions.csproj b/src/SOS/SOS.Extensions/SOS.Extensions.csproj index 0185dcec4a..c639bf201a 100644 --- a/src/SOS/SOS.Extensions/SOS.Extensions.csproj +++ b/src/SOS/SOS.Extensions/SOS.Extensions.csproj @@ -13,7 +13,6 @@ - diff --git a/src/SOS/SOS.Extensions/TargetFromFromDebuggerServices.cs b/src/SOS/SOS.Extensions/TargetFromFromDebuggerServices.cs index 3ce6225dae..b57f491fde 100644 --- a/src/SOS/SOS.Extensions/TargetFromFromDebuggerServices.cs +++ b/src/SOS/SOS.Extensions/TargetFromFromDebuggerServices.cs @@ -4,8 +4,8 @@ using Microsoft.Diagnostics.DebugServices; using Microsoft.Diagnostics.DebugServices.Implementation; -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng.Interop; using System; using System.Diagnostics; using System.Runtime.InteropServices; diff --git a/src/SOS/SOS.Hosting/DataTargetWrapper.cs b/src/SOS/SOS.Hosting/DataTargetWrapper.cs index e8106b67e8..48e4e2fbb3 100644 --- a/src/SOS/SOS.Hosting/DataTargetWrapper.cs +++ b/src/SOS/SOS.Hosting/DataTargetWrapper.cs @@ -3,8 +3,8 @@ // See the LICENSE file in the project root for more information. using Microsoft.Diagnostics.DebugServices; -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng.Interop; using System; using System.Diagnostics; using System.Linq; diff --git a/src/SOS/SOS.Hosting/dbgeng/DebugAdvanced.cs b/src/SOS/SOS.Hosting/DbgEng/DebugAdvanced.cs similarity index 94% rename from src/SOS/SOS.Hosting/dbgeng/DebugAdvanced.cs rename to src/SOS/SOS.Hosting/DbgEng/DebugAdvanced.cs index a1af7924fb..9bc754fb25 100644 --- a/src/SOS/SOS.Hosting/dbgeng/DebugAdvanced.cs +++ b/src/SOS/SOS.Hosting/DbgEng/DebugAdvanced.cs @@ -2,12 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng.Interop; using System; using System.Runtime.InteropServices; -namespace SOS.Hosting +namespace SOS.Hosting.DbgEng { internal unsafe class DebugAdvanced { diff --git a/src/SOS/SOS.Hosting/dbgeng/DebugClient.cs b/src/SOS/SOS.Hosting/DbgEng/DebugClient.cs similarity index 99% rename from src/SOS/SOS.Hosting/dbgeng/DebugClient.cs rename to src/SOS/SOS.Hosting/DbgEng/DebugClient.cs index 19e595cca8..58a57b05bd 100644 --- a/src/SOS/SOS.Hosting/dbgeng/DebugClient.cs +++ b/src/SOS/SOS.Hosting/DbgEng/DebugClient.cs @@ -2,14 +2,14 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng.Interop; using System; using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; -namespace SOS.Hosting +namespace SOS.Hosting.DbgEng { internal unsafe class DebugClient : COMCallableIUnknown { diff --git a/src/SOS/SOS.Hosting/dbgeng/DebugControl.cs b/src/SOS/SOS.Hosting/DbgEng/DebugControl.cs similarity index 99% rename from src/SOS/SOS.Hosting/dbgeng/DebugControl.cs rename to src/SOS/SOS.Hosting/DbgEng/DebugControl.cs index 9536e665b7..a8efb85831 100644 --- a/src/SOS/SOS.Hosting/dbgeng/DebugControl.cs +++ b/src/SOS/SOS.Hosting/DbgEng/DebugControl.cs @@ -2,13 +2,13 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng.Interop; using System; using System.Runtime.InteropServices; using System.Text; -namespace SOS.Hosting +namespace SOS.Hosting.DbgEng { internal unsafe class DebugControl { diff --git a/src/SOS/SOS.Hosting/dbgeng/DebugDataSpaces.cs b/src/SOS/SOS.Hosting/DbgEng/DebugDataSpaces.cs similarity index 99% rename from src/SOS/SOS.Hosting/dbgeng/DebugDataSpaces.cs rename to src/SOS/SOS.Hosting/DbgEng/DebugDataSpaces.cs index 61108219f5..5d05a9b8b3 100644 --- a/src/SOS/SOS.Hosting/dbgeng/DebugDataSpaces.cs +++ b/src/SOS/SOS.Hosting/DbgEng/DebugDataSpaces.cs @@ -2,12 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng.Interop; using System; using System.Runtime.InteropServices; -namespace SOS.Hosting +namespace SOS.Hosting.DbgEng { internal unsafe class DebugDataSpaces { diff --git a/src/SOS/SOS.Hosting/dbgeng/DebugRegisters.cs b/src/SOS/SOS.Hosting/DbgEng/DebugRegisters.cs similarity index 98% rename from src/SOS/SOS.Hosting/dbgeng/DebugRegisters.cs rename to src/SOS/SOS.Hosting/DbgEng/DebugRegisters.cs index c6554d7b73..25c0d8d882 100644 --- a/src/SOS/SOS.Hosting/dbgeng/DebugRegisters.cs +++ b/src/SOS/SOS.Hosting/DbgEng/DebugRegisters.cs @@ -2,13 +2,13 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng.Interop; using System; using System.Runtime.InteropServices; using System.Text; -namespace SOS.Hosting +namespace SOS.Hosting.DbgEng { internal unsafe class DebugRegisters { diff --git a/src/SOS/SOS.Hosting/dbgeng/DebugSymbols.cs b/src/SOS/SOS.Hosting/DbgEng/DebugSymbols.cs similarity index 99% rename from src/SOS/SOS.Hosting/dbgeng/DebugSymbols.cs rename to src/SOS/SOS.Hosting/DbgEng/DebugSymbols.cs index b2cbe689e0..ff3c066c8e 100644 --- a/src/SOS/SOS.Hosting/dbgeng/DebugSymbols.cs +++ b/src/SOS/SOS.Hosting/DbgEng/DebugSymbols.cs @@ -2,13 +2,13 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng.Interop; using System; using System.Runtime.InteropServices; using System.Text; -namespace SOS.Hosting +namespace SOS.Hosting.DbgEng { internal unsafe class DebugSymbols { @@ -269,7 +269,7 @@ private delegate int GetModuleNamesDelegate( [Out] uint* ModuleNameSize, [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder LoadedImageNameBuffer, [In] uint LoadedImageNameBufferSize, - [Out] uint* LoadedImageNameSize); + [Out] uint* LoadedImageNameSize); [UnmanagedFunctionPointer(CallingConvention.Winapi)] private delegate int GetModuleParametersDelegate( @@ -424,7 +424,7 @@ private delegate int CreateSymbolGroupDelegate( private delegate int StartSymbolMatchDelegate( IntPtr self, [In][MarshalAs(UnmanagedType.LPStr)] string Pattern, - [Out] ulong* Handle); + [Out] ulong* Handle); [UnmanagedFunctionPointer(CallingConvention.Winapi)] private delegate int GetNextSymbolMatchDelegate( @@ -613,7 +613,7 @@ private delegate int GetNearNameByOffsetWideDelegate( [In] int Delta, [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, [In] int NameBufferSize, - [Out] uint* NameSize, + [Out] uint* NameSize, [Out] ulong* Displacement); [UnmanagedFunctionPointer(CallingConvention.Winapi)] diff --git a/src/SOS/SOS.Hosting/dbgeng/DebugSystemObjects.cs b/src/SOS/SOS.Hosting/DbgEng/DebugSystemObjects.cs similarity index 99% rename from src/SOS/SOS.Hosting/dbgeng/DebugSystemObjects.cs rename to src/SOS/SOS.Hosting/DbgEng/DebugSystemObjects.cs index af2ebbc07a..154fa06ef3 100644 --- a/src/SOS/SOS.Hosting/dbgeng/DebugSystemObjects.cs +++ b/src/SOS/SOS.Hosting/DbgEng/DebugSystemObjects.cs @@ -2,13 +2,13 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng.Interop; using System; using System.Runtime.InteropServices; using System.Text; -namespace SOS.Hosting +namespace SOS.Hosting.DbgEng { internal unsafe class DebugSystemObjects { diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/BusDataType.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/BusDataType.cs new file mode 100644 index 0000000000..3d4d12eaed --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/BusDataType.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum BUS_DATA_TYPE + { + ConfigurationSpaceUndefined = -1, + Cmos, + EisaConfiguration, + Pos, + CbusConfiguration, + PCIConfiguration, + VMEConfiguration, + NuBusConfiguration, + PCMCIAConfiguration, + MPIConfiguration, + MPSAConfiguration, + PNPISAConfiguration, + SgiInternalConfiguration, + MaximumBusDataType + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/CodePage.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/CodePage.cs new file mode 100644 index 0000000000..8653a18486 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/CodePage.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum CODE_PAGE : uint + { + ACP = 0, // default to ANSI code page + OEMCP = 1, // default to OEM code page + MACCP = 2, // default to MAC code page + THREAD_ACP = 3, // current thread's ANSI code page + SYMBOL = 42, // SYMBOL translations + + UTF7 = 65000, // UTF-7 translation + UTF8 = 65001 // UTF-8 translation + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugAddSynthMethod.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugAddSynthMethod.cs new file mode 100644 index 0000000000..db46ff1e17 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugAddSynthMethod.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_ADDSYNTHMOD : uint + { + DEFAULT = 0 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugAddSynthSym.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugAddSynthSym.cs new file mode 100644 index 0000000000..ca914b700e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugAddSynthSym.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_ADDSYNTHSYM : uint + { + DEFAULT = 0 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugAsmOpt.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugAsmOpt.cs new file mode 100644 index 0000000000..44550d3584 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugAsmOpt.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_ASMOPT : uint + { + DEFAULT = 0x00000000, + VERBOSE = 0x00000001, + NO_CODE_BYTES = 0x00000002, + IGNORE_OUTPUT_WIDTH = 0x00000004, + SOURCE_LINE_NUMBER = 0x00000008 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugAttach.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugAttach.cs new file mode 100644 index 0000000000..d02e26210d --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugAttach.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_ATTACH : uint + { + KERNEL_CONNECTION = 0, + LOCAL_KERNEL = 1, + EXDI_DRIVER = 2, + + DEFAULT = 0, + NONINVASIVE = 1, + EXISTING = 2, + NONINVASIVE_NO_SUSPEND = 4, + INVASIVE_NO_INITIAL_BREAK = 8, + INVASIVE_RESUME_PROCESS = 0x10, + NONINVASIVE_ALLOW_PARTIAL = 0x20 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugBreakpointAccessType.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugBreakpointAccessType.cs new file mode 100644 index 0000000000..cf2195f3a0 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugBreakpointAccessType.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_BREAKPOINT_ACCESS_TYPE : uint + { + READ = 1, + WRITE = 2, + EXECUTE = 4, + IO = 8 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugBreakpointFlag.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugBreakpointFlag.cs new file mode 100644 index 0000000000..9fdf4a3ee1 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugBreakpointFlag.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_BREAKPOINT_FLAG : uint + { + GO_ONLY = 1, + DEFERRED = 2, + ENABLED = 4, + ADDER_ONLY = 8, + ONE_SHOT = 0x10 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugBreakpointType.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugBreakpointType.cs new file mode 100644 index 0000000000..e8f608a623 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugBreakpointType.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_BREAKPOINT_TYPE : uint + { + CODE = 0, + DATA = 1, + TIME = 2 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCds.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCds.cs new file mode 100644 index 0000000000..765ef2580e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCds.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_CDS : uint + { + ALL = 0xffffffff, + REGISTERS = 1, + DATA = 2, + REFRESH = 4 // Inform the GUI clients to refresh debugger windows. + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCdsRefresh.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCdsRefresh.cs new file mode 100644 index 0000000000..2b08f1186e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCdsRefresh.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + // What windows should the GUI client refresh? + [Flags] + public enum DEBUG_CDS_REFRESH : uint + { + EVALUATE = 1, + EXECUTE = 2, + EXECUTECOMMANDFILE = 3, + ADDBREAKPOINT = 4, + REMOVEBREAKPOINT = 5, + WRITEVIRTUAL = 6, + WRITEVIRTUALUNCACHED = 7, + WRITEPHYSICAL = 8, + WRITEPHYSICAL2 = 9, + SETVALUE = 10, + SETVALUE2 = 11, + SETSCOPE = 12, + SETSCOPEFRAMEBYINDEX = 13, + SETSCOPEFROMJITDEBUGINFO = 14, + SETSCOPEFROMSTOREDEVENT = 15, + INLINESTEP = 16, + INLINESTEP_PSEUDO = 17 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCes.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCes.cs new file mode 100644 index 0000000000..29f16759f7 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCes.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_CES : uint + { + ALL = 0xffffffff, + CURRENT_THREAD = 1, + EFFECTIVE_PROCESSOR = 2, + BREAKPOINTS = 4, + CODE_LEVEL = 8, + EXECUTION_STATUS = 0x10, + ENGINE_OPTIONS = 0x20, + LOG_FILE = 0x40, + RADIX = 0x80, + EVENT_FILTERS = 0x100, + PROCESS_OPTIONS = 0x200, + EXTENSIONS = 0x400, + SYSTEMS = 0x800, + ASSEMBLY_OPTIONS = 0x1000, + EXPRESSION_SYNTAX = 0x2000, + TEXT_REPLACEMENTS = 0x4000 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCesExecutionStatus.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCesExecutionStatus.cs new file mode 100644 index 0000000000..a99bc627bd --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCesExecutionStatus.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_CES_EXECUTION_STATUS : ulong + { + INSIDE_WAIT = 0x100000000UL, + WAIT_TIMEOUT = 0x200000000UL + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugClass.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugClass.cs new file mode 100644 index 0000000000..e53617bc41 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugClass.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_CLASS : uint + { + UNINITIALIZED = 0, + KERNEL = 1, + USER_WINDOWS = 2, + IMAGE_FILE = 3 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugClassQualifier.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugClassQualifier.cs new file mode 100644 index 0000000000..7afbabb85d --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugClassQualifier.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_CLASS_QUALIFIER : uint + { + KERNEL_CONNECTION = 0, + KERNEL_LOCAL = 1, + KERNEL_EXDI_DRIVER = 2, + KERNEL_IDNA = 3, + KERNEL_SMALL_DUMP = 1024, + KERNEL_DUMP = 1025, + KERNEL_FULL_DUMP = 1026, + USER_WINDOWS_PROCESS = 0, + USER_WINDOWS_PROCESS_SERVER = 1, + USER_WINDOWS_IDNA = 2, + USER_WINDOWS_SMALL_DUMP = 1024, + USER_WINDOWS_DUMP = 1026 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugConnectSession.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugConnectSession.cs new file mode 100644 index 0000000000..ad989027cb --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugConnectSession.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_CONNECT_SESSION : uint + { + DEFAULT = 0, + NO_VERSION = 1, + NO_ANNOUNCE = 2 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCreateProcess.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCreateProcess.cs new file mode 100644 index 0000000000..0c7d957013 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCreateProcess.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_CREATE_PROCESS : uint + { + DEFAULT = 0, + NO_DEBUG_HEAP = 0x00000400, /* CREATE_UNICODE_ENVIRONMENT */ + THROUGH_RTL = 0x00010000 /* STACK_SIZE_PARAM_IS_A_RESERVATION */ + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCss.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCss.cs new file mode 100644 index 0000000000..b2f33ab85a --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCss.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_CSS : uint + { + ALL = 0xffffffff, + LOADS = 1, + UNLOADS = 2, + SCOPE = 4, + PATHS = 8, + SYMBOL_OPTIONS = 0x10, + TYPE_OPTIONS = 0x20 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCurrent.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCurrent.cs new file mode 100644 index 0000000000..cd6c76466e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugCurrent.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_CURRENT : uint + { + DEFAULT = 0xf, + SYMBOL = 1, + DISASM = 2, + REGISTERS = 4, + SOURCE_LINE = 8 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugData.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugData.cs new file mode 100644 index 0000000000..1bfb3fd275 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugData.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_DATA : uint + { + KPCR_OFFSET = 0, + KPRCB_OFFSET = 1, + KTHREAD_OFFSET = 2, + BASE_TRANSLATION_VIRTUAL_OFFSET = 3, + PROCESSOR_IDENTIFICATION = 4, + PROCESSOR_SPEED = 5 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugDataSpace.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugDataSpace.cs new file mode 100644 index 0000000000..248ef64728 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugDataSpace.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_DATA_SPACE : uint + { + VIRTUAL = 0, + PHYSICAL = 1, + CONTROL = 2, + IO = 3, + MSR = 4, + BUS_DATA = 5, + DEBUGGER_DATA = 6 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugDisasm.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugDisasm.cs new file mode 100644 index 0000000000..8ae2114a0e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugDisasm.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_DISASM : uint + { + EFFECTIVE_ADDRESS = 1, + MATCHING_SYMBOLS = 2, + SOURCE_LINE_NUMBER = 4, + SOURCE_FILE_NAME = 8 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugDump.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugDump.cs new file mode 100644 index 0000000000..34f8873d53 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugDump.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_DUMP : uint + { + SMALL = 1024, + DEFAULT = 1025, + FULL = 1026, + IMAGE_FILE = 1027, + TRACE_LOG = 1028, + WINDOWS_CD = 1029, + KERNEL_DUMP = 1025, + KERNEL_SMALL_DUMP = 1024, + KERNEL_FULL_DUMP = 1026 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugDumpFile.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugDumpFile.cs new file mode 100644 index 0000000000..28a8c80dd6 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugDumpFile.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_DUMP_FILE : uint + { + BASE = 0xffffffff, + PAGE_FILE_DUMP = 0 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugECreateProcess.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugECreateProcess.cs new file mode 100644 index 0000000000..2b11c97215 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugECreateProcess.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_ECREATE_PROCESS : uint + { + DEFAULT = 0, + INHERIT_HANDLES = 1, + USE_VERIFIER_FLAGS = 2, + USE_IMPLICIT_COMMAND_LINE = 4 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugEIndex.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugEIndex.cs new file mode 100644 index 0000000000..6ed0085cd6 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugEIndex.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_EINDEX : uint + { + NAME = 0, + FROM_START = 0, + FROM_END = 1, + FROM_CURRENT = 2 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugEnd.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugEnd.cs new file mode 100644 index 0000000000..caffe34845 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugEnd.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_END : uint + { + PASSIVE = 0, + ACTIVE_TERMINATE = 1, + ACTIVE_DETACH = 2, + END_REENTRANT = 3, + END_DISCONNECT = 4 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugEngOpt.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugEngOpt.cs new file mode 100644 index 0000000000..8f1d2c066c --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugEngOpt.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_ENGOPT : uint + { + NONE = 0, + IGNORE_DBGHELP_VERSION = 0x00000001, + IGNORE_EXTENSION_VERSIONS = 0x00000002, + ALLOW_NETWORK_PATHS = 0x00000004, + DISALLOW_NETWORK_PATHS = 0x00000008, + NETWORK_PATHS = 0x00000004 | 0x00000008, + IGNORE_LOADER_EXCEPTIONS = 0x00000010, + INITIAL_BREAK = 0x00000020, + INITIAL_MODULE_BREAK = 0x00000040, + FINAL_BREAK = 0x00000080, + NO_EXECUTE_REPEAT = 0x00000100, + FAIL_INCOMPLETE_INFORMATION = 0x00000200, + ALLOW_READ_ONLY_BREAKPOINTS = 0x00000400, + SYNCHRONIZE_BREAKPOINTS = 0x00000800, + DISALLOW_SHELL_COMMANDS = 0x00001000, + KD_QUIET_MODE = 0x00002000, + DISABLE_MANAGED_SUPPORT = 0x00004000, + DISABLE_MODULE_SYMBOL_LOAD = 0x00008000, + DISABLE_EXECUTION_COMMANDS = 0x00010000, + DISALLOW_IMAGE_FILE_MAPPING = 0x00020000, + PREFER_DML = 0x00040000, + ALL = 0x0007FFFF + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugEvent.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugEvent.cs new file mode 100644 index 0000000000..ab670126b3 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugEvent.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_EVENT : uint + { + NONE = 0, + BREAKPOINT = 1, + EXCEPTION = 2, + CREATE_THREAD = 4, + EXIT_THREAD = 8, + CREATE_PROCESS = 0x10, + EXIT_PROCESS = 0x20, + LOAD_MODULE = 0x40, + UNLOAD_MODULE = 0x80, + SYSTEM_ERROR = 0x100, + SESSION_STATUS = 0x200, + CHANGE_DEBUGGEE_STATE = 0x400, + CHANGE_ENGINE_STATE = 0x800, + CHANGE_SYMBOL_STATE = 0x1000 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugExecute.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugExecute.cs new file mode 100644 index 0000000000..c7e5bb0e0b --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugExecute.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_EXECUTE : uint + { + DEFAULT = 0, + ECHO = 1, + NOT_LOGGED = 2, + NO_REPEAT = 4 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugExpr.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugExpr.cs new file mode 100644 index 0000000000..9a36305b1a --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugExpr.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_EXPR : uint + { + MASM = 0, + CPLUSPLUS = 1 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFilterContinueOption.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFilterContinueOption.cs new file mode 100644 index 0000000000..c316dfb0af --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFilterContinueOption.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_FILTER_CONTINUE_OPTION : uint + { + GO_HANDLED = 0x00000000, + GO_NOT_HANDLED = 0x00000001 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFilterEvent.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFilterEvent.cs new file mode 100644 index 0000000000..a190a38983 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFilterEvent.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_FILTER_EVENT : uint + { + CREATE_THREAD = 0x00000000, + EXIT_THREAD = 0x00000001, + CREATE_PROCESS = 0x00000002, + EXIT_PROCESS = 0x00000003, + LOAD_MODULE = 0x00000004, + UNLOAD_MODULE = 0x00000005, + SYSTEM_ERROR = 0x00000006, + INITIAL_BREAKPOINT = 0x00000007, + INITIAL_MODULE_LOAD = 0x00000008, + DEBUGGEE_OUTPUT = 0x00000009 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFilterExecOption.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFilterExecOption.cs new file mode 100644 index 0000000000..d8120f8d86 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFilterExecOption.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_FILTER_EXEC_OPTION : uint + { + BREAK = 0x00000000, + SECOND_CHANCE_BREAK = 0x00000001, + OUTPUT = 0x00000002, + IGNORE = 0x00000003, + REMOVE = 0x00000004 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFindSource.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFindSource.cs new file mode 100644 index 0000000000..34242dc63a --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFindSource.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_FIND_SOURCE : uint + { + DEFAULT = 0, + FULL_PATH = 1, + BEST_MATCH = 2, + NO_SRCSRV = 4, + TOKEN_LOOKUP = 8 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFormat.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFormat.cs new file mode 100644 index 0000000000..c55a14947c --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFormat.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_FORMAT : uint + { + DEFAULT = 0x00000000, + CAB_SECONDARY_ALL_IMAGES = 0x10000000, + WRITE_CAB = 0x20000000, + CAB_SECONDARY_FILES = 0x40000000, + NO_OVERWRITE = 0x80000000, + + USER_SMALL_FULL_MEMORY = 0x00000001, + USER_SMALL_HANDLE_DATA = 0x00000002, + USER_SMALL_UNLOADED_MODULES = 0x00000004, + USER_SMALL_INDIRECT_MEMORY = 0x00000008, + USER_SMALL_DATA_SEGMENTS = 0x00000010, + USER_SMALL_FILTER_MEMORY = 0x00000020, + USER_SMALL_FILTER_PATHS = 0x00000040, + USER_SMALL_PROCESS_THREAD_DATA = 0x00000080, + USER_SMALL_PRIVATE_READ_WRITE_MEMORY = 0x00000100, + USER_SMALL_NO_OPTIONAL_DATA = 0x00000200, + USER_SMALL_FULL_MEMORY_INFO = 0x00000400, + USER_SMALL_THREAD_INFO = 0x00000800, + USER_SMALL_CODE_SEGMENTS = 0x00001000, + USER_SMALL_NO_AUXILIARY_STATE = 0x00002000, + USER_SMALL_FULL_AUXILIARY_STATE = 0x00004000, + USER_SMALL_IGNORE_INACCESSIBLE_MEM = 0x08000000 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFrame.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFrame.cs new file mode 100644 index 0000000000..17bd1312d3 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugFrame.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_FRAME : uint + { + DEFAULT = 0, + IGNORE_INLINE = 1 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGetFnent.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGetFnent.cs new file mode 100644 index 0000000000..766765ac51 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGetFnent.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_GETFNENT : uint + { + DEFAULT = 0, + RAW_ENTRY_ONLY = 1 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGetMod.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGetMod.cs new file mode 100644 index 0000000000..0953fa4515 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGetMod.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_GETMOD : uint + { + DEFAULT = 0, + NO_LOADED_MODULES = 1, + NO_UNLOADED_MODULES = 2 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGetProc.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGetProc.cs new file mode 100644 index 0000000000..5d516e8ad0 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGetProc.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_GET_PROC : uint + { + DEFAULT = 0, + FULL_MATCH = 1, + ONLY_MATCH = 2, + SERVICE_NAME = 4 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGetTextCompletions.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGetTextCompletions.cs new file mode 100644 index 0000000000..f91d0e43e4 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGetTextCompletions.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_GET_TEXT_COMPLETIONS : uint + { + NONE = 0, + NO_DOT_COMMANDS = 1, + NO_EXTENSION_COMMANDS = 2, + NO_SYMBOLS = 4, + IS_DOT_COMMAND = 1, + IS_EXTENSION_COMMAND = 2, + IS_SYMBOL = 4 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGsel.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGsel.cs new file mode 100644 index 0000000000..05887ec10d --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugGsel.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_GSEL : uint + { + DEFAULT = 0, + NO_SYMBOL_LOADS = 1, + ALLOW_LOWER = 2, + ALLOW_HIGHER = 4, + NEAREST_ONLY = 8, + INLINE_CALLSITE = 0x10 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugHandleDataType.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugHandleDataType.cs new file mode 100644 index 0000000000..c129c27e1e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugHandleDataType.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_HANDLE_DATA_TYPE : uint + { + BASIC = 0, + TYPE_NAME = 1, + OBJECT_NAME = 2, + HANDLE_COUNT = 3, + TYPE_NAME_WIDE = 4, + OBJECT_NAME_WIDE = 5, + MINI_THREAD_1 = 6, + MINI_MUTANT_1 = 7, + MINI_MUTANT_2 = 8, + PER_HANDLE_OPERATIONS = 9, + ALL_HANDLE_OPERATIONS = 10, + MINI_PROCESS_1 = 11, + MINI_PROCESS_2 = 12 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugInterrupt.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugInterrupt.cs new file mode 100644 index 0000000000..4a85a90936 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugInterrupt.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_INTERRUPT : uint + { + ACTIVE = 0, + PASSIVE = 1, + EXIT = 2 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugLevel.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugLevel.cs new file mode 100644 index 0000000000..b681e1dc8b --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugLevel.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_LEVEL : uint + { + SOURCE = 0, + ASSEMBLY = 1 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugLog.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugLog.cs new file mode 100644 index 0000000000..558e3bb44e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugLog.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_LOG : uint + { + DEFAULT = 0, + APPEND = 1, + UNICODE = 2, + DML = 4 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugManReset.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugManReset.cs new file mode 100644 index 0000000000..065eaea9a0 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugManReset.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_MANRESET : uint + { + DEFAULT = 0, + LOAD_DLL = 1 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugManStr.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugManStr.cs new file mode 100644 index 0000000000..2edd38c82a --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugManStr.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_MANSTR : uint + { + NONE = 0, + LOADED_SUPPORT_DLL = 1, + LOAD_STATUS = 2 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugManaged.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugManaged.cs new file mode 100644 index 0000000000..26025e722b --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugManaged.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_MANAGED : uint + { + DISABLED = 0, + ALLOWED = 1, + DLL_LOADED = 2 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugModName.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugModName.cs new file mode 100644 index 0000000000..88440309bf --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugModName.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_MODNAME : uint + { + IMAGE = 0x00000000, + MODULE = 0x00000001, + LOADED_IMAGE = 0x00000002, + SYMBOL_FILE = 0x00000003, + MAPPED_IMAGE = 0x00000004 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugModule.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugModule.cs new file mode 100644 index 0000000000..a135a4c94a --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugModule.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_MODULE : uint + { + LOADED = 0, + UNLOADED = 1, + USER_MODE = 2, + EXE_MODULE = 4, + EXPLICIT = 8, + SECONDARY = 0x10, + SYNTHETIC = 0x20, + SYM_BAD_CHECKSUM = 0x10000 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOffsInfo.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOffsInfo.cs new file mode 100644 index 0000000000..1befaab101 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOffsInfo.cs @@ -0,0 +1,11 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_OFFSINFO : uint + { + VIRTUAL_SOURCE = 0x00000001 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutCb.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutCb.cs new file mode 100644 index 0000000000..33147822b9 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutCb.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_OUTCB : uint + { + TEXT = 0, + DML = 1, + EXPLICIT_FLUSH = 2 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutCbf.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutCbf.cs new file mode 100644 index 0000000000..2ca8c73208 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutCbf.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_OUTCBF : uint + { + EXPLICIT_FLUSH = 1, + DML_HAS_TAGS = 2, + DML_HAS_SPECIAL_CHARACTERS = 4 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutCbi.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutCbi.cs new file mode 100644 index 0000000000..03fbf6c262 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutCbi.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_OUTCBI : uint + { + EXPLICIT_FLUSH = 1, + TEXT = 2, + DML = 4, + ANY_FORMAT = 6 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutCtl.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutCtl.cs new file mode 100644 index 0000000000..5d59dc8a43 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutCtl.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_OUTCTL : uint + { + THIS_CLIENT = 0, + ALL_CLIENTS = 1, + ALL_OTHER_CLIENTS = 2, + IGNORE = 3, + LOG_ONLY = 4, + SEND_MASK = 7, + NOT_LOGGED = 8, + OVERRIDE_MASK = 0x10, + DML = 0x20, + AMBIENT_DML = 0xfffffffe, + AMBIENT_TEXT = 0xffffffff + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutSym.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutSym.cs new file mode 100644 index 0000000000..616906804c --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutSym.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_OUTSYM : uint + { + DEFAULT = 0, + FORCE_OFFSET = 1, + SOURCE_LINE = 2, + ALLOW_DISPLACEMENT = 4 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutTextRepl.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutTextRepl.cs new file mode 100644 index 0000000000..f64aec72f9 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutTextRepl.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_OUT_TEXT_REPL : uint + { + DEFAULT = 0 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutType.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutType.cs new file mode 100644 index 0000000000..300d101c9b --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutType.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_OUTTYPE + { + DEFAULT = 0, + NO_INDENT = 1, + NO_OFFSET = 2, + VERBOSE = 4, + COMPACT_OUTPUT = 8, + ADDRESS_OF_FIELD = 0x10000, + ADDRESS_ANT_END = 0x20000, + BLOCK_RECURSE = 0x200000 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutput.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutput.cs new file mode 100644 index 0000000000..739ce80ba7 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutput.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_OUTPUT : uint + { + NORMAL = 1, + ERROR = 2, + WARNING = 4, + VERBOSE = 8, + PROMPT = 0x10, + PROMPT_REGISTERS = 0x20, + EXTENSION_WARNING = 0x40, + DEBUGGEE = 0x80, + DEBUGGEE_PROMPT = 0x100, + SYMBOLS = 0x200 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutputSymbols.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutputSymbols.cs new file mode 100644 index 0000000000..d5f59c1ebd --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugOutputSymbols.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_OUTPUT_SYMBOLS + { + DEFAULT = 0, + NO_NAMES = 1, + NO_OFFSETS = 2, + NO_VALUES = 4, + NO_TYPES = 0x10 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugPhysical.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugPhysical.cs new file mode 100644 index 0000000000..390119287f --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugPhysical.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_PHYSICAL : uint + { + DEFAULT = 0, + CACHED = 1, + UNCACHED = 2, + WRITE_COMBINED = 3 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugProcDesc.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugProcDesc.cs new file mode 100644 index 0000000000..199f5f7927 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugProcDesc.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_PROC_DESC : uint + { + DEFAULT = 0, + NO_PATHS = 1, + NO_SERVICES = 2, + NO_MTS_PACKAGES = 4, + NO_COMMAND_LINE = 8, + NO_SESSION_ID = 0x10, + NO_USER_NAME = 0x20 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugProcess.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugProcess.cs new file mode 100644 index 0000000000..78ffe19245 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugProcess.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_PROCESS : uint + { + DEFAULT = 0, + DETACH_ON_EXIT = 1, + ONLY_THIS_PROCESS = 2 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugRegSrc.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugRegSrc.cs new file mode 100644 index 0000000000..536e310d45 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugRegSrc.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_REGSRC : uint + { + DEBUGGEE = 0, + EXPLICIT = 1, + FRAME = 2 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugRegister.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugRegister.cs new file mode 100644 index 0000000000..8c10c119bc --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugRegister.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_REGISTER : uint + { + SUB_REGISTER = 1 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugRegisters.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugRegisters.cs new file mode 100644 index 0000000000..f312439393 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugRegisters.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_REGISTERS : uint + { + DEFAULT = 0, + INT32 = 1, + INT64 = 2, + FLOAT = 4, + ALL = 7 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugRequest.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugRequest.cs new file mode 100644 index 0000000000..2c0b57e48b --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugRequest.cs @@ -0,0 +1,221 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_REQUEST : uint + { + /// + /// InBuffer - Unused. + /// OutBuffer - Unused. + /// + SOURCE_PATH_HAS_SOURCE_SERVER = 0, + + /// + /// InBuffer - Unused. + /// OutBuffer - Machine-specific CONTEXT. + /// + TARGET_EXCEPTION_CONTEXT = 1, + + /// + /// InBuffer - Unused. + /// OutBuffer - ULONG system ID of thread. + /// + TARGET_EXCEPTION_THREAD = 2, + + /// + /// InBuffer - Unused. + /// OutBuffer - EXCEPTION_RECORD64. + /// + TARGET_EXCEPTION_RECORD = 3, + + /// + /// InBuffer - Unused. + /// OutBuffer - DEBUG_CREATE_PROCESS_OPTIONS. + /// + GET_ADDITIONAL_CREATE_OPTIONS = 4, + + /// + /// InBuffer - DEBUG_CREATE_PROCESS_OPTIONS. + /// OutBuffer - Unused. + /// + SET_ADDITIONAL_CREATE_OPTIONS = 5, + + /// + /// InBuffer - Unused. + /// OutBuffer - ULONG[2] major/minor. + /// + GET_WIN32_MAJOR_MINOR_VERSIONS = 6, + + /// + /// InBuffer - DEBUG_READ_USER_MINIDUMP_STREAM. + /// OutBuffer - Unused. + /// + READ_USER_MINIDUMP_STREAM = 7, + + /// + /// InBuffer - Unused. + /// OutBuffer - Unused. + /// + TARGET_CAN_DETACH = 8, + + /// + /// InBuffer - PTSTR. + /// OutBuffer - Unused. + /// + SET_LOCAL_IMPLICIT_COMMAND_LINE = 9, + + /// + /// InBuffer - Unused. + /// OutBuffer - Event code stream offset. + /// + GET_CAPTURED_EVENT_CODE_OFFSET = 10, + + /// + /// InBuffer - Unused. + /// OutBuffer - Event code stream information. + /// + READ_CAPTURED_EVENT_CODE_STREAM = 11, + + /// + /// InBuffer - Input data block. + /// OutBuffer - Processed data block. + /// + EXT_TYPED_DATA_ANSI = 12, + + /// + /// InBuffer - Unused. + /// OutBuffer - Returned path. + /// + GET_EXTENSION_SEARCH_PATH_WIDE = 13, + + /// + /// InBuffer - DEBUG_GET_TEXT_COMPLETIONS_IN. + /// OutBuffer - DEBUG_GET_TEXT_COMPLETIONS_OUT. + /// + GET_TEXT_COMPLETIONS_WIDE = 14, + + /// + /// InBuffer - ULONG64 cookie. + /// OutBuffer - DEBUG_CACHED_SYMBOL_INFO. + /// + GET_CACHED_SYMBOL_INFO = 15, + + /// + /// InBuffer - DEBUG_CACHED_SYMBOL_INFO. + /// OutBuffer - ULONG64 cookie. + /// + ADD_CACHED_SYMBOL_INFO = 16, + + /// + /// InBuffer - ULONG64 cookie. + /// OutBuffer - Unused. + /// + REMOVE_CACHED_SYMBOL_INFO = 17, + + /// + /// InBuffer - DEBUG_GET_TEXT_COMPLETIONS_IN. + /// OutBuffer - DEBUG_GET_TEXT_COMPLETIONS_OUT. + /// + GET_TEXT_COMPLETIONS_ANSI = 18, + + /// + /// InBuffer - Unused. + /// OutBuffer - Unused. + /// + CURRENT_OUTPUT_CALLBACKS_ARE_DML_AWARE = 19, + + /// + /// InBuffer - ULONG64 offset. + /// OutBuffer - Unwind information. + /// + GET_OFFSET_UNWIND_INFORMATION = 20, + + /// + /// InBuffer - Unused + /// OutBuffer - returned DUMP_HEADER32/DUMP_HEADER64 structure. + /// + GET_DUMP_HEADER = 21, + + /// + /// InBuffer - DUMP_HEADER32/DUMP_HEADER64 structure. + /// OutBuffer - Unused + /// + SET_DUMP_HEADER = 22, + + /// + /// InBuffer - Midori specific + /// OutBuffer - Midori specific + /// + MIDORI = 23, + + /// + /// InBuffer - Unused + /// OutBuffer - PROCESS_NAME_ENTRY blocks + /// + PROCESS_DESCRIPTORS = 24, + + /// + /// InBuffer - Unused + /// OutBuffer - MINIDUMP_MISC_INFO_N blocks + /// + MISC_INFORMATION = 25, + + /// + /// InBuffer - Unused + /// OutBuffer - ULONG64 as TokenHandle value + /// + OPEN_PROCESS_TOKEN = 26, + + /// + /// InBuffer - Unused + /// OutBuffer - ULONG64 as TokenHandle value + /// + OPEN_THREAD_TOKEN = 27, + + /// + /// InBuffer - ULONG64 as TokenHandle being duplicated + /// OutBuffer - ULONG64 as new duplicated TokenHandle + /// + DUPLICATE_TOKEN = 28, + + /// + /// InBuffer - a ULONG64 as TokenHandle and a ULONG as NtQueryInformationToken() request code + /// OutBuffer - NtQueryInformationToken() return + /// + QUERY_INFO_TOKEN = 29, + + /// + /// InBuffer - ULONG64 as TokenHandle + /// OutBuffer - Unused + /// + CLOSE_TOKEN = 30, + + /// + /// InBuffer - ULONG64 for process server identification and ULONG as PID + /// OutBuffer - Unused + /// + WOW_PROCESS = 31, + + /// + /// InBuffer - ULONG64 for process server identification and PWSTR as module path + /// OutBuffer - Unused + /// + WOW_MODULE = 32, + + /// + /// InBuffer - Unused + /// OutBuffer - Unused + /// return - S_OK if non-invasive user-mode attach, S_FALSE if not (but still live user-mode), E_FAIL otherwise. + /// + LIVE_USER_NON_INVASIVE = 33, + + /// + /// InBuffer - TID + /// OutBuffer - Unused + /// return - ResumeThreads() return. + /// + RESUME_THREAD = 34 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugScopeGroup.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugScopeGroup.cs new file mode 100644 index 0000000000..fef6444123 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugScopeGroup.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_SCOPE_GROUP : uint + { + ARGUMENTS = 1, + LOCALS = 2, + ALL = 3 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugServers.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugServers.cs new file mode 100644 index 0000000000..9d37ff421c --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugServers.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_SERVERS : uint + { + DEBUGGER = 1, + PROCESS = 2, + ALL = 3 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSession.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSession.cs new file mode 100644 index 0000000000..e69cf6557c --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSession.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_SESSION : uint + { + ACTIVE = 0, + END_SESSION_ACTIVE_TERMINATE = 1, + END_SESSION_ACTIVE_DETACH = 2, + END_SESSION_PASSIVE = 3, + END = 4, + REBOOT = 5, + HIBERNATE = 6, + FAILURE = 7 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSource.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSource.cs new file mode 100644 index 0000000000..444f853c16 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSource.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_SOURCE : uint + { + IS_STATEMENT = 1 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSrcFile.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSrcFile.cs new file mode 100644 index 0000000000..d97c5bbcd6 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSrcFile.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_SRCFILE : uint + { + SYMBOL_TOKEN = 0, + SYMBOL_TOKEN_SOURCE_COMMAND_WIDE = 1 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugStackcs.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugStackcs.cs new file mode 100644 index 0000000000..c1c9fd2741 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugStackcs.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_STACK : uint + { + ARGUMENTS = 0x1, + FUNCTION_INFO = 0x2, + SOURCE_LINE = 0x4, + FRAME_ADDRESSES = 0x8, + COLUMN_NAMES = 0x10, + NONVOLATILE_REGISTERS = 0x20, + FRAME_NUMBERS = 0x40, + PARAMETERS = 0x80, + FRAME_ADDRESSES_RA_ONLY = 0x100, + FRAME_MEMORY_USAGE = 0x200, + PARAMETERS_NEWLINE = 0x400, + DML = 0x800, + FRAME_OFFSETS = 0x1000 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugStatus.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugStatus.cs new file mode 100644 index 0000000000..09ac6a0ee1 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugStatus.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_STATUS : uint + { + NO_CHANGE = 0, + GO = 1, + GO_HANDLED = 2, + GO_NOT_HANDLED = 3, + STEP_OVER = 4, + STEP_INTO = 5, + BREAK = 6, + NO_DEBUGGEE = 7, + STEP_BRANCH = 8, + IGNORE_EVENT = 9, + RESTART_REQUESTED = 10, + REVERSE_GO = 11, + REVERSE_STEP_BRANCH = 12, + REVERSE_STEP_OVER = 13, + REVERSE_STEP_INTO = 14, + OUT_OF_SYNC = 15, + WAIT_INPUT = 16, + TIMEOUT = 17, + MASK = 0x1f + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugStatusFlags.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugStatusFlags.cs new file mode 100644 index 0000000000..91dba8b981 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugStatusFlags.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_STATUS_FLAGS : ulong + { + /// + /// This bit is added in DEBUG_CES_EXECUTION_STATUS notifications when the + /// engines execution status is changing due to operations performed during a + /// wait, such as making synchronous callbacks. If the bit is not set the + /// execution status is changing due to a wait being satisfied. + /// + INSIDE_WAIT = 0x100000000, + + /// + /// This bit is added in DEBUG_CES_EXECUTION_STATUS notifications when the + /// engines execution status update is coming after a wait has timed-out. It + /// indicates that the execution status change was not due to an actual event. + /// + WAIT_TIMEOUT = 0x200000000 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSymInfo.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSymInfo.cs new file mode 100644 index 0000000000..1bad3213f7 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSymInfo.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_SYMINFO : uint + { + BREAKPOINT_SOURCE_LINE = 0, + IMAGEHLP_MODULEW64 = 1, + GET_SYMBOL_NAME_BY_OFFSET_AND_TAG_WIDE = 2, + GET_MODULE_SYMBOL_NAMES_AND_OFFSETS = 3 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSymType.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSymType.cs new file mode 100644 index 0000000000..69a7cc35ae --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSymType.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_SYMTYPE : uint + { + NONE = 0, + COFF = 1, + CODEVIEW = 2, + PDB = 3, + EXPORT = 4, + DEFERRED = 5, + SYM = 6, + DIA = 7 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSymbol.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSymbol.cs new file mode 100644 index 0000000000..73c872f089 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSymbol.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_SYMBOL : uint + { + EXPANSION_LEVEL_MASK = 0xf, + EXPANDED = 0x10, + READ_ONLY = 0x20, + IS_ARRAY = 0x40, + IS_FLOAT = 0x80, + IS_ARGUMENT = 0x100, + IS_LOCAL = 0x200 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSysObjInfo.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSysObjInfo.cs new file mode 100644 index 0000000000..321ef3c248 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSysObjInfo.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_SYSOBJINFO : uint + { + THREAD_BASIC_INFORMATION = 0, + THREAD_NAME_WIDE = 1, + CURRENT_PROCESS_COOKIE = 2 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSysVerStr.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSysVerStr.cs new file mode 100644 index 0000000000..63f29211eb --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugSysVerStr.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_SYSVERSTR : uint + { + SERVICE_PACK = 0, + BUILD = 1 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugTbInfo.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugTbInfo.cs new file mode 100644 index 0000000000..1b345ba4f9 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugTbInfo.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_TBINFO : uint + { + NONE = 0, + EXIT_STATUS = 1, + PRIORITY_CLASS = 2, + PRIORITY = 4, + TIMES = 8, + START_OFFSET = 0x10, + AFFINITY = 0x20, + ALL = 0x3f + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugTypeOpts.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugTypeOpts.cs new file mode 100644 index 0000000000..961fd8fd57 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugTypeOpts.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_TYPEOPTS : uint + { + UNICODE_DISPLAY = 1, + LONGSTATUS_DISPLAY = 2, + FORCERADIX_OUTPUT = 4, + MATCH_MAXSIZE = 8 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugVSearch.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugVSearch.cs new file mode 100644 index 0000000000..8caf1540e6 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugVSearch.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_VSEARCH : uint + { + DEFAULT = 0, + WRITABLE_ONLY = 1 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugVSource.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugVSource.cs new file mode 100644 index 0000000000..3dde3f802a --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugVSource.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_VSOURCE : uint + { + INVALID = 0, + DEBUGGEE = 1, + MAPPED_IMAGE = 2, + DUMP_WITHOUT_MEMINFO = 3 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugValueType.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugValueType.cs new file mode 100644 index 0000000000..c3b65ebed4 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugValueType.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum DEBUG_VALUE_TYPE : uint + { + INVALID = 0, + INT8 = 1, + INT16 = 2, + INT32 = 3, + INT64 = 4, + FLOAT32 = 5, + FLOAT64 = 6, + FLOAT80 = 7, + FLOAT82 = 8, + FLOAT128 = 9, + VECTOR64 = 10, + VECTOR128 = 11, + TYPES = 12 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugWait.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugWait.cs new file mode 100644 index 0000000000..dad888dffa --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/DebugWait.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum DEBUG_WAIT : uint + { + DEFAULT = 0 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ECreationDisposition.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ECreationDisposition.cs new file mode 100644 index 0000000000..dbc96de539 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ECreationDisposition.cs @@ -0,0 +1,38 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum ECreationDisposition : uint + { + /// + /// Creates a new file. The function fails if a specified file exists. + /// + New = 1, + + /// + /// Creates a new file, always. + /// If a file exists, the function overwrites the file, clears the existing attributes, combines the specified file attributes, + /// and flags with FILE_ATTRIBUTE_ARCHIVE, but does not set the security descriptor that the SECURITY_ATTRIBUTES structure specifies. + /// + CreateAlways = 2, + + /// + /// Opens a file. The function fails if the file does not exist. + /// + OpenExisting = 3, + + /// + /// Opens a file, always. + /// If a file does not exist, the function creates a file as if dwCreationDisposition is CREATE_NEW. + /// + OpenAlways = 4, + + /// + /// Opens a file and truncates it so that its size is 0 (zero) bytes. The function fails if the file does not exist. + /// The calling process must open the file with the GENERIC_WRITE access right. + /// + TruncateExisting = 5 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/EFileAccess.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/EFileAccess.cs new file mode 100644 index 0000000000..d5ee3be09a --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/EFileAccess.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum EFileAccess : uint + { + None = 0x00000000, + GenericRead = 0x80000000, + GenericWrite = 0x40000000, + GenericExecute = 0x20000000, + GenericAll = 0x10000000 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/EFileAttributes.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/EFileAttributes.cs new file mode 100644 index 0000000000..bfbd99b6e5 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/EFileAttributes.cs @@ -0,0 +1,38 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum EFileAttributes : uint + { + Readonly = 0x00000001, + Hidden = 0x00000002, + System = 0x00000004, + Directory = 0x00000010, + Archive = 0x00000020, + Device = 0x00000040, + Normal = 0x00000080, + Temporary = 0x00000100, + SparseFile = 0x00000200, + ReparsePoint = 0x00000400, + Compressed = 0x00000800, + Offline = 0x00001000, + NotContentIndexed = 0x00002000, + Encrypted = 0x00004000, + Write_Through = 0x80000000, + Overlapped = 0x40000000, + NoBuffering = 0x20000000, + RandomAccess = 0x10000000, + SequentialScan = 0x08000000, + DeleteOnClose = 0x04000000, + BackupSemantics = 0x02000000, + PosixSemantics = 0x01000000, + OpenReparsePoint = 0x00200000, + OpenNoRecall = 0x00100000, + FirstPipeInstance = 0x00080000 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/EFileShare.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/EFileShare.cs new file mode 100644 index 0000000000..703a008ff0 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/EFileShare.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum EFileShare : uint + { + None = 0x00000000, + Read = 0x00000001, + Write = 0x00000002, + Delete = 0x00000004 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ErrorLevel.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ErrorLevel.cs new file mode 100644 index 0000000000..2b330a16d3 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ErrorLevel.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum ERROR_LEVEL + { + ERROR = 1, + MINORERROR = 2, + WARNING = 3 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ExtTdop.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ExtTdop.cs new file mode 100644 index 0000000000..9b47784541 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ExtTdop.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum _EXT_TDOP + { + EXT_TDOP_COPY, + EXT_TDOP_RELEASE, + EXT_TDOP_SET_FROM_EXPR, + EXT_TDOP_SET_FROM_U64_EXPR, + EXT_TDOP_GET_FIELD, + EXT_TDOP_EVALUATE, + EXT_TDOP_GET_TYPE_NAME, + EXT_TDOP_OUTPUT_TYPE_NAME, + EXT_TDOP_OUTPUT_SIMPLE_VALUE, + EXT_TDOP_OUTPUT_FULL_VALUE, + EXT_TDOP_HAS_FIELD, + EXT_TDOP_GET_FIELD_OFFSET, + EXT_TDOP_GET_ARRAY_ELEMENT, + EXT_TDOP_GET_DEREFERENCE, + EXT_TDOP_GET_TYPE_SIZE, + EXT_TDOP_OUTPUT_TYPE_DEFINITION, + EXT_TDOP_GET_POINTER_TO, + EXT_TDOP_SET_FROM_TYPE_ID_AND_U64, + EXT_TDOP_SET_PTR_FROM_TYPE_ID_AND_U64, + EXT_TDOP_COUNT + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/FormatMessage.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/FormatMessage.cs new file mode 100644 index 0000000000..d281cf9f9b --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/FormatMessage.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum FORMAT_MESSAGE + { + ALLOCATE_BUFFER = 0x0100, + IGNORE_INSERTS = 0x0200, + FROM_STRING = 0x0400, + FROM_HMODULE = 0x0800, + FROM_SYSTEM = 0x1000, + ARGUMENT_ARRAY = 0x2000 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/IG.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/IG.cs new file mode 100644 index 0000000000..2c15808415 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/IG.cs @@ -0,0 +1,60 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum IG : ushort + { + KD_CONTEXT = 1, + READ_CONTROL_SPACE = 2, + WRITE_CONTROL_SPACE = 3, + READ_IO_SPACE = 4, + WRITE_IO_SPACE = 5, + READ_PHYSICAL = 6, + WRITE_PHYSICAL = 7, + READ_IO_SPACE_EX = 8, + WRITE_IO_SPACE_EX = 9, + KSTACK_HELP = 10, // obsolete + SET_THREAD = 11, + READ_MSR = 12, + WRITE_MSR = 13, + GET_DEBUGGER_DATA = 14, + GET_KERNEL_VERSION = 15, + RELOAD_SYMBOLS = 16, + GET_SET_SYMPATH = 17, + GET_EXCEPTION_RECORD = 18, + IS_PTR64 = 19, + GET_BUS_DATA = 20, + SET_BUS_DATA = 21, + DUMP_SYMBOL_INFO = 22, + LOWMEM_CHECK = 23, + SEARCH_MEMORY = 24, + GET_CURRENT_THREAD = 25, + GET_CURRENT_PROCESS = 26, + GET_TYPE_SIZE = 27, + GET_CURRENT_PROCESS_HANDLE = 28, + GET_INPUT_LINE = 29, + GET_EXPRESSION_EX = 30, + TRANSLATE_VIRTUAL_TO_PHYSICAL = 31, + GET_CACHE_SIZE = 32, + READ_PHYSICAL_WITH_FLAGS = 33, + WRITE_PHYSICAL_WITH_FLAGS = 34, + POINTER_SEARCH_PHYSICAL = 35, + OBSOLETE_PLACEHOLDER_36 = 36, + GET_THREAD_OS_INFO = 37, + GET_CLR_DATA_INTERFACE = 38, + MATCH_PATTERN_A = 39, + FIND_FILE = 40, + TYPED_DATA_OBSOLETE = 41, + QUERY_TARGET_INTERFACE = 42, + TYPED_DATA = 43, + DISASSEMBLE_BUFFER = 44, + GET_ANY_MODULE_IN_RANGE = 45, + VIRTUAL_TO_PHYSICAL = 46, + PHYSICAL_TO_VIRTUAL = 47, + GET_CONTEXT_EX = 48, + GET_TEB_ADDRESS = 128, + GET_PEB_ADDRESS = 129 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ImageFileMachine.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ImageFileMachine.cs new file mode 100644 index 0000000000..068f309def --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ImageFileMachine.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum IMAGE_FILE_MACHINE : uint + { + UNKNOWN = 0, + I386 = 0x014c, // Intel 386. + R3000 = 0x0162, // MIPS little-endian, 0x160 big-endian + R4000 = 0x0166, // MIPS little-endian + R10000 = 0x0168, // MIPS little-endian + WCEMIPSV2 = 0x0169, // MIPS little-endian WCE v2 + ALPHA = 0x0184, // Alpha_AXP + SH3 = 0x01a2, // SH3 little-endian + SH3DSP = 0x01a3, + SH3E = 0x01a4, // SH3E little-endian + SH4 = 0x01a6, // SH4 little-endian + SH5 = 0x01a8, // SH5 + ARM = 0x01c0, // ARM Little-Endian + THUMB = 0x01c2, + THUMB2 = 0x1c4, + AM33 = 0x01d3, + POWERPC = 0x01F0, // IBM PowerPC Little-Endian + POWERPCFP = 0x01f1, + IA64 = 0x0200, // Intel 64 + MIPS16 = 0x0266, // MIPS + ALPHA64 = 0x0284, // ALPHA64 + MIPSFPU = 0x0366, // MIPS + MIPSFPU16 = 0x0466, // MIPS + AXP64 = 0x0284, + TRICORE = 0x0520, // Infineon + CEF = 0x0CEF, + EBC = 0x0EBC, // EFI Byte Code + AMD64 = 0x8664, // AMD64 (K8) + M32R = 0x9041, // M32R little-endian + ARM64 = 0xAA64, // ARM64 Little-endian + CEE = 0xC0EE + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/InterfaceType.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/InterfaceType.cs new file mode 100644 index 0000000000..2407aa01bb --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/InterfaceType.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum INTERFACE_TYPE + { + InterfaceTypeUndefined = -1, + Internal, + Isa, + Eisa, + MicroChannel, + TurboChannel, + PCIBus, + VMEBus, + NuBus, + PCMCIABus, + CBus, + MPIBus, + MPSABus, + ProcessorInternal, + InternalPowerBus, + PNPISABus, + PNPBus, + Vmcs, + MaximumInterfaceType + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/MEM.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/MEM.cs new file mode 100644 index 0000000000..76036d42ab --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/MEM.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum MEM : uint + { + COMMIT = 0x1000, + RESERVE = 0x2000, + DECOMMIT = 0x4000, + RELEASE = 0x8000, + FREE = 0x10000, + PRIVATE = 0x20000, + MAPPED = 0x40000, + RESET = 0x80000, + TOP_DOWN = 0x100000, + WRITE_WATCH = 0x200000, + PHYSICAL = 0x400000, + ROTATE = 0x800000, + LARGE_PAGES = 0x20000000, + FOURMB_PAGES = 0x80000000, + + IMAGE = SEC.IMAGE + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ModuleArchitecture.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ModuleArchitecture.cs new file mode 100644 index 0000000000..a03479d776 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ModuleArchitecture.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum MODULE_ARCHITECTURE + { + UNKNOWN, + I386, + X64, + IA64, + ANY + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ModuleOrders.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ModuleOrders.cs new file mode 100644 index 0000000000..d403837b01 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/ModuleOrders.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum MODULE_ORDERS : uint + { + MASK = 0xF0000000, + LOADTIME = 0x10000000, + MODULENAME = 0x20000000 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/Paage.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/Paage.cs new file mode 100644 index 0000000000..dcf0ffef9d --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/Paage.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum PAGE : uint + { + NOACCESS = 0x01, + READONLY = 0x02, + READWRITE = 0x04, + WRITECOPY = 0x08, + EXECUTE = 0x10, + EXECUTE_READ = 0x20, + EXECUTE_READWRITE = 0x40, + EXECUTE_WRITECOPY = 0x80, + GUARD = 0x100, + NOCACHE = 0x200, + WRITECOMBINE = 0x400 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/Sec.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/Sec.cs new file mode 100644 index 0000000000..7804fd4ad8 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/Sec.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum SEC : uint + { + FILE = 0x800000, + IMAGE = 0x1000000, + PROTECTED_IMAGE = 0x2000000, + RESERVE = 0x4000000, + COMMIT = 0x8000000, + NOCACHE = 0x10000000, + WRITECOMBINE = 0x40000000, + LARGE_PAGES = 0x80000000, + MEM_IMAGE = IMAGE + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/SpfMoveMethod.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/SpfMoveMethod.cs new file mode 100644 index 0000000000..24ce174147 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/SpfMoveMethod.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum SPF_MOVE_METHOD : uint + { + FILE_BEGIN = 0, + FILE_CURRENT = 1, + FILE_END = 2 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/SymOpt.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/SymOpt.cs new file mode 100644 index 0000000000..48837cc36c --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/SymOpt.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum SYMOPT : uint + { + CASE_INSENSITIVE = 0x00000001, + UNDNAME = 0x00000002, + DEFERRED_LOADS = 0x00000004, + NO_CPP = 0x00000008, + LOAD_LINES = 0x00000010, + OMAP_FIND_NEAREST = 0x00000020, + LOAD_ANYTHING = 0x00000040, + IGNORE_CVREC = 0x00000080, + NO_UNQUALIFIED_LOADS = 0x00000100, + FAIL_CRITICAL_ERRORS = 0x00000200, + EXACT_SYMBOLS = 0x00000400, + ALLOW_ABSOLUTE_SYMBOLS = 0x00000800, + IGNORE_NT_SYMPATH = 0x00001000, + INCLUDE_32BIT_MODULES = 0x00002000, + PUBLICS_ONLY = 0x00004000, + NO_PUBLICS = 0x00008000, + AUTO_PUBLICS = 0x00010000, + NO_IMAGE_SEARCH = 0x00020000, + SECURE = 0x00040000, + NO_PROMPTS = 0x00080000, + OVERWRITE = 0x00100000, + IGNORE_IMAGEDIR = 0x00200000, + FLAT_DIRECTORY = 0x00400000, + FAVOR_COMPRESSED = 0x00800000, + ALLOW_ZERO_ADDRESS = 0x01000000, + DISABLE_SYMSRV_AUTODETECT = 0x02000000, + DEBUG = 0x80000000 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/SymTag.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/SymTag.cs new file mode 100644 index 0000000000..65f0eff97e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/SymTag.cs @@ -0,0 +1,48 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace SOS.Hosting.DbgEng.Interop +{ + public enum SymTag : uint + { + Null, // 0 + Exe, // 1 + Compiland, // 2 + CompilandDetails, // 3 + CompilandEnv, // 4 + Function, // 5 + Block, // 6 + Data, // 7 + Annotation, // 8 + Label, // 9 + PublicSymbol, // 10 + UDT, // 11 + Enum, // 12 + FunctionType, // 13 + PointerType, // 14 + ArrayType, // 15 + BaseType, // 16 + Typedef, // 17 + BaseClass, // 18 + Friend, // 19 + FunctionArgType, // 20 + FuncDebugStart, // 21 + FuncDebugEnd, // 22 + UsingNamespace, // 23 + VTableShape, // 24 + VTable, // 25 + Custom, // 26 + Thunk, // 27 + CustomType, // 28 + ManagedType, // 29 + Dimension, // 30 + CallSite, // 31 + InlineSite, // 32 + BaseInterface, // 33 + VectorType, // 34 + MatrixType, // 35 + HLSLType, // 36 + SymTagMax + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/VsFF.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/VsFF.cs new file mode 100644 index 0000000000..04f937274b --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Enums/VsFF.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace SOS.Hosting.DbgEng.Interop +{ + [Flags] + public enum VS_FF : uint + { + DEBUG = 0x00000001, + PRERELEASE = 0x00000002, + PATCHED = 0x00000004, + PRIVATEBUILD = 0x00000008, + INFOINFERRED = 0x00000010, + SPECIALBUILD = 0x00000020 + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugAdvanced.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugAdvanced.cs new file mode 100644 index 0000000000..0ef6c98d88 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugAdvanced.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("f2df5f53-071f-47bd-9de6-5734c3fed689")] + public interface IDebugAdvanced + { + [PreserveSig] + int GetThreadContext( + IntPtr Context, + int ContextSize); + + [PreserveSig] + int SetThreadContext( + IntPtr Context, + int ContextSize); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugAdvanced2.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugAdvanced2.cs new file mode 100644 index 0000000000..1e1dad8b65 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugAdvanced2.cs @@ -0,0 +1,88 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("716d14c9-119b-4ba5-af1f-0890e672416a")] + public interface IDebugAdvanced2 : IDebugAdvanced + { + /* IDebugAdvanced */ + [PreserveSig] + new int GetThreadContext( + IntPtr Context, + int ContextSize); + + [PreserveSig] + new int SetThreadContext( + IntPtr Context, + int ContextSize); + + /* IDebugAdvanced2 */ + + [PreserveSig] + int Request( + DEBUG_REQUEST Request, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] inBuffer, + int InBufferSize, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] outBuffer, + int OutBufferSize, + out int OutSize); + + [PreserveSig] + int GetSourceFileInformation( + DEBUG_SRCFILE Which, + [In][MarshalAs(UnmanagedType.LPStr)] string SourceFile, + ulong Arg64, + uint Arg32, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + int BufferSize, + out int InfoSize); + + [PreserveSig] + int FindSourceFileAndToken( + uint StartElement, + ulong ModAddr, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + DEBUG_FIND_SOURCE Flags, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + int FileTokenSize, + out int FoundElement, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out int FoundSize); + + [PreserveSig] + int GetSymbolInformation( + DEBUG_SYMINFO Which, + ulong Arg64, + uint Arg32, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] buffer, + int BufferSize, + out int InfoSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder StringBuffer, + int StringBufferSize, + out int StringSize); + + [PreserveSig] + int GetSystemObjectInformation( + DEBUG_SYSOBJINFO Which, + ulong Arg64, + uint Arg32, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] buffer, + int BufferSize, + out int InfoSize); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugAdvanced3.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugAdvanced3.cs new file mode 100644 index 0000000000..d6ac82c95c --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugAdvanced3.cs @@ -0,0 +1,128 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("cba4abb4-84c4-444d-87ca-a04e13286739")] + public interface IDebugAdvanced3 : IDebugAdvanced2 + { + /* IDebugAdvanced */ + [PreserveSig] + new int GetThreadContext( + IntPtr Context, + int ContextSize); + + [PreserveSig] + new int SetThreadContext( + IntPtr Context, + int ContextSize); + + /* IDebugAdvanced2 */ + + [PreserveSig] + new int Request( + DEBUG_REQUEST Request, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] inBuffer, + int InBufferSize, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] outBuffer, + int OutBufferSize, + out int OutSize); + + [PreserveSig] + new int GetSourceFileInformation( + DEBUG_SRCFILE Which, + [In][MarshalAs(UnmanagedType.LPStr)] string SourceFile, + ulong Arg64, + uint Arg32, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + int BufferSize, + out int InfoSize); + + [PreserveSig] + new int FindSourceFileAndToken( + uint StartElement, + ulong ModAddr, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + DEBUG_FIND_SOURCE Flags, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + int FileTokenSize, + out int FoundElement, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out int FoundSize); + + [PreserveSig] + new int GetSymbolInformation( + DEBUG_SYMINFO Which, + ulong Arg64, + uint Arg32, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] buffer, + int BufferSize, + out int InfoSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder StringBuffer, + int StringBufferSize, + out int StringSize); + + [PreserveSig] + new int GetSystemObjectInformation( + DEBUG_SYSOBJINFO Which, + ulong Arg64, + uint Arg32, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] buffer, + int BufferSize, + out int InfoSize); + + /* IDebugAdvanced3 */ + + [PreserveSig] + int GetSourceFileInformationWide( + DEBUG_SRCFILE Which, + [In][MarshalAs(UnmanagedType.LPWStr)] string SourceFile, + ulong Arg64, + uint Arg32, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + int BufferSize, + out int InfoSize); + + [PreserveSig] + int FindSourceFileAndTokenWide( + uint StartElement, + ulong ModAddr, + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + DEBUG_FIND_SOURCE Flags, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + int FileTokenSize, + out int FoundElement, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out int FoundSize); + + [PreserveSig] + int GetSymbolInformationWide( + DEBUG_SYMINFO Which, + ulong Arg64, + uint Arg32, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] buffer, + int BufferSize, + out int InfoSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder StringBuffer, + int StringBufferSize, + out int StringSize); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugBreakpoint.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugBreakpoint.cs new file mode 100644 index 0000000000..534b0830b1 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugBreakpoint.cs @@ -0,0 +1,110 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("5bd9d474-5975-423a-b88b-65a8e7110e65")] + public interface IDebugBreakpoint + { + /* IDebugBreakpoint */ + + [PreserveSig] + int GetId( + out uint Id); + + [PreserveSig] + int GetType( + out DEBUG_BREAKPOINT_TYPE BreakType, + out uint ProcType); + + //FIX ME!!! Should try and get an enum for this + [PreserveSig] + int GetAdder( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugClient Adder); + + [PreserveSig] + int GetFlags( + out DEBUG_BREAKPOINT_FLAG Flags); + + [PreserveSig] + int AddFlags( + DEBUG_BREAKPOINT_FLAG Flags); + + [PreserveSig] + int RemoveFlags( + DEBUG_BREAKPOINT_FLAG Flags); + + [PreserveSig] + int SetFlags( + DEBUG_BREAKPOINT_FLAG Flags); + + [PreserveSig] + int GetOffset( + out ulong Offset); + + [PreserveSig] + int SetOffset( + ulong Offset); + + [PreserveSig] + int GetDataParameters( + out uint Size, + out DEBUG_BREAKPOINT_ACCESS_TYPE AccessType); + + [PreserveSig] + int SetDataParameters( + uint Size, + DEBUG_BREAKPOINT_ACCESS_TYPE AccessType); + + [PreserveSig] + int GetPassCount( + out uint Count); + + [PreserveSig] + int SetPassCount( + uint Count); + + [PreserveSig] + int GetCurrentPassCount( + out uint Count); + + [PreserveSig] + int GetMatchThreadId( + out uint Id); + + [PreserveSig] + int SetMatchThreadId( + uint Thread); + + [PreserveSig] + int GetCommand( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + int SetCommand( + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + int GetOffsetExpression( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ExpressionSize); + + [PreserveSig] + int SetOffsetExpression( + [In][MarshalAs(UnmanagedType.LPStr)] string Expression); + + [PreserveSig] + int GetParameters( + out DEBUG_BREAKPOINT_PARAMETERS Params); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugBreakpoint2.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugBreakpoint2.cs new file mode 100644 index 0000000000..faf2c8eeaa --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugBreakpoint2.cs @@ -0,0 +1,132 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("1b278d20-79f2-426e-a3f9-c1ddf375d48e")] + public interface IDebugBreakpoint2 : IDebugBreakpoint + { + /* IDebugBreakpoint */ + + [PreserveSig] + new int GetId( + out uint Id); + + [PreserveSig] + new int GetType( + out DEBUG_BREAKPOINT_TYPE BreakType, + out uint ProcType); + + //FIX ME!!! Should try and get an enum for this + [PreserveSig] + new int GetAdder( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugClient Adder); + + [PreserveSig] + new int GetFlags( + out DEBUG_BREAKPOINT_FLAG Flags); + + [PreserveSig] + new int AddFlags( + DEBUG_BREAKPOINT_FLAG Flags); + + [PreserveSig] + new int RemoveFlags( + DEBUG_BREAKPOINT_FLAG Flags); + + [PreserveSig] + new int SetFlags( + DEBUG_BREAKPOINT_FLAG Flags); + + [PreserveSig] + new int GetOffset( + out ulong Offset); + + [PreserveSig] + new int SetOffset( + ulong Offset); + + [PreserveSig] + new int GetDataParameters( + out uint Size, + out DEBUG_BREAKPOINT_ACCESS_TYPE AccessType); + + [PreserveSig] + new int SetDataParameters( + uint Size, + DEBUG_BREAKPOINT_ACCESS_TYPE AccessType); + + [PreserveSig] + new int GetPassCount( + out uint Count); + + [PreserveSig] + new int SetPassCount( + uint Count); + + [PreserveSig] + new int GetCurrentPassCount( + out uint Count); + + [PreserveSig] + new int GetMatchThreadId( + out uint Id); + + [PreserveSig] + new int SetMatchThreadId( + uint Thread); + + [PreserveSig] + new int GetCommand( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetCommand( + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + new int GetOffsetExpression( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ExpressionSize); + + [PreserveSig] + new int SetOffsetExpression( + [In][MarshalAs(UnmanagedType.LPStr)] string Expression); + + [PreserveSig] + new int GetParameters( + out DEBUG_BREAKPOINT_PARAMETERS Params); + + /* IDebugBreakpoint2 */ + + [PreserveSig] + int GetCommandWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + int SetCommandWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Command); + + [PreserveSig] + int GetOffsetExpressionWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint ExpressionSize); + + [PreserveSig] + int SetOffsetExpressionWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Command); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugBreakpoint3.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugBreakpoint3.cs new file mode 100644 index 0000000000..9e609f6b58 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugBreakpoint3.cs @@ -0,0 +1,138 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("38f5c249-b448-43bb-9835-579d4ec02249")] + public interface IDebugBreakpoint3 : IDebugBreakpoint2 + { + /* IDebugBreakpoint */ + + [PreserveSig] + new int GetId( + out uint Id); + + [PreserveSig] + new int GetType( + out DEBUG_BREAKPOINT_TYPE BreakType, + out uint ProcType); + + //FIX ME!!! Should try and get an enum for this + [PreserveSig] + new int GetAdder( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugClient Adder); + + [PreserveSig] + new int GetFlags( + out DEBUG_BREAKPOINT_FLAG Flags); + + [PreserveSig] + new int AddFlags( + DEBUG_BREAKPOINT_FLAG Flags); + + [PreserveSig] + new int RemoveFlags( + DEBUG_BREAKPOINT_FLAG Flags); + + [PreserveSig] + new int SetFlags( + DEBUG_BREAKPOINT_FLAG Flags); + + [PreserveSig] + new int GetOffset( + out ulong Offset); + + [PreserveSig] + new int SetOffset( + ulong Offset); + + [PreserveSig] + new int GetDataParameters( + out uint Size, + out DEBUG_BREAKPOINT_ACCESS_TYPE AccessType); + + [PreserveSig] + new int SetDataParameters( + uint Size, + DEBUG_BREAKPOINT_ACCESS_TYPE AccessType); + + [PreserveSig] + new int GetPassCount( + out uint Count); + + [PreserveSig] + new int SetPassCount( + uint Count); + + [PreserveSig] + new int GetCurrentPassCount( + out uint Count); + + [PreserveSig] + new int GetMatchThreadId( + out uint Id); + + [PreserveSig] + new int SetMatchThreadId( + uint Thread); + + [PreserveSig] + new int GetCommand( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetCommand( + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + new int GetOffsetExpression( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ExpressionSize); + + [PreserveSig] + new int SetOffsetExpression( + [In][MarshalAs(UnmanagedType.LPStr)] string Expression); + + [PreserveSig] + new int GetParameters( + out DEBUG_BREAKPOINT_PARAMETERS Params); + + /* IDebugBreakpoint2 */ + + [PreserveSig] + new int GetCommandWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetCommandWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Command); + + [PreserveSig] + new int GetOffsetExpressionWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint ExpressionSize); + + [PreserveSig] + new int SetOffsetExpressionWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Command); + + /* IDebugBreakpoint3 */ + + [PreserveSig] + int GetGuid(out Guid Guid); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient.cs new file mode 100644 index 0000000000..504392a362 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient.cs @@ -0,0 +1,250 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("27fe5639-8407-4f47-8364-ee118fb08ac8")] + public interface IDebugClient + { + /* IDebugClient */ + + [PreserveSig] + int AttachKernel( + DEBUG_ATTACH Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string ConnectOptions); + + [PreserveSig] + int GetKernelConnectionOptions( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint OptionsSize); + + [PreserveSig] + int SetKernelConnectionOptions( + [In][MarshalAs(UnmanagedType.LPStr)] string Options); + + [PreserveSig] + int StartProcessServer( + DEBUG_CLASS Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string Options, + IntPtr Reserved); + + [PreserveSig] + int ConnectProcessServer( + [In][MarshalAs(UnmanagedType.LPStr)] string RemoteOptions, + out ulong Server); + + [PreserveSig] + int DisconnectProcessServer( + ulong Server); + + [PreserveSig] + int GetRunningProcessSystemIds( + ulong Server, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] Ids, + uint Count, + out uint ActualCount); + + [PreserveSig] + int GetRunningProcessSystemIdByExecutableName( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string ExeName, + DEBUG_GET_PROC Flags, + out uint Id); + + [PreserveSig] + int GetRunningProcessDescription( + ulong Server, + uint SystemId, + DEBUG_PROC_DESC Flags, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ExeName, + int ExeNameSize, + out uint ActualExeNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Description, + int DescriptionSize, + out uint ActualDescriptionSize); + + [PreserveSig] + int AttachProcess( + ulong Server, + uint ProcessID, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + int CreateProcess( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + DEBUG_CREATE_PROCESS Flags); + + [PreserveSig] + int CreateProcessAndAttach( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + DEBUG_CREATE_PROCESS Flags, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + int GetProcessOptions( + out DEBUG_PROCESS Options); + + [PreserveSig] + int AddProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + int RemoveProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + int SetProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + int OpenDumpFile( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile); + + [PreserveSig] + int WriteDumpFile( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile, + DEBUG_DUMP Qualifier); + + [PreserveSig] + int ConnectSession( + DEBUG_CONNECT_SESSION Flags, + uint HistoryLimit); + + [PreserveSig] + int StartServer( + [In][MarshalAs(UnmanagedType.LPStr)] string Options); + + [PreserveSig] + int OutputServer( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Machine, + DEBUG_SERVERS Flags); + + [PreserveSig] + int TerminateProcesses(); + + [PreserveSig] + int DetachProcesses(); + + [PreserveSig] + int EndSession( + DEBUG_END Flags); + + [PreserveSig] + int GetExitCode( + out uint Code); + + [PreserveSig] + int DispatchCallbacks( + uint Timeout); + + [PreserveSig] + int ExitDispatch( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client); + + [PreserveSig] + int CreateClient( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugClient Client); + + [PreserveSig] + int GetInputCallbacks( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugInputCallbacks Callbacks); + + [PreserveSig] + int SetInputCallbacks( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugInputCallbacks Callbacks); + + /* GetOutputCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + int GetOutputCallbacks( + out IDebugOutputCallbacks Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + int SetOutputCallbacks( + [In] IDebugOutputCallbacks Callbacks); + + [PreserveSig] + int GetOutputMask( + out DEBUG_OUTPUT Mask); + + [PreserveSig] + int SetOutputMask( + DEBUG_OUTPUT Mask); + + [PreserveSig] + int GetOtherOutputMask( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client, + out DEBUG_OUTPUT Mask); + + [PreserveSig] + int SetOtherOutputMask( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client, + DEBUG_OUTPUT Mask); + + [PreserveSig] + int GetOutputWidth( + out uint Columns); + + [PreserveSig] + int SetOutputWidth( + uint Columns); + + [PreserveSig] + int GetOutputLinePrefix( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PrefixSize); + + [PreserveSig] + int SetOutputLinePrefix( + [In][MarshalAs(UnmanagedType.LPStr)] string Prefix); + + [PreserveSig] + int GetIdentity( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint IdentitySize); + + [PreserveSig] + int OutputIdentity( + DEBUG_OUTCTL OutputControl, + uint Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + /* GetEventCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + int GetEventCallbacks( + out IDebugEventCallbacks Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + int SetEventCallbacks( + [In] IDebugEventCallbacks Callbacks); + + [PreserveSig] + int FlushCallbacks(); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient2.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient2.cs new file mode 100644 index 0000000000..d5861e12a7 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient2.cs @@ -0,0 +1,284 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("edbed635-372e-4dab-bbfe-ed0d2f63be81")] + public interface IDebugClient2 : IDebugClient + { + /* IDebugClient */ + + [PreserveSig] + new int AttachKernel( + DEBUG_ATTACH Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string ConnectOptions); + + [PreserveSig] + new int GetKernelConnectionOptions( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint OptionsSize); + + [PreserveSig] + new int SetKernelConnectionOptions( + [In][MarshalAs(UnmanagedType.LPStr)] string Options); + + [PreserveSig] + new int StartProcessServer( + DEBUG_CLASS Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string Options, + IntPtr Reserved); + + [PreserveSig] + new int ConnectProcessServer( + [In][MarshalAs(UnmanagedType.LPStr)] string RemoteOptions, + out ulong Server); + + [PreserveSig] + new int DisconnectProcessServer( + ulong Server); + + [PreserveSig] + new int GetRunningProcessSystemIds( + ulong Server, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] Ids, + uint Count, + out uint ActualCount); + + [PreserveSig] + new int GetRunningProcessSystemIdByExecutableName( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string ExeName, + DEBUG_GET_PROC Flags, + out uint Id); + + [PreserveSig] + new int GetRunningProcessDescription( + ulong Server, + uint SystemId, + DEBUG_PROC_DESC Flags, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ExeName, + int ExeNameSize, + out uint ActualExeNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Description, + int DescriptionSize, + out uint ActualDescriptionSize); + + [PreserveSig] + new int AttachProcess( + ulong Server, + uint ProcessID, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + new int CreateProcess( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + DEBUG_CREATE_PROCESS Flags); + + [PreserveSig] + new int CreateProcessAndAttach( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + DEBUG_CREATE_PROCESS Flags, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + new int GetProcessOptions( + out DEBUG_PROCESS Options); + + [PreserveSig] + new int AddProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int RemoveProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int SetProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int OpenDumpFile( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile); + + [PreserveSig] + new int WriteDumpFile( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile, + DEBUG_DUMP Qualifier); + + [PreserveSig] + new int ConnectSession( + DEBUG_CONNECT_SESSION Flags, + uint HistoryLimit); + + [PreserveSig] + new int StartServer( + [In][MarshalAs(UnmanagedType.LPStr)] string Options); + + [PreserveSig] + new int OutputServer( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Machine, + DEBUG_SERVERS Flags); + + [PreserveSig] + new int TerminateProcesses(); + + [PreserveSig] + new int DetachProcesses(); + + [PreserveSig] + new int EndSession( + DEBUG_END Flags); + + [PreserveSig] + new int GetExitCode( + out uint Code); + + [PreserveSig] + new int DispatchCallbacks( + uint Timeout); + + [PreserveSig] + new int ExitDispatch( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client); + + [PreserveSig] + new int CreateClient( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugClient Client); + + [PreserveSig] + new int GetInputCallbacks( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugInputCallbacks Callbacks); + + [PreserveSig] + new int SetInputCallbacks( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugInputCallbacks Callbacks); + + /* GetOutputCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + new int GetOutputCallbacks( + out IDebugOutputCallbacks Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + new int SetOutputCallbacks( + [In] IDebugOutputCallbacks Callbacks); + + [PreserveSig] + new int GetOutputMask( + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetOutputMask( + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int GetOtherOutputMask( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client, + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetOtherOutputMask( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client, + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int GetOutputWidth( + out uint Columns); + + [PreserveSig] + new int SetOutputWidth( + uint Columns); + + [PreserveSig] + new int GetOutputLinePrefix( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PrefixSize); + + [PreserveSig] + new int SetOutputLinePrefix( + [In][MarshalAs(UnmanagedType.LPStr)] string Prefix); + + [PreserveSig] + new int GetIdentity( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint IdentitySize); + + [PreserveSig] + new int OutputIdentity( + DEBUG_OUTCTL OutputControl, + uint Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + /* GetEventCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + new int GetEventCallbacks( + out IDebugEventCallbacks Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + new int SetEventCallbacks( + [In] IDebugEventCallbacks Callbacks); + + [PreserveSig] + new int FlushCallbacks(); + + /* IDebugClient2 */ + + [PreserveSig] + int WriteDumpFile2( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile, + DEBUG_DUMP Qualifier, + DEBUG_FORMAT FormatFlags, + [In][MarshalAs(UnmanagedType.LPStr)] string Comment); + + [PreserveSig] + int AddDumpInformationFile( + [In][MarshalAs(UnmanagedType.LPStr)] string InfoFile, + DEBUG_DUMP_FILE Type); + + [PreserveSig] + int EndProcessServer( + ulong Server); + + [PreserveSig] + int WaitForProcessServerEnd( + uint Timeout); + + [PreserveSig] + int IsKernelDebuggerEnabled(); + + [PreserveSig] + int TerminateCurrentProcess(); + + [PreserveSig] + int DetachCurrentProcess(); + + [PreserveSig] + int AbandonCurrentProcess(); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient3.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient3.cs new file mode 100644 index 0000000000..d5e658f3a8 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient3.cs @@ -0,0 +1,319 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("dd492d7f-71b8-4ad6-a8dc-1c887479ff91")] + public interface IDebugClient3 : IDebugClient2 + { + /* IDebugClient */ + + [PreserveSig] + new int AttachKernel( + DEBUG_ATTACH Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string ConnectOptions); + + [PreserveSig] + new int GetKernelConnectionOptions( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint OptionsSize); + + [PreserveSig] + new int SetKernelConnectionOptions( + [In][MarshalAs(UnmanagedType.LPStr)] string Options); + + [PreserveSig] + new int StartProcessServer( + DEBUG_CLASS Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string Options, + IntPtr Reserved); + + [PreserveSig] + new int ConnectProcessServer( + [In][MarshalAs(UnmanagedType.LPStr)] string RemoteOptions, + out ulong Server); + + [PreserveSig] + new int DisconnectProcessServer( + ulong Server); + + [PreserveSig] + new int GetRunningProcessSystemIds( + ulong Server, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] Ids, + uint Count, + out uint ActualCount); + + [PreserveSig] + new int GetRunningProcessSystemIdByExecutableName( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string ExeName, + DEBUG_GET_PROC Flags, + out uint Id); + + [PreserveSig] + new int GetRunningProcessDescription( + ulong Server, + uint SystemId, + DEBUG_PROC_DESC Flags, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ExeName, + int ExeNameSize, + out uint ActualExeNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Description, + int DescriptionSize, + out uint ActualDescriptionSize); + + [PreserveSig] + new int AttachProcess( + ulong Server, + uint ProcessID, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + new int CreateProcess( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + DEBUG_CREATE_PROCESS Flags); + + [PreserveSig] + new int CreateProcessAndAttach( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + DEBUG_CREATE_PROCESS Flags, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + new int GetProcessOptions( + out DEBUG_PROCESS Options); + + [PreserveSig] + new int AddProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int RemoveProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int SetProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int OpenDumpFile( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile); + + [PreserveSig] + new int WriteDumpFile( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile, + DEBUG_DUMP Qualifier); + + [PreserveSig] + new int ConnectSession( + DEBUG_CONNECT_SESSION Flags, + uint HistoryLimit); + + [PreserveSig] + new int StartServer( + [In][MarshalAs(UnmanagedType.LPStr)] string Options); + + [PreserveSig] + new int OutputServer( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Machine, + DEBUG_SERVERS Flags); + + [PreserveSig] + new int TerminateProcesses(); + + [PreserveSig] + new int DetachProcesses(); + + [PreserveSig] + new int EndSession( + DEBUG_END Flags); + + [PreserveSig] + new int GetExitCode( + out uint Code); + + [PreserveSig] + new int DispatchCallbacks( + uint Timeout); + + [PreserveSig] + new int ExitDispatch( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client); + + [PreserveSig] + new int CreateClient( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugClient Client); + + [PreserveSig] + new int GetInputCallbacks( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugInputCallbacks Callbacks); + + [PreserveSig] + new int SetInputCallbacks( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugInputCallbacks Callbacks); + + /* GetOutputCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + new int GetOutputCallbacks( + out IDebugOutputCallbacks Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + new int SetOutputCallbacks( + [In] IDebugOutputCallbacks Callbacks); + + [PreserveSig] + new int GetOutputMask( + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetOutputMask( + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int GetOtherOutputMask( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client, + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetOtherOutputMask( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client, + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int GetOutputWidth( + out uint Columns); + + [PreserveSig] + new int SetOutputWidth( + uint Columns); + + [PreserveSig] + new int GetOutputLinePrefix( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PrefixSize); + + [PreserveSig] + new int SetOutputLinePrefix( + [In][MarshalAs(UnmanagedType.LPStr)] string Prefix); + + [PreserveSig] + new int GetIdentity( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint IdentitySize); + + [PreserveSig] + new int OutputIdentity( + DEBUG_OUTCTL OutputControl, + uint Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + /* GetEventCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + new int GetEventCallbacks( + out IDebugEventCallbacks Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + new int SetEventCallbacks( + [In] IDebugEventCallbacks Callbacks); + + [PreserveSig] + new int FlushCallbacks(); + + /* IDebugClient2 */ + + [PreserveSig] + new int WriteDumpFile2( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile, + DEBUG_DUMP Qualifier, + DEBUG_FORMAT FormatFlags, + [In][MarshalAs(UnmanagedType.LPStr)] string Comment); + + [PreserveSig] + new int AddDumpInformationFile( + [In][MarshalAs(UnmanagedType.LPStr)] string InfoFile, + DEBUG_DUMP_FILE Type); + + [PreserveSig] + new int EndProcessServer( + ulong Server); + + [PreserveSig] + new int WaitForProcessServerEnd( + uint Timeout); + + [PreserveSig] + new int IsKernelDebuggerEnabled(); + + [PreserveSig] + new int TerminateCurrentProcess(); + + [PreserveSig] + new int DetachCurrentProcess(); + + [PreserveSig] + new int AbandonCurrentProcess(); + + /* IDebugClient3 */ + + [PreserveSig] + int GetRunningProcessSystemIdByExecutableNameWide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string ExeName, + DEBUG_GET_PROC Flags, + out uint Id); + + [PreserveSig] + int GetRunningProcessDescriptionWide( + ulong Server, + uint SystemId, + DEBUG_PROC_DESC Flags, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder ExeName, + int ExeNameSize, + out uint ActualExeNameSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Description, + int DescriptionSize, + out uint ActualDescriptionSize); + + [PreserveSig] + int CreateProcessWide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandLine, + DEBUG_CREATE_PROCESS CreateFlags); + + [PreserveSig] + int CreateProcessAndAttachWide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandLine, + DEBUG_CREATE_PROCESS CreateFlags, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient4.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient4.cs new file mode 100644 index 0000000000..a9a8dae371 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient4.cs @@ -0,0 +1,362 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("ca83c3de-5089-4cf8-93c8-d892387f2a5e")] + public interface IDebugClient4 : IDebugClient3 + { + /* IDebugClient */ + + [PreserveSig] + new int AttachKernel( + DEBUG_ATTACH Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string ConnectOptions); + + [PreserveSig] + new int GetKernelConnectionOptions( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint OptionsSize); + + [PreserveSig] + new int SetKernelConnectionOptions( + [In][MarshalAs(UnmanagedType.LPStr)] string Options); + + [PreserveSig] + new int StartProcessServer( + DEBUG_CLASS Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string Options, + IntPtr Reserved); + + [PreserveSig] + new int ConnectProcessServer( + [In][MarshalAs(UnmanagedType.LPStr)] string RemoteOptions, + out ulong Server); + + [PreserveSig] + new int DisconnectProcessServer( + ulong Server); + + [PreserveSig] + new int GetRunningProcessSystemIds( + ulong Server, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] Ids, + uint Count, + out uint ActualCount); + + [PreserveSig] + new int GetRunningProcessSystemIdByExecutableName( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string ExeName, + DEBUG_GET_PROC Flags, + out uint Id); + + [PreserveSig] + new int GetRunningProcessDescription( + ulong Server, + uint SystemId, + DEBUG_PROC_DESC Flags, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ExeName, + int ExeNameSize, + out uint ActualExeNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Description, + int DescriptionSize, + out uint ActualDescriptionSize); + + [PreserveSig] + new int AttachProcess( + ulong Server, + uint ProcessID, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + new int CreateProcess( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + DEBUG_CREATE_PROCESS Flags); + + [PreserveSig] + new int CreateProcessAndAttach( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + DEBUG_CREATE_PROCESS Flags, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + new int GetProcessOptions( + out DEBUG_PROCESS Options); + + [PreserveSig] + new int AddProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int RemoveProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int SetProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int OpenDumpFile( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile); + + [PreserveSig] + new int WriteDumpFile( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile, + DEBUG_DUMP Qualifier); + + [PreserveSig] + new int ConnectSession( + DEBUG_CONNECT_SESSION Flags, + uint HistoryLimit); + + [PreserveSig] + new int StartServer( + [In][MarshalAs(UnmanagedType.LPStr)] string Options); + + [PreserveSig] + new int OutputServer( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Machine, + DEBUG_SERVERS Flags); + + [PreserveSig] + new int TerminateProcesses(); + + [PreserveSig] + new int DetachProcesses(); + + [PreserveSig] + new int EndSession( + DEBUG_END Flags); + + [PreserveSig] + new int GetExitCode( + out uint Code); + + [PreserveSig] + new int DispatchCallbacks( + uint Timeout); + + [PreserveSig] + new int ExitDispatch( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client); + + [PreserveSig] + new int CreateClient( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugClient Client); + + [PreserveSig] + new int GetInputCallbacks( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugInputCallbacks Callbacks); + + [PreserveSig] + new int SetInputCallbacks( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugInputCallbacks Callbacks); + + /* GetOutputCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + new int GetOutputCallbacks( + out IDebugOutputCallbacks Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + new int SetOutputCallbacks( + [In] IDebugOutputCallbacks Callbacks); + + [PreserveSig] + new int GetOutputMask( + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetOutputMask( + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int GetOtherOutputMask( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client, + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetOtherOutputMask( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client, + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int GetOutputWidth( + out uint Columns); + + [PreserveSig] + new int SetOutputWidth( + uint Columns); + + [PreserveSig] + new int GetOutputLinePrefix( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PrefixSize); + + [PreserveSig] + new int SetOutputLinePrefix( + [In][MarshalAs(UnmanagedType.LPStr)] string Prefix); + + [PreserveSig] + new int GetIdentity( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint IdentitySize); + + [PreserveSig] + new int OutputIdentity( + DEBUG_OUTCTL OutputControl, + uint Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + /* GetEventCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + new int GetEventCallbacks( + out IDebugEventCallbacks Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + new int SetEventCallbacks( + [In] IDebugEventCallbacks Callbacks); + + [PreserveSig] + new int FlushCallbacks(); + + /* IDebugClient2 */ + + [PreserveSig] + new int WriteDumpFile2( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile, + DEBUG_DUMP Qualifier, + DEBUG_FORMAT FormatFlags, + [In][MarshalAs(UnmanagedType.LPStr)] string Comment); + + [PreserveSig] + new int AddDumpInformationFile( + [In][MarshalAs(UnmanagedType.LPStr)] string InfoFile, + DEBUG_DUMP_FILE Type); + + [PreserveSig] + new int EndProcessServer( + ulong Server); + + [PreserveSig] + new int WaitForProcessServerEnd( + uint Timeout); + + [PreserveSig] + new int IsKernelDebuggerEnabled(); + + [PreserveSig] + new int TerminateCurrentProcess(); + + [PreserveSig] + new int DetachCurrentProcess(); + + [PreserveSig] + new int AbandonCurrentProcess(); + + /* IDebugClient3 */ + + [PreserveSig] + new int GetRunningProcessSystemIdByExecutableNameWide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string ExeName, + DEBUG_GET_PROC Flags, + out uint Id); + + [PreserveSig] + new int GetRunningProcessDescriptionWide( + ulong Server, + uint SystemId, + DEBUG_PROC_DESC Flags, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder ExeName, + int ExeNameSize, + out uint ActualExeNameSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Description, + int DescriptionSize, + out uint ActualDescriptionSize); + + [PreserveSig] + new int CreateProcessWide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandLine, + DEBUG_CREATE_PROCESS CreateFlags); + + [PreserveSig] + new int CreateProcessAndAttachWide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandLine, + DEBUG_CREATE_PROCESS CreateFlags, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + + /* IDebugClient4 */ + + [PreserveSig] + int OpenDumpFileWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string FileName, + ulong FileHandle); + + [PreserveSig] + int WriteDumpFileWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string DumpFile, + ulong FileHandle, + DEBUG_DUMP Qualifier, + DEBUG_FORMAT FormatFlags, + [In][MarshalAs(UnmanagedType.LPWStr)] string Comment); + + [PreserveSig] + int AddDumpInformationFileWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string FileName, + ulong FileHandle, + DEBUG_DUMP_FILE Type); + + [PreserveSig] + int GetNumberDumpFiles( + out uint Number); + + [PreserveSig] + int GetDumpFile( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize, + out ulong Handle, + out uint Type); + + [PreserveSig] + int GetDumpFileWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize, + out ulong Handle, + out uint Type); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient5.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient5.cs new file mode 100644 index 0000000000..5b472feaf3 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient5.cs @@ -0,0 +1,533 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("e3acb9d7-7ec2-4f0c-a0da-e81e0cbbe628")] + public interface IDebugClient5 : IDebugClient4 + { + /* IDebugClient */ + + [PreserveSig] + new int AttachKernel( + DEBUG_ATTACH Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string ConnectOptions); + + [PreserveSig] + new int GetKernelConnectionOptions( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint OptionsSize); + + [PreserveSig] + new int SetKernelConnectionOptions( + [In][MarshalAs(UnmanagedType.LPStr)] string Options); + + [PreserveSig] + new int StartProcessServer( + DEBUG_CLASS Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string Options, + IntPtr Reserved); + + [PreserveSig] + new int ConnectProcessServer( + [In][MarshalAs(UnmanagedType.LPStr)] string RemoteOptions, + out ulong Server); + + [PreserveSig] + new int DisconnectProcessServer( + ulong Server); + + [PreserveSig] + new int GetRunningProcessSystemIds( + ulong Server, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] Ids, + uint Count, + out uint ActualCount); + + [PreserveSig] + new int GetRunningProcessSystemIdByExecutableName( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string ExeName, + DEBUG_GET_PROC Flags, + out uint Id); + + [PreserveSig] + new int GetRunningProcessDescription( + ulong Server, + uint SystemId, + DEBUG_PROC_DESC Flags, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ExeName, + int ExeNameSize, + out uint ActualExeNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Description, + int DescriptionSize, + out uint ActualDescriptionSize); + + [PreserveSig] + new int AttachProcess( + ulong Server, + uint ProcessID, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + new int CreateProcess( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + DEBUG_CREATE_PROCESS Flags); + + [PreserveSig] + new int CreateProcessAndAttach( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + DEBUG_CREATE_PROCESS Flags, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + new int GetProcessOptions( + out DEBUG_PROCESS Options); + + [PreserveSig] + new int AddProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int RemoveProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int SetProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int OpenDumpFile( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile); + + [PreserveSig] + new int WriteDumpFile( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile, + DEBUG_DUMP Qualifier); + + [PreserveSig] + new int ConnectSession( + DEBUG_CONNECT_SESSION Flags, + uint HistoryLimit); + + [PreserveSig] + new int StartServer( + [In][MarshalAs(UnmanagedType.LPStr)] string Options); + + [PreserveSig] + new int OutputServer( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Machine, + DEBUG_SERVERS Flags); + + [PreserveSig] + new int TerminateProcesses(); + + [PreserveSig] + new int DetachProcesses(); + + [PreserveSig] + new int EndSession( + DEBUG_END Flags); + + [PreserveSig] + new int GetExitCode( + out uint Code); + + [PreserveSig] + new int DispatchCallbacks( + uint Timeout); + + [PreserveSig] + new int ExitDispatch( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client); + + [PreserveSig] + new int CreateClient( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugClient Client); + + [PreserveSig] + new int GetInputCallbacks( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugInputCallbacks Callbacks); + + [PreserveSig] + new int SetInputCallbacks( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugInputCallbacks Callbacks); + + /* GetOutputCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + new int GetOutputCallbacks( + out IDebugOutputCallbacks Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + new int SetOutputCallbacks( + [In] IDebugOutputCallbacks Callbacks); + + [PreserveSig] + new int GetOutputMask( + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetOutputMask( + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int GetOtherOutputMask( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client, + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetOtherOutputMask( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client, + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int GetOutputWidth( + out uint Columns); + + [PreserveSig] + new int SetOutputWidth( + uint Columns); + + [PreserveSig] + new int GetOutputLinePrefix( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PrefixSize); + + [PreserveSig] + new int SetOutputLinePrefix( + [In][MarshalAs(UnmanagedType.LPStr)] string Prefix); + + [PreserveSig] + new int GetIdentity( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint IdentitySize); + + [PreserveSig] + new int OutputIdentity( + DEBUG_OUTCTL OutputControl, + uint Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + /* GetEventCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + new int GetEventCallbacks( + out IDebugEventCallbacks Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + new int SetEventCallbacks( + [In] IDebugEventCallbacks Callbacks); + + [PreserveSig] + new int FlushCallbacks(); + + /* IDebugClient2 */ + + [PreserveSig] + new int WriteDumpFile2( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile, + DEBUG_DUMP Qualifier, + DEBUG_FORMAT FormatFlags, + [In][MarshalAs(UnmanagedType.LPStr)] string Comment); + + [PreserveSig] + new int AddDumpInformationFile( + [In][MarshalAs(UnmanagedType.LPStr)] string InfoFile, + DEBUG_DUMP_FILE Type); + + [PreserveSig] + new int EndProcessServer( + ulong Server); + + [PreserveSig] + new int WaitForProcessServerEnd( + uint Timeout); + + [PreserveSig] + new int IsKernelDebuggerEnabled(); + + [PreserveSig] + new int TerminateCurrentProcess(); + + [PreserveSig] + new int DetachCurrentProcess(); + + [PreserveSig] + new int AbandonCurrentProcess(); + + /* IDebugClient3 */ + + [PreserveSig] + new int GetRunningProcessSystemIdByExecutableNameWide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string ExeName, + DEBUG_GET_PROC Flags, + out uint Id); + + [PreserveSig] + new int GetRunningProcessDescriptionWide( + ulong Server, + uint SystemId, + DEBUG_PROC_DESC Flags, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder ExeName, + int ExeNameSize, + out uint ActualExeNameSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Description, + int DescriptionSize, + out uint ActualDescriptionSize); + + [PreserveSig] + new int CreateProcessWide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandLine, + DEBUG_CREATE_PROCESS CreateFlags); + + [PreserveSig] + new int CreateProcessAndAttachWide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandLine, + DEBUG_CREATE_PROCESS CreateFlags, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + + /* IDebugClient4 */ + + [PreserveSig] + new int OpenDumpFileWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string FileName, + ulong FileHandle); + + [PreserveSig] + new int WriteDumpFileWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string DumpFile, + ulong FileHandle, + DEBUG_DUMP Qualifier, + DEBUG_FORMAT FormatFlags, + [In][MarshalAs(UnmanagedType.LPWStr)] string Comment); + + [PreserveSig] + new int AddDumpInformationFileWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string FileName, + ulong FileHandle, + DEBUG_DUMP_FILE Type); + + [PreserveSig] + new int GetNumberDumpFiles( + out uint Number); + + [PreserveSig] + new int GetDumpFile( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize, + out ulong Handle, + out uint Type); + + [PreserveSig] + new int GetDumpFileWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize, + out ulong Handle, + out uint Type); + + /* IDebugClient5 */ + + [PreserveSig] + int AttachKernelWide( + DEBUG_ATTACH Flags, + [In][MarshalAs(UnmanagedType.LPWStr)] string ConnectOptions); + + [PreserveSig] + int GetKernelConnectionOptionsWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint OptionsSize); + + [PreserveSig] + int SetKernelConnectionOptionsWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Options); + + [PreserveSig] + int StartProcessServerWide( + DEBUG_CLASS Flags, + [In][MarshalAs(UnmanagedType.LPWStr)] string Options, + IntPtr Reserved); + + [PreserveSig] + int ConnectProcessServerWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string RemoteOptions, + out ulong Server); + + [PreserveSig] + int StartServerWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Options); + + [PreserveSig] + int OutputServersWide( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string Machine, + DEBUG_SERVERS Flags); + + /* GetOutputCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + int GetOutputCallbacksWide( + out IDebugOutputCallbacksWide Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + int SetOutputCallbacksWide( + [In] IDebugOutputCallbacksWide Callbacks); + + [PreserveSig] + int GetOutputLinePrefixWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint PrefixSize); + + [PreserveSig] + int SetOutputLinePrefixWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Prefix); + + [PreserveSig] + int GetIdentityWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint IdentitySize); + + [PreserveSig] + int OutputIdentityWide( + DEBUG_OUTCTL OutputControl, + uint Flags, + [In][MarshalAs(UnmanagedType.LPWStr)] string Machine); + + /* GetEventCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + int GetEventCallbacksWide( + out IDebugEventCallbacksWide Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + int SetEventCallbacksWide( + [In] IDebugEventCallbacksWide Callbacks); + + [PreserveSig] + int CreateProcess2( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + in DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer, + uint OptionsBufferSize, + [In][MarshalAs(UnmanagedType.LPStr)] string InitialDirectory, + [In][MarshalAs(UnmanagedType.LPStr)] string Environment); + + [PreserveSig] + int CreateProcess2Wide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandLine, + in DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer, + uint OptionsBufferSize, + [In][MarshalAs(UnmanagedType.LPWStr)] string InitialDirectory, + [In][MarshalAs(UnmanagedType.LPWStr)] string Environment); + + [PreserveSig] + int CreateProcessAndAttach2( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + in DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer, + uint OptionsBufferSize, + [In][MarshalAs(UnmanagedType.LPStr)] string InitialDirectory, + [In][MarshalAs(UnmanagedType.LPStr)] string Environment, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + int CreateProcessAndAttach2Wide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandLine, + in DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer, + uint OptionsBufferSize, + [In][MarshalAs(UnmanagedType.LPWStr)] string InitialDirectory, + [In][MarshalAs(UnmanagedType.LPWStr)] string Environment, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + int PushOutputLinePrefix( + [In][MarshalAs(UnmanagedType.LPStr)] string NewPrefix, + out ulong Handle); + + [PreserveSig] + int PushOutputLinePrefixWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string NewPrefix, + out ulong Handle); + + [PreserveSig] + int PopOutputLinePrefix( + ulong Handle); + + [PreserveSig] + int GetNumberInputCallbacks( + out uint Count); + + [PreserveSig] + int GetNumberOutputCallbacks( + out uint Count); + + [PreserveSig] + int GetNumberEventCallbacks( + DEBUG_EVENT Flags, + out uint Count); + + [PreserveSig] + int GetQuitLockString( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize); + + [PreserveSig] + int SetQuitLockString( + [In][MarshalAs(UnmanagedType.LPStr)] string LockString); + + [PreserveSig] + int GetQuitLockStringWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize); + + [PreserveSig] + int SetQuitLockStringWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string LockString); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient6.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient6.cs new file mode 100644 index 0000000000..0773a6a7b8 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugClient6.cs @@ -0,0 +1,539 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("e3acb9d7-7ec2-4f0c-a0da-e81e0cbbe628")] + public interface IDebugClient6 : IDebugClient5 + { + /* IDebugClient */ + + [PreserveSig] + new int AttachKernel( + DEBUG_ATTACH Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string ConnectOptions); + + [PreserveSig] + new int GetKernelConnectionOptions( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint OptionsSize); + + [PreserveSig] + new int SetKernelConnectionOptions( + [In][MarshalAs(UnmanagedType.LPStr)] string Options); + + [PreserveSig] + new int StartProcessServer( + DEBUG_CLASS Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string Options, + IntPtr Reserved); + + [PreserveSig] + new int ConnectProcessServer( + [In][MarshalAs(UnmanagedType.LPStr)] string RemoteOptions, + out ulong Server); + + [PreserveSig] + new int DisconnectProcessServer( + ulong Server); + + [PreserveSig] + new int GetRunningProcessSystemIds( + ulong Server, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] Ids, + uint Count, + out uint ActualCount); + + [PreserveSig] + new int GetRunningProcessSystemIdByExecutableName( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string ExeName, + DEBUG_GET_PROC Flags, + out uint Id); + + [PreserveSig] + new int GetRunningProcessDescription( + ulong Server, + uint SystemId, + DEBUG_PROC_DESC Flags, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ExeName, + int ExeNameSize, + out uint ActualExeNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Description, + int DescriptionSize, + out uint ActualDescriptionSize); + + [PreserveSig] + new int AttachProcess( + ulong Server, + uint ProcessID, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + new int CreateProcess( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + DEBUG_CREATE_PROCESS Flags); + + [PreserveSig] + new int CreateProcessAndAttach( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + DEBUG_CREATE_PROCESS Flags, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + new int GetProcessOptions( + out DEBUG_PROCESS Options); + + [PreserveSig] + new int AddProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int RemoveProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int SetProcessOptions( + DEBUG_PROCESS Options); + + [PreserveSig] + new int OpenDumpFile( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile); + + [PreserveSig] + new int WriteDumpFile( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile, + DEBUG_DUMP Qualifier); + + [PreserveSig] + new int ConnectSession( + DEBUG_CONNECT_SESSION Flags, + uint HistoryLimit); + + [PreserveSig] + new int StartServer( + [In][MarshalAs(UnmanagedType.LPStr)] string Options); + + [PreserveSig] + new int OutputServer( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Machine, + DEBUG_SERVERS Flags); + + [PreserveSig] + new int TerminateProcesses(); + + [PreserveSig] + new int DetachProcesses(); + + [PreserveSig] + new int EndSession( + DEBUG_END Flags); + + [PreserveSig] + new int GetExitCode( + out uint Code); + + [PreserveSig] + new int DispatchCallbacks( + uint Timeout); + + [PreserveSig] + new int ExitDispatch( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client); + + [PreserveSig] + new int CreateClient( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugClient Client); + + [PreserveSig] + new int GetInputCallbacks( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugInputCallbacks Callbacks); + + [PreserveSig] + new int SetInputCallbacks( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugInputCallbacks Callbacks); + + /* GetOutputCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + new int GetOutputCallbacks( + out IDebugOutputCallbacks Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + new int SetOutputCallbacks( + [In] IDebugOutputCallbacks Callbacks); + + [PreserveSig] + new int GetOutputMask( + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetOutputMask( + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int GetOtherOutputMask( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client, + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetOtherOutputMask( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugClient Client, + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int GetOutputWidth( + out uint Columns); + + [PreserveSig] + new int SetOutputWidth( + uint Columns); + + [PreserveSig] + new int GetOutputLinePrefix( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PrefixSize); + + [PreserveSig] + new int SetOutputLinePrefix( + [In][MarshalAs(UnmanagedType.LPStr)] string Prefix); + + [PreserveSig] + new int GetIdentity( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint IdentitySize); + + [PreserveSig] + new int OutputIdentity( + DEBUG_OUTCTL OutputControl, + uint Flags, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + /* GetEventCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + new int GetEventCallbacks( + out IDebugEventCallbacks Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + new int SetEventCallbacks( + [In] IDebugEventCallbacks Callbacks); + + [PreserveSig] + new int FlushCallbacks(); + + /* IDebugClient2 */ + + [PreserveSig] + new int WriteDumpFile2( + [In][MarshalAs(UnmanagedType.LPStr)] string DumpFile, + DEBUG_DUMP Qualifier, + DEBUG_FORMAT FormatFlags, + [In][MarshalAs(UnmanagedType.LPStr)] string Comment); + + [PreserveSig] + new int AddDumpInformationFile( + [In][MarshalAs(UnmanagedType.LPStr)] string InfoFile, + DEBUG_DUMP_FILE Type); + + [PreserveSig] + new int EndProcessServer( + ulong Server); + + [PreserveSig] + new int WaitForProcessServerEnd( + uint Timeout); + + [PreserveSig] + new int IsKernelDebuggerEnabled(); + + [PreserveSig] + new int TerminateCurrentProcess(); + + [PreserveSig] + new int DetachCurrentProcess(); + + [PreserveSig] + new int AbandonCurrentProcess(); + + /* IDebugClient3 */ + + [PreserveSig] + new int GetRunningProcessSystemIdByExecutableNameWide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string ExeName, + DEBUG_GET_PROC Flags, + out uint Id); + + [PreserveSig] + new int GetRunningProcessDescriptionWide( + ulong Server, + uint SystemId, + DEBUG_PROC_DESC Flags, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder ExeName, + int ExeNameSize, + out uint ActualExeNameSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Description, + int DescriptionSize, + out uint ActualDescriptionSize); + + [PreserveSig] + new int CreateProcessWide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandLine, + DEBUG_CREATE_PROCESS CreateFlags); + + [PreserveSig] + new int CreateProcessAndAttachWide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandLine, + DEBUG_CREATE_PROCESS CreateFlags, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + + /* IDebugClient4 */ + + [PreserveSig] + new int OpenDumpFileWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string FileName, + ulong FileHandle); + + [PreserveSig] + new int WriteDumpFileWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string DumpFile, + ulong FileHandle, + DEBUG_DUMP Qualifier, + DEBUG_FORMAT FormatFlags, + [In][MarshalAs(UnmanagedType.LPWStr)] string Comment); + + [PreserveSig] + new int AddDumpInformationFileWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string FileName, + ulong FileHandle, + DEBUG_DUMP_FILE Type); + + [PreserveSig] + new int GetNumberDumpFiles( + out uint Number); + + [PreserveSig] + new int GetDumpFile( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize, + out ulong Handle, + out uint Type); + + [PreserveSig] + new int GetDumpFileWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize, + out ulong Handle, + out uint Type); + + /* IDebugClient5 */ + + [PreserveSig] + new int AttachKernelWide( + DEBUG_ATTACH Flags, + [In][MarshalAs(UnmanagedType.LPWStr)] string ConnectOptions); + + [PreserveSig] + new int GetKernelConnectionOptionsWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint OptionsSize); + + [PreserveSig] + new int SetKernelConnectionOptionsWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Options); + + [PreserveSig] + new int StartProcessServerWide( + DEBUG_CLASS Flags, + [In][MarshalAs(UnmanagedType.LPWStr)] string Options, + IntPtr Reserved); + + [PreserveSig] + new int ConnectProcessServerWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string RemoteOptions, + out ulong Server); + + [PreserveSig] + new int StartServerWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Options); + + [PreserveSig] + new int OutputServersWide( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string Machine, + DEBUG_SERVERS Flags); + + /* GetOutputCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + new int GetOutputCallbacksWide( + out IDebugOutputCallbacksWide Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + new int SetOutputCallbacksWide( + [In] IDebugOutputCallbacksWide Callbacks); + + [PreserveSig] + new int GetOutputLinePrefixWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint PrefixSize); + + [PreserveSig] + new int SetOutputLinePrefixWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Prefix); + + [PreserveSig] + new int GetIdentityWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint IdentitySize); + + [PreserveSig] + new int OutputIdentityWide( + DEBUG_OUTCTL OutputControl, + uint Flags, + [In][MarshalAs(UnmanagedType.LPWStr)] string Machine); + + /* GetEventCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */ + + [PreserveSig] + new int GetEventCallbacksWide( + out IDebugEventCallbacksWide Callbacks); + + /* We may have to pass a debugger engine conversion thunk back in so we can't specify a specific interface */ + + [PreserveSig] + new int SetEventCallbacksWide( + [In] IDebugEventCallbacksWide Callbacks); + + [PreserveSig] + new int CreateProcess2( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + in DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer, + uint OptionsBufferSize, + [In][MarshalAs(UnmanagedType.LPStr)] string InitialDirectory, + [In][MarshalAs(UnmanagedType.LPStr)] string Environment); + + [PreserveSig] + new int CreateProcess2Wide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandLine, + in DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer, + uint OptionsBufferSize, + [In][MarshalAs(UnmanagedType.LPWStr)] string InitialDirectory, + [In][MarshalAs(UnmanagedType.LPWStr)] string Environment); + + [PreserveSig] + new int CreateProcessAndAttach2( + ulong Server, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandLine, + in DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer, + uint OptionsBufferSize, + [In][MarshalAs(UnmanagedType.LPStr)] string InitialDirectory, + [In][MarshalAs(UnmanagedType.LPStr)] string Environment, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + new int CreateProcessAndAttach2Wide( + ulong Server, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandLine, + in DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer, + uint OptionsBufferSize, + [In][MarshalAs(UnmanagedType.LPWStr)] string InitialDirectory, + [In][MarshalAs(UnmanagedType.LPWStr)] string Environment, + uint ProcessId, + DEBUG_ATTACH AttachFlags); + + [PreserveSig] + new int PushOutputLinePrefix( + [In][MarshalAs(UnmanagedType.LPStr)] string NewPrefix, + out ulong Handle); + + [PreserveSig] + new int PushOutputLinePrefixWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string NewPrefix, + out ulong Handle); + + [PreserveSig] + new int PopOutputLinePrefix( + ulong Handle); + + [PreserveSig] + new int GetNumberInputCallbacks( + out uint Count); + + [PreserveSig] + new int GetNumberOutputCallbacks( + out uint Count); + + [PreserveSig] + new int GetNumberEventCallbacks( + DEBUG_EVENT Flags, + out uint Count); + + [PreserveSig] + new int GetQuitLockString( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize); + + [PreserveSig] + new int SetQuitLockString( + [In][MarshalAs(UnmanagedType.LPStr)] string LockString); + + [PreserveSig] + new int GetQuitLockStringWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize); + + [PreserveSig] + new int SetQuitLockStringWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string LockString); + + /* IDebugClient6 */ + + [PreserveSig] + int SetEventContextCallbacks( + [In] IDebugEventContextCallbacks Callbacks); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl.cs new file mode 100644 index 0000000000..90d92a1f2c --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl.cs @@ -0,0 +1,537 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("5182e668-105e-416e-ad92-24ef800424ba")] + public interface IDebugControl + { + /* IDebugControl */ + + [PreserveSig] + int GetInterrupt(); + + [PreserveSig] + int SetInterrupt( + DEBUG_INTERRUPT Flags); + + [PreserveSig] + int GetInterruptTimeout( + out uint Seconds); + + [PreserveSig] + int SetInterruptTimeout( + uint Seconds); + + [PreserveSig] + int GetLogFile( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + [Out][MarshalAs(UnmanagedType.Bool)] out bool Append); + + [PreserveSig] + int OpenLogFile( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + [In][MarshalAs(UnmanagedType.Bool)] bool Append); + + [PreserveSig] + int CloseLogFile(); + + [PreserveSig] + int GetLogMask( + out DEBUG_OUTPUT Mask); + + [PreserveSig] + int SetLogMask( + DEBUG_OUTPUT Mask); + + [PreserveSig] + int Input( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint InputSize); + + [PreserveSig] + int ReturnInput( + [In][MarshalAs(UnmanagedType.LPStr)] string Buffer); + + [PreserveSig] + int Output( + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + int OutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + int ControlledOutput( + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + int ControlledOutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + int OutputPrompt( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + int OutputPromptVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + int GetPromptText( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + int OutputCurrentState( + DEBUG_OUTCTL OutputControl, + DEBUG_CURRENT Flags); + + [PreserveSig] + int OutputVersionInformation( + DEBUG_OUTCTL OutputControl); + + [PreserveSig] + int GetNotifyEventHandle( + out ulong Handle); + + [PreserveSig] + int SetNotifyEventHandle( + ulong Handle); + + [PreserveSig] + int Assemble( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPStr)] string Instr, + out ulong EndOffset); + + [PreserveSig] + int Disassemble( + ulong Offset, + DEBUG_DISASM Flags, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint DisassemblySize, + out ulong EndOffset); + + [PreserveSig] + int GetDisassembleEffectiveOffset( + out ulong Offset); + + [PreserveSig] + int OutputDisassembly( + DEBUG_OUTCTL OutputControl, + ulong Offset, + DEBUG_DISASM Flags, + out ulong EndOffset); + + [PreserveSig] + int OutputDisassemblyLines( + DEBUG_OUTCTL OutputControl, + uint PreviousLines, + uint TotalLines, + ulong Offset, + DEBUG_DISASM Flags, + out uint OffsetLine, + out ulong StartOffset, + out ulong EndOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] LineOffsets); + + [PreserveSig] + int GetNearInstruction( + ulong Offset, + int Delta, + out ulong NearOffset); + + [PreserveSig] + int GetStackTrace( + ulong FrameOffset, + ulong StackOffset, + ulong InstructionOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_STACK_FRAME[] Frames, + int FrameSize, + out uint FramesFilled); + + [PreserveSig] + int GetReturnOffset( + out ulong Offset); + + [PreserveSig] + int OutputStackTrace( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames, + int FramesSize, + DEBUG_STACK Flags); + + [PreserveSig] + int GetDebuggeeType( + out DEBUG_CLASS Class, + out DEBUG_CLASS_QUALIFIER Qualifier); + + [PreserveSig] + int GetActualProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + int GetExecutingProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + int GetNumberPossibleExecutingProcessorTypes( + out uint Number); + + [PreserveSig] + int GetPossibleExecutingProcessorTypes( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + IMAGE_FILE_MACHINE[] Types); + + [PreserveSig] + int GetNumberProcessors( + out uint Number); + + [PreserveSig] + int GetSystemVersion( + out uint PlatformId, + out uint Major, + out uint Minor, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ServicePackString, + int ServicePackStringSize, + out uint ServicePackStringUsed, + out uint ServicePackNumber, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder BuildString, + int BuildStringSize, + out uint BuildStringUsed); + + [PreserveSig] + int GetPageSize( + out uint Size); + + [PreserveSig] + int IsPointer64Bit(); + + [PreserveSig] + int ReadBugCheckData( + out uint Code, + out ulong Arg1, + out ulong Arg2, + out ulong Arg3, + out ulong Arg4); + + [PreserveSig] + int GetNumberSupportedProcessorTypes( + out uint Number); + + [PreserveSig] + int GetSupportedProcessorTypes( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + IMAGE_FILE_MACHINE[] Types); + + [PreserveSig] + int GetProcessorTypeNames( + IMAGE_FILE_MACHINE Type, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + int GetEffectiveProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + int SetEffectiveProcessorType( + IMAGE_FILE_MACHINE Type); + + [PreserveSig] + int GetExecutionStatus( + out DEBUG_STATUS Status); + + [PreserveSig] + int SetExecutionStatus( + DEBUG_STATUS Status); + + [PreserveSig] + int GetCodeLevel( + out DEBUG_LEVEL Level); + + [PreserveSig] + int SetCodeLevel( + DEBUG_LEVEL Level); + + [PreserveSig] + int GetEngineOptions( + out DEBUG_ENGOPT Options); + + [PreserveSig] + int AddEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + int RemoveEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + int SetEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + int GetSystemErrorControl( + out ERROR_LEVEL OutputLevel, + out ERROR_LEVEL BreakLevel); + + [PreserveSig] + int SetSystemErrorControl( + ERROR_LEVEL OutputLevel, + ERROR_LEVEL BreakLevel); + + [PreserveSig] + int GetTextMacro( + uint Slot, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint MacroSize); + + [PreserveSig] + int SetTextMacro( + uint Slot, + [In][MarshalAs(UnmanagedType.LPStr)] string Macro); + + [PreserveSig] + int GetRadix( + out uint Radix); + + [PreserveSig] + int SetRadix( + uint Radix); + + [PreserveSig] + int Evaluate( + [In][MarshalAs(UnmanagedType.LPStr)] string Expression, + DEBUG_VALUE_TYPE DesiredType, + out DEBUG_VALUE Value, + out uint RemainderIndex); + + [PreserveSig] + int CoerceValue( + DEBUG_VALUE In, + DEBUG_VALUE_TYPE OutType, + out DEBUG_VALUE Out); + + [PreserveSig] + int CoerceValues( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] In, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE_TYPE[] OutType, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_VALUE[] Out); + + [PreserveSig] + int Execute( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Command, + DEBUG_EXECUTE Flags); + + [PreserveSig] + int ExecuteCommandFile( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandFile, + DEBUG_EXECUTE Flags); + + [PreserveSig] + int GetNumberBreakpoints( + out uint Number); + + [PreserveSig] + int GetBreakpointByIndex( + uint Index, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint bp); + + [PreserveSig] + int GetBreakpointById( + uint Id, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint bp); + + [PreserveSig] + int GetBreakpointParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Ids, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_BREAKPOINT_PARAMETERS[] Params); + + [PreserveSig] + int AddBreakpoint( + DEBUG_BREAKPOINT_TYPE Type, + uint DesiredId, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint Bp); + + [PreserveSig] + int RemoveBreakpoint( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugBreakpoint Bp); + + [PreserveSig] + int AddExtension( + [In][MarshalAs(UnmanagedType.LPStr)] string Path, + uint Flags, + out ulong Handle); + + [PreserveSig] + int RemoveExtension( + ulong Handle); + + [PreserveSig] + int GetExtensionByPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path, + out ulong Handle); + + [PreserveSig] + int CallExtension( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPStr)] string Function, + [In][MarshalAs(UnmanagedType.LPStr)] string Arguments); + + [PreserveSig] + int GetExtensionFunction( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPStr)] string FuncName, + out IntPtr Function); + + [PreserveSig] + int GetWindbgExtensionApis32( + ref WINDBG_EXTENSION_APIS Api); + + /* Must be In and Out as the nSize member has to be initialized */ + + [PreserveSig] + int GetWindbgExtensionApis64( + ref WINDBG_EXTENSION_APIS Api); + + /* Must be In and Out as the nSize member has to be initialized */ + + [PreserveSig] + int GetNumberEventFilters( + out uint SpecificEvents, + out uint SpecificExceptions, + out uint ArbitraryExceptions); + + [PreserveSig] + int GetEventFilterText( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + int GetEventFilterCommand( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + int SetEventFilterCommand( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + int GetSpecificFilterParameters( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params); + + [PreserveSig] + int SetSpecificFilterParameters( + uint Start, + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params); + + [PreserveSig] + int GetSpecificEventFilterArgument( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ArgumentSize); + + [PreserveSig] + int SetSpecificEventFilterArgument( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Argument); + + [PreserveSig] + int GetExceptionFilterParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Codes, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params); + + [PreserveSig] + int SetExceptionFilterParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params); + + [PreserveSig] + int GetExceptionFilterSecondCommand( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + int SetExceptionFilterSecondCommand( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + int WaitForEvent( + DEBUG_WAIT Flags, + uint Timeout); + + [PreserveSig] + int GetLastEventInformation( + out DEBUG_EVENT Type, + out uint ProcessId, + out uint ThreadId, + IntPtr ExtraInformation, + uint ExtraInformationSize, + out uint ExtraInformationUsed, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Description, + int DescriptionSize, + out uint DescriptionUsed); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl2.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl2.cs new file mode 100644 index 0000000000..b9fbbe233e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl2.cs @@ -0,0 +1,579 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("d4366723-44df-4bed-8c7e-4c05424f4588")] + public interface IDebugControl2 : IDebugControl + { + /* IDebugControl */ + + [PreserveSig] + new int GetInterrupt(); + + [PreserveSig] + new int SetInterrupt( + DEBUG_INTERRUPT Flags); + + [PreserveSig] + new int GetInterruptTimeout( + out uint Seconds); + + [PreserveSig] + new int SetInterruptTimeout( + uint Seconds); + + [PreserveSig] + new int GetLogFile( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + [Out][MarshalAs(UnmanagedType.Bool)] out bool Append); + + [PreserveSig] + new int OpenLogFile( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + [In][MarshalAs(UnmanagedType.Bool)] bool Append); + + [PreserveSig] + new int CloseLogFile(); + + [PreserveSig] + new int GetLogMask( + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetLogMask( + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int Input( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint InputSize); + + [PreserveSig] + new int ReturnInput( + [In][MarshalAs(UnmanagedType.LPStr)] string Buffer); + + [PreserveSig] + new int Output( + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int OutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int ControlledOutput( + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int ControlledOutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int OutputPrompt( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int OutputPromptVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int GetPromptText( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int OutputCurrentState( + DEBUG_OUTCTL OutputControl, + DEBUG_CURRENT Flags); + + [PreserveSig] + new int OutputVersionInformation( + DEBUG_OUTCTL OutputControl); + + [PreserveSig] + new int GetNotifyEventHandle( + out ulong Handle); + + [PreserveSig] + new int SetNotifyEventHandle( + ulong Handle); + + [PreserveSig] + new int Assemble( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPStr)] string Instr, + out ulong EndOffset); + + [PreserveSig] + new int Disassemble( + ulong Offset, + DEBUG_DISASM Flags, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint DisassemblySize, + out ulong EndOffset); + + [PreserveSig] + new int GetDisassembleEffectiveOffset( + out ulong Offset); + + [PreserveSig] + new int OutputDisassembly( + DEBUG_OUTCTL OutputControl, + ulong Offset, + DEBUG_DISASM Flags, + out ulong EndOffset); + + [PreserveSig] + new int OutputDisassemblyLines( + DEBUG_OUTCTL OutputControl, + uint PreviousLines, + uint TotalLines, + ulong Offset, + DEBUG_DISASM Flags, + out uint OffsetLine, + out ulong StartOffset, + out ulong EndOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] LineOffsets); + + [PreserveSig] + new int GetNearInstruction( + ulong Offset, + int Delta, + out ulong NearOffset); + + [PreserveSig] + new int GetStackTrace( + ulong FrameOffset, + ulong StackOffset, + ulong InstructionOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_STACK_FRAME[] Frames, + int FrameSize, + out uint FramesFilled); + + [PreserveSig] + new int GetReturnOffset( + out ulong Offset); + + [PreserveSig] + new int OutputStackTrace( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames, + int FramesSize, + DEBUG_STACK Flags); + + [PreserveSig] + new int GetDebuggeeType( + out DEBUG_CLASS Class, + out DEBUG_CLASS_QUALIFIER Qualifier); + + [PreserveSig] + new int GetActualProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetExecutingProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetNumberPossibleExecutingProcessorTypes( + out uint Number); + + [PreserveSig] + new int GetPossibleExecutingProcessorTypes( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + IMAGE_FILE_MACHINE[] Types); + + [PreserveSig] + new int GetNumberProcessors( + out uint Number); + + [PreserveSig] + new int GetSystemVersion( + out uint PlatformId, + out uint Major, + out uint Minor, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ServicePackString, + int ServicePackStringSize, + out uint ServicePackStringUsed, + out uint ServicePackNumber, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder BuildString, + int BuildStringSize, + out uint BuildStringUsed); + + [PreserveSig] + new int GetPageSize( + out uint Size); + + [PreserveSig] + new int IsPointer64Bit(); + + [PreserveSig] + new int ReadBugCheckData( + out uint Code, + out ulong Arg1, + out ulong Arg2, + out ulong Arg3, + out ulong Arg4); + + [PreserveSig] + new int GetNumberSupportedProcessorTypes( + out uint Number); + + [PreserveSig] + new int GetSupportedProcessorTypes( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + IMAGE_FILE_MACHINE[] Types); + + [PreserveSig] + new int GetProcessorTypeNames( + IMAGE_FILE_MACHINE Type, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + new int GetEffectiveProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int SetEffectiveProcessorType( + IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetExecutionStatus( + out DEBUG_STATUS Status); + + [PreserveSig] + new int SetExecutionStatus( + DEBUG_STATUS Status); + + [PreserveSig] + new int GetCodeLevel( + out DEBUG_LEVEL Level); + + [PreserveSig] + new int SetCodeLevel( + DEBUG_LEVEL Level); + + [PreserveSig] + new int GetEngineOptions( + out DEBUG_ENGOPT Options); + + [PreserveSig] + new int AddEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int RemoveEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int SetEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int GetSystemErrorControl( + out ERROR_LEVEL OutputLevel, + out ERROR_LEVEL BreakLevel); + + [PreserveSig] + new int SetSystemErrorControl( + ERROR_LEVEL OutputLevel, + ERROR_LEVEL BreakLevel); + + [PreserveSig] + new int GetTextMacro( + uint Slot, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint MacroSize); + + [PreserveSig] + new int SetTextMacro( + uint Slot, + [In][MarshalAs(UnmanagedType.LPStr)] string Macro); + + [PreserveSig] + new int GetRadix( + out uint Radix); + + [PreserveSig] + new int SetRadix( + uint Radix); + + [PreserveSig] + new int Evaluate( + [In][MarshalAs(UnmanagedType.LPStr)] string Expression, + DEBUG_VALUE_TYPE DesiredType, + out DEBUG_VALUE Value, + out uint RemainderIndex); + + [PreserveSig] + new int CoerceValue( + DEBUG_VALUE In, + DEBUG_VALUE_TYPE OutType, + out DEBUG_VALUE Out); + + [PreserveSig] + new int CoerceValues( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] In, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE_TYPE[] OutType, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_VALUE[] Out); + + [PreserveSig] + new int Execute( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Command, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int ExecuteCommandFile( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandFile, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int GetNumberBreakpoints( + out uint Number); + + [PreserveSig] + new int GetBreakpointByIndex( + uint Index, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint bp); + + [PreserveSig] + new int GetBreakpointById( + uint Id, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint bp); + + [PreserveSig] + new int GetBreakpointParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Ids, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_BREAKPOINT_PARAMETERS[] Params); + + [PreserveSig] + new int AddBreakpoint( + DEBUG_BREAKPOINT_TYPE Type, + uint DesiredId, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint Bp); + + [PreserveSig] + new int RemoveBreakpoint( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugBreakpoint Bp); + + [PreserveSig] + new int AddExtension( + [In][MarshalAs(UnmanagedType.LPStr)] string Path, + uint Flags, + out ulong Handle); + + [PreserveSig] + new int RemoveExtension( + ulong Handle); + + [PreserveSig] + new int GetExtensionByPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path, + out ulong Handle); + + [PreserveSig] + new int CallExtension( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPStr)] string Function, + [In][MarshalAs(UnmanagedType.LPStr)] string Arguments); + + [PreserveSig] + new int GetExtensionFunction( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPStr)] string FuncName, + out IntPtr Function); + + [PreserveSig] + new int GetWindbgExtensionApis32( + ref WINDBG_EXTENSION_APIS Api); + + /* Must be In and Out as the nSize member has to be initialized */ + + [PreserveSig] + new int GetWindbgExtensionApis64( + ref WINDBG_EXTENSION_APIS Api); + + /* Must be In and Out as the nSize member has to be initialized */ + + [PreserveSig] + new int GetNumberEventFilters( + out uint SpecificEvents, + out uint SpecificExceptions, + out uint ArbitraryExceptions); + + [PreserveSig] + new int GetEventFilterText( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int GetEventFilterCommand( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetEventFilterCommand( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + new int GetSpecificFilterParameters( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int SetSpecificFilterParameters( + uint Start, + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int GetSpecificEventFilterArgument( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ArgumentSize); + + [PreserveSig] + new int SetSpecificEventFilterArgument( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Argument); + + [PreserveSig] + new int GetExceptionFilterParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Codes, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int SetExceptionFilterParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int GetExceptionFilterSecondCommand( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetExceptionFilterSecondCommand( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + new int WaitForEvent( + DEBUG_WAIT Flags, + uint Timeout); + + [PreserveSig] + new int GetLastEventInformation( + out DEBUG_EVENT Type, + out uint ProcessId, + out uint ThreadId, + IntPtr ExtraInformation, + uint ExtraInformationSize, + out uint ExtraInformationUsed, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Description, + int DescriptionSize, + out uint DescriptionUsed); + + /* IDebugControl2 */ + + [PreserveSig] + int GetCurrentTimeDate( + out uint TimeDate); + + [PreserveSig] + int GetCurrentSystemUpTime( + out uint UpTime); + + [PreserveSig] + int GetDumpFormatFlags( + out DEBUG_FORMAT FormatFlags); + + [PreserveSig] + int GetNumberTextReplacements( + out uint NumRepl); + + [PreserveSig] + int GetTextReplacement( + [In][MarshalAs(UnmanagedType.LPStr)] string SrcText, + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder SrcBuffer, + int SrcBufferSize, + out uint SrcSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder DstBuffer, + int DstBufferSize, + out uint DstSize); + + [PreserveSig] + int SetTextReplacement( + [In][MarshalAs(UnmanagedType.LPStr)] string SrcText, + [In][MarshalAs(UnmanagedType.LPStr)] string DstText); + + [PreserveSig] + int RemoveTextReplacements(); + + [PreserveSig] + int OutputTextReplacements( + DEBUG_OUTCTL OutputControl, + DEBUG_OUT_TEXT_REPL Flags); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl3.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl3.cs new file mode 100644 index 0000000000..f0b1bb5e3f --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl3.cs @@ -0,0 +1,603 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("7df74a86-b03f-407f-90ab-a20dadcead08")] + public interface IDebugControl3 : IDebugControl2 + { + /* IDebugControl */ + + [PreserveSig] + new int GetInterrupt(); + + [PreserveSig] + new int SetInterrupt( + DEBUG_INTERRUPT Flags); + + [PreserveSig] + new int GetInterruptTimeout( + out uint Seconds); + + [PreserveSig] + new int SetInterruptTimeout( + uint Seconds); + + [PreserveSig] + new int GetLogFile( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + [Out][MarshalAs(UnmanagedType.Bool)] out bool Append); + + [PreserveSig] + new int OpenLogFile( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + [In][MarshalAs(UnmanagedType.Bool)] bool Append); + + [PreserveSig] + new int CloseLogFile(); + + [PreserveSig] + new int GetLogMask( + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetLogMask( + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int Input( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint InputSize); + + [PreserveSig] + new int ReturnInput( + [In][MarshalAs(UnmanagedType.LPStr)] string Buffer); + + [PreserveSig] + new int Output( + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int OutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int ControlledOutput( + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int ControlledOutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int OutputPrompt( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int OutputPromptVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int GetPromptText( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int OutputCurrentState( + DEBUG_OUTCTL OutputControl, + DEBUG_CURRENT Flags); + + [PreserveSig] + new int OutputVersionInformation( + DEBUG_OUTCTL OutputControl); + + [PreserveSig] + new int GetNotifyEventHandle( + out ulong Handle); + + [PreserveSig] + new int SetNotifyEventHandle( + ulong Handle); + + [PreserveSig] + new int Assemble( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPStr)] string Instr, + out ulong EndOffset); + + [PreserveSig] + new int Disassemble( + ulong Offset, + DEBUG_DISASM Flags, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint DisassemblySize, + out ulong EndOffset); + + [PreserveSig] + new int GetDisassembleEffectiveOffset( + out ulong Offset); + + [PreserveSig] + new int OutputDisassembly( + DEBUG_OUTCTL OutputControl, + ulong Offset, + DEBUG_DISASM Flags, + out ulong EndOffset); + + [PreserveSig] + new int OutputDisassemblyLines( + DEBUG_OUTCTL OutputControl, + uint PreviousLines, + uint TotalLines, + ulong Offset, + DEBUG_DISASM Flags, + out uint OffsetLine, + out ulong StartOffset, + out ulong EndOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] LineOffsets); + + [PreserveSig] + new int GetNearInstruction( + ulong Offset, + int Delta, + out ulong NearOffset); + + [PreserveSig] + new int GetStackTrace( + ulong FrameOffset, + ulong StackOffset, + ulong InstructionOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_STACK_FRAME[] Frames, + int FrameSize, + out uint FramesFilled); + + [PreserveSig] + new int GetReturnOffset( + out ulong Offset); + + [PreserveSig] + new int OutputStackTrace( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames, + int FramesSize, + DEBUG_STACK Flags); + + [PreserveSig] + new int GetDebuggeeType( + out DEBUG_CLASS Class, + out DEBUG_CLASS_QUALIFIER Qualifier); + + [PreserveSig] + new int GetActualProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetExecutingProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetNumberPossibleExecutingProcessorTypes( + out uint Number); + + [PreserveSig] + new int GetPossibleExecutingProcessorTypes( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + IMAGE_FILE_MACHINE[] Types); + + [PreserveSig] + new int GetNumberProcessors( + out uint Number); + + [PreserveSig] + new int GetSystemVersion( + out uint PlatformId, + out uint Major, + out uint Minor, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ServicePackString, + int ServicePackStringSize, + out uint ServicePackStringUsed, + out uint ServicePackNumber, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder BuildString, + int BuildStringSize, + out uint BuildStringUsed); + + [PreserveSig] + new int GetPageSize( + out uint Size); + + [PreserveSig] + new int IsPointer64Bit(); + + [PreserveSig] + new int ReadBugCheckData( + out uint Code, + out ulong Arg1, + out ulong Arg2, + out ulong Arg3, + out ulong Arg4); + + [PreserveSig] + new int GetNumberSupportedProcessorTypes( + out uint Number); + + [PreserveSig] + new int GetSupportedProcessorTypes( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + IMAGE_FILE_MACHINE[] Types); + + [PreserveSig] + new int GetProcessorTypeNames( + IMAGE_FILE_MACHINE Type, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + new int GetEffectiveProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int SetEffectiveProcessorType( + IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetExecutionStatus( + out DEBUG_STATUS Status); + + [PreserveSig] + new int SetExecutionStatus( + DEBUG_STATUS Status); + + [PreserveSig] + new int GetCodeLevel( + out DEBUG_LEVEL Level); + + [PreserveSig] + new int SetCodeLevel( + DEBUG_LEVEL Level); + + [PreserveSig] + new int GetEngineOptions( + out DEBUG_ENGOPT Options); + + [PreserveSig] + new int AddEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int RemoveEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int SetEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int GetSystemErrorControl( + out ERROR_LEVEL OutputLevel, + out ERROR_LEVEL BreakLevel); + + [PreserveSig] + new int SetSystemErrorControl( + ERROR_LEVEL OutputLevel, + ERROR_LEVEL BreakLevel); + + [PreserveSig] + new int GetTextMacro( + uint Slot, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint MacroSize); + + [PreserveSig] + new int SetTextMacro( + uint Slot, + [In][MarshalAs(UnmanagedType.LPStr)] string Macro); + + [PreserveSig] + new int GetRadix( + out uint Radix); + + [PreserveSig] + new int SetRadix( + uint Radix); + + [PreserveSig] + new int Evaluate( + [In][MarshalAs(UnmanagedType.LPStr)] string Expression, + DEBUG_VALUE_TYPE DesiredType, + out DEBUG_VALUE Value, + out uint RemainderIndex); + + [PreserveSig] + new int CoerceValue( + DEBUG_VALUE In, + DEBUG_VALUE_TYPE OutType, + out DEBUG_VALUE Out); + + [PreserveSig] + new int CoerceValues( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] In, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE_TYPE[] OutType, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_VALUE[] Out); + + [PreserveSig] + new int Execute( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Command, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int ExecuteCommandFile( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandFile, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int GetNumberBreakpoints( + out uint Number); + + [PreserveSig] + new int GetBreakpointByIndex( + uint Index, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint bp); + + [PreserveSig] + new int GetBreakpointById( + uint Id, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint bp); + + [PreserveSig] + new int GetBreakpointParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Ids, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_BREAKPOINT_PARAMETERS[] Params); + + [PreserveSig] + new int AddBreakpoint( + DEBUG_BREAKPOINT_TYPE Type, + uint DesiredId, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint Bp); + + [PreserveSig] + new int RemoveBreakpoint( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugBreakpoint Bp); + + [PreserveSig] + new int AddExtension( + [In][MarshalAs(UnmanagedType.LPStr)] string Path, + uint Flags, + out ulong Handle); + + [PreserveSig] + new int RemoveExtension( + ulong Handle); + + [PreserveSig] + new int GetExtensionByPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path, + out ulong Handle); + + [PreserveSig] + new int CallExtension( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPStr)] string Function, + [In][MarshalAs(UnmanagedType.LPStr)] string Arguments); + + [PreserveSig] + new int GetExtensionFunction( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPStr)] string FuncName, + out IntPtr Function); + + [PreserveSig] + new int GetWindbgExtensionApis32( + ref WINDBG_EXTENSION_APIS Api); + + /* Must be In and Out as the nSize member has to be initialized */ + + [PreserveSig] + new int GetWindbgExtensionApis64( + ref WINDBG_EXTENSION_APIS Api); + + /* Must be In and Out as the nSize member has to be initialized */ + + [PreserveSig] + new int GetNumberEventFilters( + out uint SpecificEvents, + out uint SpecificExceptions, + out uint ArbitraryExceptions); + + [PreserveSig] + new int GetEventFilterText( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int GetEventFilterCommand( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetEventFilterCommand( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + new int GetSpecificFilterParameters( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int SetSpecificFilterParameters( + uint Start, + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int GetSpecificEventFilterArgument( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ArgumentSize); + + [PreserveSig] + new int SetSpecificEventFilterArgument( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Argument); + + [PreserveSig] + new int GetExceptionFilterParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Codes, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int SetExceptionFilterParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int GetExceptionFilterSecondCommand( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetExceptionFilterSecondCommand( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + new int WaitForEvent( + DEBUG_WAIT Flags, + uint Timeout); + + [PreserveSig] + new int GetLastEventInformation( + out DEBUG_EVENT Type, + out uint ProcessId, + out uint ThreadId, + IntPtr ExtraInformation, + uint ExtraInformationSize, + out uint ExtraInformationUsed, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Description, + int DescriptionSize, + out uint DescriptionUsed); + + /* IDebugControl3 */ + + [PreserveSig] + int GetAssemblyOptions( + out DEBUG_ASMOPT Options); + + [PreserveSig] + int AddAssemblyOptions( + DEBUG_ASMOPT Options); + + [PreserveSig] + int RemoveAssemblyOptions( + DEBUG_ASMOPT Options); + + [PreserveSig] + int SetAssemblyOptions( + DEBUG_ASMOPT Options); + + [PreserveSig] + int GetExpressionSyntax( + out DEBUG_EXPR Flags); + + [PreserveSig] + int SetExpressionSyntax( + DEBUG_EXPR Flags); + + [PreserveSig] + int SetExpressionSyntaxByName( + [In][MarshalAs(UnmanagedType.LPStr)] string AbbrevName); + + [PreserveSig] + int GetNumberExpressionSyntaxes( + out uint Number); + + [PreserveSig] + int GetExpressionSyntaxNames( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + int GetNumberEvents( + out uint Events); + + [PreserveSig] + int GetEventIndexDescription( + uint Index, + DEBUG_EINDEX Which, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint DescSize); + + [PreserveSig] + int GetCurrentEventIndex( + out uint Index); + + [PreserveSig] + int SetNextEventIndex( + DEBUG_EINDEX Relation, + uint Value, + out uint NextIndex); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl4.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl4.cs new file mode 100644 index 0000000000..dbaa28ebe8 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl4.cs @@ -0,0 +1,1006 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("94e60ce9-9b41-4b19-9fc0-6d9eb35272b3")] + public interface IDebugControl4 : IDebugControl3 + { + /* IDebugControl */ + + [PreserveSig] + new int GetInterrupt(); + + [PreserveSig] + new int SetInterrupt( + DEBUG_INTERRUPT Flags); + + [PreserveSig] + new int GetInterruptTimeout( + out uint Seconds); + + [PreserveSig] + new int SetInterruptTimeout( + uint Seconds); + + [PreserveSig] + new int GetLogFile( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + [Out][MarshalAs(UnmanagedType.Bool)] out bool Append); + + [PreserveSig] + new int OpenLogFile( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + [In][MarshalAs(UnmanagedType.Bool)] bool Append); + + [PreserveSig] + new int CloseLogFile(); + + [PreserveSig] + new int GetLogMask( + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetLogMask( + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int Input( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint InputSize); + + [PreserveSig] + new int ReturnInput( + [In][MarshalAs(UnmanagedType.LPStr)] string Buffer); + + [PreserveSig] + new int Output( + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int OutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int ControlledOutput( + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int ControlledOutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int OutputPrompt( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int OutputPromptVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int GetPromptText( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int OutputCurrentState( + DEBUG_OUTCTL OutputControl, + DEBUG_CURRENT Flags); + + [PreserveSig] + new int OutputVersionInformation( + DEBUG_OUTCTL OutputControl); + + [PreserveSig] + new int GetNotifyEventHandle( + out ulong Handle); + + [PreserveSig] + new int SetNotifyEventHandle( + ulong Handle); + + [PreserveSig] + new int Assemble( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPStr)] string Instr, + out ulong EndOffset); + + [PreserveSig] + new int Disassemble( + ulong Offset, + DEBUG_DISASM Flags, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint DisassemblySize, + out ulong EndOffset); + + [PreserveSig] + new int GetDisassembleEffectiveOffset( + out ulong Offset); + + [PreserveSig] + new int OutputDisassembly( + DEBUG_OUTCTL OutputControl, + ulong Offset, + DEBUG_DISASM Flags, + out ulong EndOffset); + + [PreserveSig] + new int OutputDisassemblyLines( + DEBUG_OUTCTL OutputControl, + uint PreviousLines, + uint TotalLines, + ulong Offset, + DEBUG_DISASM Flags, + out uint OffsetLine, + out ulong StartOffset, + out ulong EndOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] LineOffsets); + + [PreserveSig] + new int GetNearInstruction( + ulong Offset, + int Delta, + out ulong NearOffset); + + [PreserveSig] + new int GetStackTrace( + ulong FrameOffset, + ulong StackOffset, + ulong InstructionOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_STACK_FRAME[] Frames, + int FrameSize, + out uint FramesFilled); + + [PreserveSig] + new int GetReturnOffset( + out ulong Offset); + + [PreserveSig] + new int OutputStackTrace( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames, + int FramesSize, + DEBUG_STACK Flags); + + [PreserveSig] + new int GetDebuggeeType( + out DEBUG_CLASS Class, + out DEBUG_CLASS_QUALIFIER Qualifier); + + [PreserveSig] + new int GetActualProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetExecutingProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetNumberPossibleExecutingProcessorTypes( + out uint Number); + + [PreserveSig] + new int GetPossibleExecutingProcessorTypes( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + IMAGE_FILE_MACHINE[] Types); + + [PreserveSig] + new int GetNumberProcessors( + out uint Number); + + [PreserveSig] + new int GetSystemVersion( + out uint PlatformId, + out uint Major, + out uint Minor, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ServicePackString, + int ServicePackStringSize, + out uint ServicePackStringUsed, + out uint ServicePackNumber, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder BuildString, + int BuildStringSize, + out uint BuildStringUsed); + + [PreserveSig] + new int GetPageSize( + out uint Size); + + [PreserveSig] + new int IsPointer64Bit(); + + [PreserveSig] + new int ReadBugCheckData( + out uint Code, + out ulong Arg1, + out ulong Arg2, + out ulong Arg3, + out ulong Arg4); + + [PreserveSig] + new int GetNumberSupportedProcessorTypes( + out uint Number); + + [PreserveSig] + new int GetSupportedProcessorTypes( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + IMAGE_FILE_MACHINE[] Types); + + [PreserveSig] + new int GetProcessorTypeNames( + IMAGE_FILE_MACHINE Type, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + new int GetEffectiveProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int SetEffectiveProcessorType( + IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetExecutionStatus( + out DEBUG_STATUS Status); + + [PreserveSig] + new int SetExecutionStatus( + DEBUG_STATUS Status); + + [PreserveSig] + new int GetCodeLevel( + out DEBUG_LEVEL Level); + + [PreserveSig] + new int SetCodeLevel( + DEBUG_LEVEL Level); + + [PreserveSig] + new int GetEngineOptions( + out DEBUG_ENGOPT Options); + + [PreserveSig] + new int AddEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int RemoveEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int SetEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int GetSystemErrorControl( + out ERROR_LEVEL OutputLevel, + out ERROR_LEVEL BreakLevel); + + [PreserveSig] + new int SetSystemErrorControl( + ERROR_LEVEL OutputLevel, + ERROR_LEVEL BreakLevel); + + [PreserveSig] + new int GetTextMacro( + uint Slot, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint MacroSize); + + [PreserveSig] + new int SetTextMacro( + uint Slot, + [In][MarshalAs(UnmanagedType.LPStr)] string Macro); + + [PreserveSig] + new int GetRadix( + out uint Radix); + + [PreserveSig] + new int SetRadix( + uint Radix); + + [PreserveSig] + new int Evaluate( + [In][MarshalAs(UnmanagedType.LPStr)] string Expression, + DEBUG_VALUE_TYPE DesiredType, + out DEBUG_VALUE Value, + out uint RemainderIndex); + + [PreserveSig] + new int CoerceValue( + DEBUG_VALUE In, + DEBUG_VALUE_TYPE OutType, + out DEBUG_VALUE Out); + + [PreserveSig] + new int CoerceValues( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] In, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE_TYPE[] OutType, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_VALUE[] Out); + + [PreserveSig] + new int Execute( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Command, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int ExecuteCommandFile( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandFile, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int GetNumberBreakpoints( + out uint Number); + + [PreserveSig] + new int GetBreakpointByIndex( + uint Index, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint bp); + + [PreserveSig] + new int GetBreakpointById( + uint Id, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint bp); + + [PreserveSig] + new int GetBreakpointParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Ids, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_BREAKPOINT_PARAMETERS[] Params); + + [PreserveSig] + new int AddBreakpoint( + DEBUG_BREAKPOINT_TYPE Type, + uint DesiredId, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint Bp); + + [PreserveSig] + new int RemoveBreakpoint( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugBreakpoint Bp); + + [PreserveSig] + new int AddExtension( + [In][MarshalAs(UnmanagedType.LPStr)] string Path, + uint Flags, + out ulong Handle); + + [PreserveSig] + new int RemoveExtension( + ulong Handle); + + [PreserveSig] + new int GetExtensionByPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path, + out ulong Handle); + + [PreserveSig] + new int CallExtension( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPStr)] string Function, + [In][MarshalAs(UnmanagedType.LPStr)] string Arguments); + + [PreserveSig] + new int GetExtensionFunction( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPStr)] string FuncName, + out IntPtr Function); + + [PreserveSig] + new int GetWindbgExtensionApis32( + ref WINDBG_EXTENSION_APIS Api); + + /* Must be In and Out as the nSize member has to be initialized */ + + [PreserveSig] + new int GetWindbgExtensionApis64( + ref WINDBG_EXTENSION_APIS Api); + + /* Must be In and Out as the nSize member has to be initialized */ + + [PreserveSig] + new int GetNumberEventFilters( + out uint SpecificEvents, + out uint SpecificExceptions, + out uint ArbitraryExceptions); + + [PreserveSig] + new int GetEventFilterText( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int GetEventFilterCommand( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetEventFilterCommand( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + new int GetSpecificFilterParameters( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int SetSpecificFilterParameters( + uint Start, + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int GetSpecificEventFilterArgument( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ArgumentSize); + + [PreserveSig] + new int SetSpecificEventFilterArgument( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Argument); + + [PreserveSig] + new int GetExceptionFilterParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Codes, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int SetExceptionFilterParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int GetExceptionFilterSecondCommand( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetExceptionFilterSecondCommand( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + new int WaitForEvent( + DEBUG_WAIT Flags, + uint Timeout); + + [PreserveSig] + new int GetLastEventInformation( + out DEBUG_EVENT Type, + out uint ProcessId, + out uint ThreadId, + IntPtr ExtraInformation, + uint ExtraInformationSize, + out uint ExtraInformationUsed, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Description, + int DescriptionSize, + out uint DescriptionUsed); + + /* IDebugControl2 */ + + [PreserveSig] + new int GetCurrentTimeDate( + out uint TimeDate); + + [PreserveSig] + new int GetCurrentSystemUpTime( + out uint UpTime); + + [PreserveSig] + new int GetDumpFormatFlags( + out DEBUG_FORMAT FormatFlags); + + [PreserveSig] + new int GetNumberTextReplacements( + out uint NumRepl); + + [PreserveSig] + new int GetTextReplacement( + [In][MarshalAs(UnmanagedType.LPStr)] string SrcText, + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder SrcBuffer, + int SrcBufferSize, + out uint SrcSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder DstBuffer, + int DstBufferSize, + out uint DstSize); + + [PreserveSig] + new int SetTextReplacement( + [In][MarshalAs(UnmanagedType.LPStr)] string SrcText, + [In][MarshalAs(UnmanagedType.LPStr)] string DstText); + + [PreserveSig] + new int RemoveTextReplacements(); + + [PreserveSig] + new int OutputTextReplacements( + DEBUG_OUTCTL OutputControl, + DEBUG_OUT_TEXT_REPL Flags); + + /* IDebugControl3 */ + + [PreserveSig] + new int GetAssemblyOptions( + out DEBUG_ASMOPT Options); + + [PreserveSig] + new int AddAssemblyOptions( + DEBUG_ASMOPT Options); + + [PreserveSig] + new int RemoveAssemblyOptions( + DEBUG_ASMOPT Options); + + [PreserveSig] + new int SetAssemblyOptions( + DEBUG_ASMOPT Options); + + [PreserveSig] + new int GetExpressionSyntax( + out DEBUG_EXPR Flags); + + [PreserveSig] + new int SetExpressionSyntax( + DEBUG_EXPR Flags); + + [PreserveSig] + new int SetExpressionSyntaxByName( + [In][MarshalAs(UnmanagedType.LPStr)] string AbbrevName); + + [PreserveSig] + new int GetNumberExpressionSyntaxes( + out uint Number); + + [PreserveSig] + new int GetExpressionSyntaxNames( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + new int GetNumberEvents( + out uint Events); + + [PreserveSig] + new int GetEventIndexDescription( + uint Index, + DEBUG_EINDEX Which, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint DescSize); + + [PreserveSig] + new int GetCurrentEventIndex( + out uint Index); + + [PreserveSig] + new int SetNextEventIndex( + DEBUG_EINDEX Relation, + uint Value, + out uint NextIndex); + + /* IDebugControl4 */ + + [PreserveSig] + int GetLogFileWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + [Out][MarshalAs(UnmanagedType.Bool)] out bool Append); + + [PreserveSig] + int OpenLogFileWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + [In][MarshalAs(UnmanagedType.Bool)] bool Append); + + [PreserveSig] + int InputWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint InputSize); + + [PreserveSig] + int ReturnInputWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Buffer); + + [PreserveSig] + int OutputWide( + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format); + + [PreserveSig] + int OutputVaListWide( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + int ControlledOutputWide( + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format); + + [PreserveSig] + int ControlledOutputVaListWide( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + int OutputPromptWide( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format); + + [PreserveSig] + int OutputPromptVaListWide( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + int GetPromptTextWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + int AssembleWide( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPWStr)] string Instr, + out ulong EndOffset); + + [PreserveSig] + int DisassembleWide( + ulong Offset, + DEBUG_DISASM Flags, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint DisassemblySize, + out ulong EndOffset); + + [PreserveSig] + int GetProcessorTypeNamesWide( + IMAGE_FILE_MACHINE Type, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + int GetTextMacroWide( + uint Slot, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint MacroSize); + + [PreserveSig] + int SetTextMacroWide( + uint Slot, + [In][MarshalAs(UnmanagedType.LPWStr)] string Macro); + + [PreserveSig] + int EvaluateWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Expression, + DEBUG_VALUE_TYPE DesiredType, + out DEBUG_VALUE Value, + out uint RemainderIndex); + + [PreserveSig] + int ExecuteWide( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string Command, + DEBUG_EXECUTE Flags); + + [PreserveSig] + int ExecuteCommandFileWide( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandFile, + DEBUG_EXECUTE Flags); + + [PreserveSig] + int GetBreakpointByIndex2( + uint Index, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint2 bp); + + [PreserveSig] + int GetBreakpointById2( + uint Id, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint2 bp); + + [PreserveSig] + int AddBreakpoint2( + DEBUG_BREAKPOINT_TYPE Type, + uint DesiredId, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint2 Bp); + + [PreserveSig] + int RemoveBreakpoint2( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugBreakpoint2 Bp); + + [PreserveSig] + int AddExtensionWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path, + uint Flags, + out ulong Handle); + + [PreserveSig] + int GetExtensionByPathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path, + out ulong Handle); + + [PreserveSig] + int CallExtensionWide( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPWStr)] string Function, + [In][MarshalAs(UnmanagedType.LPWStr)] string Arguments); + + [PreserveSig] + int GetExtensionFunctionWide( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPWStr)] string FuncName, + out IntPtr Function); + + [PreserveSig] + int GetEventFilterTextWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + int GetEventFilterCommandWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + int SetEventFilterCommandWide( + uint Index, + [In][MarshalAs(UnmanagedType.LPWStr)] string Command); + + [PreserveSig] + int GetSpecificEventFilterArgumentWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint ArgumentSize); + + [PreserveSig] + int SetSpecificEventFilterArgumentWide( + uint Index, + [In][MarshalAs(UnmanagedType.LPWStr)] string Argument); + + [PreserveSig] + int GetExceptionFilterSecondCommandWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + int SetExceptionFilterSecondCommandWide( + uint Index, + [In][MarshalAs(UnmanagedType.LPWStr)] string Command); + + [PreserveSig] + int GetLastEventInformationWide( + out DEBUG_EVENT Type, + out uint ProcessId, + out uint ThreadId, + IntPtr ExtraInformation, + int ExtraInformationSize, + out uint ExtraInformationUsed, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Description, + int DescriptionSize, + out uint DescriptionUsed); + + [PreserveSig] + int GetTextReplacementWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string SrcText, + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder SrcBuffer, + int SrcBufferSize, + out uint SrcSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder DstBuffer, + int DstBufferSize, + out uint DstSize); + + [PreserveSig] + int SetTextReplacementWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string SrcText, + [In][MarshalAs(UnmanagedType.LPWStr)] string DstText); + + [PreserveSig] + int SetExpressionSyntaxByNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string AbbrevName); + + [PreserveSig] + int GetExpressionSyntaxNamesWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + int GetEventIndexDescriptionWide( + uint Index, + DEBUG_EINDEX Which, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint DescSize); + + [PreserveSig] + int GetLogFile2( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + out DEBUG_LOG Flags); + + [PreserveSig] + int OpenLogFile2( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + out DEBUG_LOG Flags); + + [PreserveSig] + int GetLogFile2Wide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + out DEBUG_LOG Flags); + + [PreserveSig] + int OpenLogFile2Wide( + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + out DEBUG_LOG Flags); + + [PreserveSig] + int GetSystemVersionValues( + out uint PlatformId, + out uint Win32Major, + out uint Win32Minor, + out uint KdMajor, + out uint KdMinor); + + [PreserveSig] + int GetSystemVersionString( + DEBUG_SYSVERSTR Which, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize); + + [PreserveSig] + int GetSystemVersionStringWide( + DEBUG_SYSVERSTR Which, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize); + + [PreserveSig] + int GetContextStackTrace( + IntPtr StartContext, + uint StartContextSize, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_STACK_FRAME[] Frames, + int FrameSize, + IntPtr FrameContexts, + uint FrameContextsSize, + uint FrameContextsEntrySize, + out uint FramesFilled); + + [PreserveSig] + int OutputContextStackTrace( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames, + int FramesSize, + IntPtr FrameContexts, + uint FrameContextsSize, + uint FrameContextsEntrySize, + DEBUG_STACK Flags); + + [PreserveSig] + int GetStoredEventInformation( + out DEBUG_EVENT Type, + out uint ProcessId, + out uint ThreadId, + IntPtr Context, + uint ContextSize, + out uint ContextUsed, + IntPtr ExtraInformation, + uint ExtraInformationSize, + out uint ExtraInformationUsed); + + [PreserveSig] + int GetManagedStatus( + out DEBUG_MANAGED Flags, + DEBUG_MANSTR WhichString, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder String, + int StringSize, + out uint StringNeeded); + + [PreserveSig] + int GetManagedStatusWide( + out DEBUG_MANAGED Flags, + DEBUG_MANSTR WhichString, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder String, + int StringSize, + out uint StringNeeded); + + [PreserveSig] + int ResetManagedStatus( + DEBUG_MANRESET Flags); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl5.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl5.cs new file mode 100644 index 0000000000..10284f171d --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl5.cs @@ -0,0 +1,1053 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("b2ffe162-2412-429f-8d1d-5bf6dd824696")] + public interface IDebugControl5 : IDebugControl4 + { + /* IDebugControl */ + + [PreserveSig] + new int GetInterrupt(); + + [PreserveSig] + new int SetInterrupt( + DEBUG_INTERRUPT Flags); + + [PreserveSig] + new int GetInterruptTimeout( + out uint Seconds); + + [PreserveSig] + new int SetInterruptTimeout( + uint Seconds); + + [PreserveSig] + new int GetLogFile( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + [Out][MarshalAs(UnmanagedType.Bool)] out bool Append); + + [PreserveSig] + new int OpenLogFile( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + [In][MarshalAs(UnmanagedType.Bool)] bool Append); + + [PreserveSig] + new int CloseLogFile(); + + [PreserveSig] + new int GetLogMask( + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetLogMask( + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int Input( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint InputSize); + + [PreserveSig] + new int ReturnInput( + [In][MarshalAs(UnmanagedType.LPStr)] string Buffer); + + [PreserveSig] + new int Output( + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int OutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int ControlledOutput( + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int ControlledOutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int OutputPrompt( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int OutputPromptVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int GetPromptText( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int OutputCurrentState( + DEBUG_OUTCTL OutputControl, + DEBUG_CURRENT Flags); + + [PreserveSig] + new int OutputVersionInformation( + DEBUG_OUTCTL OutputControl); + + [PreserveSig] + new int GetNotifyEventHandle( + out ulong Handle); + + [PreserveSig] + new int SetNotifyEventHandle( + ulong Handle); + + [PreserveSig] + new int Assemble( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPStr)] string Instr, + out ulong EndOffset); + + [PreserveSig] + new int Disassemble( + ulong Offset, + DEBUG_DISASM Flags, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint DisassemblySize, + out ulong EndOffset); + + [PreserveSig] + new int GetDisassembleEffectiveOffset( + out ulong Offset); + + [PreserveSig] + new int OutputDisassembly( + DEBUG_OUTCTL OutputControl, + ulong Offset, + DEBUG_DISASM Flags, + out ulong EndOffset); + + [PreserveSig] + new int OutputDisassemblyLines( + DEBUG_OUTCTL OutputControl, + uint PreviousLines, + uint TotalLines, + ulong Offset, + DEBUG_DISASM Flags, + out uint OffsetLine, + out ulong StartOffset, + out ulong EndOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] LineOffsets); + + [PreserveSig] + new int GetNearInstruction( + ulong Offset, + int Delta, + out ulong NearOffset); + + [PreserveSig] + new int GetStackTrace( + ulong FrameOffset, + ulong StackOffset, + ulong InstructionOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_STACK_FRAME[] Frames, + int FrameSize, + out uint FramesFilled); + + [PreserveSig] + new int GetReturnOffset( + out ulong Offset); + + [PreserveSig] + new int OutputStackTrace( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames, + int FramesSize, + DEBUG_STACK Flags); + + [PreserveSig] + new int GetDebuggeeType( + out DEBUG_CLASS Class, + out DEBUG_CLASS_QUALIFIER Qualifier); + + [PreserveSig] + new int GetActualProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetExecutingProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetNumberPossibleExecutingProcessorTypes( + out uint Number); + + [PreserveSig] + new int GetPossibleExecutingProcessorTypes( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + IMAGE_FILE_MACHINE[] Types); + + [PreserveSig] + new int GetNumberProcessors( + out uint Number); + + [PreserveSig] + new int GetSystemVersion( + out uint PlatformId, + out uint Major, + out uint Minor, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ServicePackString, + int ServicePackStringSize, + out uint ServicePackStringUsed, + out uint ServicePackNumber, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder BuildString, + int BuildStringSize, + out uint BuildStringUsed); + + [PreserveSig] + new int GetPageSize( + out uint Size); + + [PreserveSig] + new int IsPointer64Bit(); + + [PreserveSig] + new int ReadBugCheckData( + out uint Code, + out ulong Arg1, + out ulong Arg2, + out ulong Arg3, + out ulong Arg4); + + [PreserveSig] + new int GetNumberSupportedProcessorTypes( + out uint Number); + + [PreserveSig] + new int GetSupportedProcessorTypes( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + IMAGE_FILE_MACHINE[] Types); + + [PreserveSig] + new int GetProcessorTypeNames( + IMAGE_FILE_MACHINE Type, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + new int GetEffectiveProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int SetEffectiveProcessorType( + IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetExecutionStatus( + out DEBUG_STATUS Status); + + [PreserveSig] + new int SetExecutionStatus( + DEBUG_STATUS Status); + + [PreserveSig] + new int GetCodeLevel( + out DEBUG_LEVEL Level); + + [PreserveSig] + new int SetCodeLevel( + DEBUG_LEVEL Level); + + [PreserveSig] + new int GetEngineOptions( + out DEBUG_ENGOPT Options); + + [PreserveSig] + new int AddEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int RemoveEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int SetEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int GetSystemErrorControl( + out ERROR_LEVEL OutputLevel, + out ERROR_LEVEL BreakLevel); + + [PreserveSig] + new int SetSystemErrorControl( + ERROR_LEVEL OutputLevel, + ERROR_LEVEL BreakLevel); + + [PreserveSig] + new int GetTextMacro( + uint Slot, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint MacroSize); + + [PreserveSig] + new int SetTextMacro( + uint Slot, + [In][MarshalAs(UnmanagedType.LPStr)] string Macro); + + [PreserveSig] + new int GetRadix( + out uint Radix); + + [PreserveSig] + new int SetRadix( + uint Radix); + + [PreserveSig] + new int Evaluate( + [In][MarshalAs(UnmanagedType.LPStr)] string Expression, + DEBUG_VALUE_TYPE DesiredType, + out DEBUG_VALUE Value, + out uint RemainderIndex); + + [PreserveSig] + new int CoerceValue( + DEBUG_VALUE In, + DEBUG_VALUE_TYPE OutType, + out DEBUG_VALUE Out); + + [PreserveSig] + new int CoerceValues( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] In, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE_TYPE[] OutType, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_VALUE[] Out); + + [PreserveSig] + new int Execute( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Command, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int ExecuteCommandFile( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandFile, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int GetNumberBreakpoints( + out uint Number); + + [PreserveSig] + new int GetBreakpointByIndex( + uint Index, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint bp); + + [PreserveSig] + new int GetBreakpointById( + uint Id, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint bp); + + [PreserveSig] + new int GetBreakpointParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Ids, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_BREAKPOINT_PARAMETERS[] Params); + + [PreserveSig] + new int AddBreakpoint( + DEBUG_BREAKPOINT_TYPE Type, + uint DesiredId, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint Bp); + + [PreserveSig] + new int RemoveBreakpoint( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugBreakpoint Bp); + + [PreserveSig] + new int AddExtension( + [In][MarshalAs(UnmanagedType.LPStr)] string Path, + uint Flags, + out ulong Handle); + + [PreserveSig] + new int RemoveExtension( + ulong Handle); + + [PreserveSig] + new int GetExtensionByPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path, + out ulong Handle); + + [PreserveSig] + new int CallExtension( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPStr)] string Function, + [In][MarshalAs(UnmanagedType.LPStr)] string Arguments); + + [PreserveSig] + new int GetExtensionFunction( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPStr)] string FuncName, + out IntPtr Function); + + [PreserveSig] + new int GetWindbgExtensionApis32( + ref WINDBG_EXTENSION_APIS Api); + + /* Must be In and Out as the nSize member has to be initialized */ + + [PreserveSig] + new int GetWindbgExtensionApis64( + ref WINDBG_EXTENSION_APIS Api); + + /* Must be In and Out as the nSize member has to be initialized */ + + [PreserveSig] + new int GetNumberEventFilters( + out uint SpecificEvents, + out uint SpecificExceptions, + out uint ArbitraryExceptions); + + [PreserveSig] + new int GetEventFilterText( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int GetEventFilterCommand( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetEventFilterCommand( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + new int GetSpecificFilterParameters( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int SetSpecificFilterParameters( + uint Start, + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int GetSpecificEventFilterArgument( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ArgumentSize); + + [PreserveSig] + new int SetSpecificEventFilterArgument( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Argument); + + [PreserveSig] + new int GetExceptionFilterParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Codes, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int SetExceptionFilterParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int GetExceptionFilterSecondCommand( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetExceptionFilterSecondCommand( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + new int WaitForEvent( + DEBUG_WAIT Flags, + uint Timeout); + + [PreserveSig] + new int GetLastEventInformation( + out DEBUG_EVENT Type, + out uint ProcessId, + out uint ThreadId, + IntPtr ExtraInformation, + uint ExtraInformationSize, + out uint ExtraInformationUsed, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Description, + int DescriptionSize, + out uint DescriptionUsed); + + /* IDebugControl2 */ + + [PreserveSig] + new int GetCurrentTimeDate( + out uint TimeDate); + + [PreserveSig] + new int GetCurrentSystemUpTime( + out uint UpTime); + + [PreserveSig] + new int GetDumpFormatFlags( + out DEBUG_FORMAT FormatFlags); + + [PreserveSig] + new int GetNumberTextReplacements( + out uint NumRepl); + + [PreserveSig] + new int GetTextReplacement( + [In][MarshalAs(UnmanagedType.LPStr)] string SrcText, + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder SrcBuffer, + int SrcBufferSize, + out uint SrcSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder DstBuffer, + int DstBufferSize, + out uint DstSize); + + [PreserveSig] + new int SetTextReplacement( + [In][MarshalAs(UnmanagedType.LPStr)] string SrcText, + [In][MarshalAs(UnmanagedType.LPStr)] string DstText); + + [PreserveSig] + new int RemoveTextReplacements(); + + [PreserveSig] + new int OutputTextReplacements( + DEBUG_OUTCTL OutputControl, + DEBUG_OUT_TEXT_REPL Flags); + + /* IDebugControl3 */ + + [PreserveSig] + new int GetAssemblyOptions( + out DEBUG_ASMOPT Options); + + [PreserveSig] + new int AddAssemblyOptions( + DEBUG_ASMOPT Options); + + [PreserveSig] + new int RemoveAssemblyOptions( + DEBUG_ASMOPT Options); + + [PreserveSig] + new int SetAssemblyOptions( + DEBUG_ASMOPT Options); + + [PreserveSig] + new int GetExpressionSyntax( + out DEBUG_EXPR Flags); + + [PreserveSig] + new int SetExpressionSyntax( + DEBUG_EXPR Flags); + + [PreserveSig] + new int SetExpressionSyntaxByName( + [In][MarshalAs(UnmanagedType.LPStr)] string AbbrevName); + + [PreserveSig] + new int GetNumberExpressionSyntaxes( + out uint Number); + + [PreserveSig] + new int GetExpressionSyntaxNames( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + new int GetNumberEvents( + out uint Events); + + [PreserveSig] + new int GetEventIndexDescription( + uint Index, + DEBUG_EINDEX Which, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint DescSize); + + [PreserveSig] + new int GetCurrentEventIndex( + out uint Index); + + [PreserveSig] + new int SetNextEventIndex( + DEBUG_EINDEX Relation, + uint Value, + out uint NextIndex); + + /* IDebugControl4 */ + + [PreserveSig] + new int GetLogFileWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + [Out][MarshalAs(UnmanagedType.Bool)] out bool Append); + + [PreserveSig] + new int OpenLogFileWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + [In][MarshalAs(UnmanagedType.Bool)] bool Append); + + [PreserveSig] + new int InputWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint InputSize); + + [PreserveSig] + new int ReturnInputWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Buffer); + + [PreserveSig] + new int OutputWide( + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format); + + [PreserveSig] + new int OutputVaListWide( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int ControlledOutputWide( + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format); + + [PreserveSig] + new int ControlledOutputVaListWide( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int OutputPromptWide( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format); + + [PreserveSig] + new int OutputPromptVaListWide( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int GetPromptTextWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int AssembleWide( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPWStr)] string Instr, + out ulong EndOffset); + + [PreserveSig] + new int DisassembleWide( + ulong Offset, + DEBUG_DISASM Flags, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint DisassemblySize, + out ulong EndOffset); + + [PreserveSig] + new int GetProcessorTypeNamesWide( + IMAGE_FILE_MACHINE Type, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + new int GetTextMacroWide( + uint Slot, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint MacroSize); + + [PreserveSig] + new int SetTextMacroWide( + uint Slot, + [In][MarshalAs(UnmanagedType.LPWStr)] string Macro); + + [PreserveSig] + new int EvaluateWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Expression, + DEBUG_VALUE_TYPE DesiredType, + out DEBUG_VALUE Value, + out uint RemainderIndex); + + [PreserveSig] + new int ExecuteWide( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string Command, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int ExecuteCommandFileWide( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandFile, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int GetBreakpointByIndex2( + uint Index, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint2 bp); + + [PreserveSig] + new int GetBreakpointById2( + uint Id, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint2 bp); + + [PreserveSig] + new int AddBreakpoint2( + DEBUG_BREAKPOINT_TYPE Type, + uint DesiredId, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint2 Bp); + + [PreserveSig] + new int RemoveBreakpoint2( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugBreakpoint2 Bp); + + [PreserveSig] + new int AddExtensionWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path, + uint Flags, + out ulong Handle); + + [PreserveSig] + new int GetExtensionByPathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path, + out ulong Handle); + + [PreserveSig] + new int CallExtensionWide( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPWStr)] string Function, + [In][MarshalAs(UnmanagedType.LPWStr)] string Arguments); + + [PreserveSig] + new int GetExtensionFunctionWide( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPWStr)] string FuncName, + out IntPtr Function); + + [PreserveSig] + new int GetEventFilterTextWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int GetEventFilterCommandWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetEventFilterCommandWide( + uint Index, + [In][MarshalAs(UnmanagedType.LPWStr)] string Command); + + [PreserveSig] + new int GetSpecificEventFilterArgumentWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint ArgumentSize); + + [PreserveSig] + new int SetSpecificEventFilterArgumentWide( + uint Index, + [In][MarshalAs(UnmanagedType.LPWStr)] string Argument); + + [PreserveSig] + new int GetExceptionFilterSecondCommandWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetExceptionFilterSecondCommandWide( + uint Index, + [In][MarshalAs(UnmanagedType.LPWStr)] string Command); + + [PreserveSig] + new int GetLastEventInformationWide( + out DEBUG_EVENT Type, + out uint ProcessId, + out uint ThreadId, + IntPtr ExtraInformation, + int ExtraInformationSize, + out uint ExtraInformationUsed, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Description, + int DescriptionSize, + out uint DescriptionUsed); + + [PreserveSig] + new int GetTextReplacementWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string SrcText, + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder SrcBuffer, + int SrcBufferSize, + out uint SrcSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder DstBuffer, + int DstBufferSize, + out uint DstSize); + + [PreserveSig] + new int SetTextReplacementWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string SrcText, + [In][MarshalAs(UnmanagedType.LPWStr)] string DstText); + + [PreserveSig] + new int SetExpressionSyntaxByNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string AbbrevName); + + [PreserveSig] + new int GetExpressionSyntaxNamesWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + new int GetEventIndexDescriptionWide( + uint Index, + DEBUG_EINDEX Which, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint DescSize); + + [PreserveSig] + new int GetLogFile2( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + out DEBUG_LOG Flags); + + [PreserveSig] + new int OpenLogFile2( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + out DEBUG_LOG Flags); + + [PreserveSig] + new int GetLogFile2Wide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + out DEBUG_LOG Flags); + + [PreserveSig] + new int OpenLogFile2Wide( + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + out DEBUG_LOG Flags); + + [PreserveSig] + new int GetSystemVersionValues( + out uint PlatformId, + out uint Win32Major, + out uint Win32Minor, + out uint KdMajor, + out uint KdMinor); + + [PreserveSig] + new int GetSystemVersionString( + DEBUG_SYSVERSTR Which, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize); + + [PreserveSig] + new int GetSystemVersionStringWide( + DEBUG_SYSVERSTR Which, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize); + + [PreserveSig] + new int GetContextStackTrace( + IntPtr StartContext, + uint StartContextSize, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_STACK_FRAME[] Frames, + int FrameSize, + IntPtr FrameContexts, + uint FrameContextsSize, + uint FrameContextsEntrySize, + out uint FramesFilled); + + [PreserveSig] + new int OutputContextStackTrace( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames, + int FramesSize, + IntPtr FrameContexts, + uint FrameContextsSize, + uint FrameContextsEntrySize, + DEBUG_STACK Flags); + + [PreserveSig] + new int GetStoredEventInformation( + out DEBUG_EVENT Type, + out uint ProcessId, + out uint ThreadId, + IntPtr Context, + uint ContextSize, + out uint ContextUsed, + IntPtr ExtraInformation, + uint ExtraInformationSize, + out uint ExtraInformationUsed); + + [PreserveSig] + new int GetManagedStatus( + out DEBUG_MANAGED Flags, + DEBUG_MANSTR WhichString, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder String, + int StringSize, + out uint StringNeeded); + + [PreserveSig] + new int GetManagedStatusWide( + out DEBUG_MANAGED Flags, + DEBUG_MANSTR WhichString, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder String, + int StringSize, + out uint StringNeeded); + + [PreserveSig] + new int ResetManagedStatus( + DEBUG_MANRESET Flags); + + /* IDebugControl5 */ + + [PreserveSig] + int GetStackTraceEx( + ulong FrameOffset, + ulong StackOffset, + ulong InstructionOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_STACK_FRAME_EX[] Frames, + int FramesSize, + out uint FramesFilled); + + [PreserveSig] + int OutputStackTraceEx( + uint OutputControl, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME_EX[] Frames, + int FramesSize, + DEBUG_STACK Flags); + + [PreserveSig] + int GetContextStackTraceEx( + IntPtr StartContext, + uint StartContextSize, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_STACK_FRAME_EX[] Frames, + int FramesSize, + IntPtr FrameContexts, + uint FrameContextsSize, + uint FrameContextsEntrySize, + out uint FramesFilled); + + [PreserveSig] + int OutputContextStackTraceEx( + uint OutputControl, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME_EX[] Frames, + int FramesSize, + IntPtr FrameContexts, + uint FrameContextsSize, + uint FrameContextsEntrySize, + DEBUG_STACK Flags); + + [PreserveSig] + int GetBreakpointByGuid( + [In][MarshalAs(UnmanagedType.LPStruct)] + Guid Guid, + out IDebugBreakpoint3 Bp); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl6.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl6.cs new file mode 100644 index 0000000000..bbe60d400b --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugControl6.cs @@ -0,0 +1,1063 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("bc0d583f-126d-43a1-9cc4-a860ab1d537b")] + public interface IDebugControl6 : IDebugControl5 + { + /* IDebugControl */ + + [PreserveSig] + new int GetInterrupt(); + + [PreserveSig] + new int SetInterrupt( + DEBUG_INTERRUPT Flags); + + [PreserveSig] + new int GetInterruptTimeout( + out uint Seconds); + + [PreserveSig] + new int SetInterruptTimeout( + uint Seconds); + + [PreserveSig] + new int GetLogFile( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + [Out][MarshalAs(UnmanagedType.Bool)] out bool Append); + + [PreserveSig] + new int OpenLogFile( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + [In][MarshalAs(UnmanagedType.Bool)] bool Append); + + [PreserveSig] + new int CloseLogFile(); + + [PreserveSig] + new int GetLogMask( + out DEBUG_OUTPUT Mask); + + [PreserveSig] + new int SetLogMask( + DEBUG_OUTPUT Mask); + + [PreserveSig] + new int Input( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint InputSize); + + [PreserveSig] + new int ReturnInput( + [In][MarshalAs(UnmanagedType.LPStr)] string Buffer); + + [PreserveSig] + new int Output( + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int OutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int ControlledOutput( + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int ControlledOutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int OutputPrompt( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Format); + + [PreserveSig] + new int OutputPromptVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int GetPromptText( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int OutputCurrentState( + DEBUG_OUTCTL OutputControl, + DEBUG_CURRENT Flags); + + [PreserveSig] + new int OutputVersionInformation( + DEBUG_OUTCTL OutputControl); + + [PreserveSig] + new int GetNotifyEventHandle( + out ulong Handle); + + [PreserveSig] + new int SetNotifyEventHandle( + ulong Handle); + + [PreserveSig] + new int Assemble( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPStr)] string Instr, + out ulong EndOffset); + + [PreserveSig] + new int Disassemble( + ulong Offset, + DEBUG_DISASM Flags, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint DisassemblySize, + out ulong EndOffset); + + [PreserveSig] + new int GetDisassembleEffectiveOffset( + out ulong Offset); + + [PreserveSig] + new int OutputDisassembly( + DEBUG_OUTCTL OutputControl, + ulong Offset, + DEBUG_DISASM Flags, + out ulong EndOffset); + + [PreserveSig] + new int OutputDisassemblyLines( + DEBUG_OUTCTL OutputControl, + uint PreviousLines, + uint TotalLines, + ulong Offset, + DEBUG_DISASM Flags, + out uint OffsetLine, + out ulong StartOffset, + out ulong EndOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] LineOffsets); + + [PreserveSig] + new int GetNearInstruction( + ulong Offset, + int Delta, + out ulong NearOffset); + + [PreserveSig] + new int GetStackTrace( + ulong FrameOffset, + ulong StackOffset, + ulong InstructionOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_STACK_FRAME[] Frames, + int FrameSize, + out uint FramesFilled); + + [PreserveSig] + new int GetReturnOffset( + out ulong Offset); + + [PreserveSig] + new int OutputStackTrace( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames, + int FramesSize, + DEBUG_STACK Flags); + + [PreserveSig] + new int GetDebuggeeType( + out DEBUG_CLASS Class, + out DEBUG_CLASS_QUALIFIER Qualifier); + + [PreserveSig] + new int GetActualProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetExecutingProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetNumberPossibleExecutingProcessorTypes( + out uint Number); + + [PreserveSig] + new int GetPossibleExecutingProcessorTypes( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + IMAGE_FILE_MACHINE[] Types); + + [PreserveSig] + new int GetNumberProcessors( + out uint Number); + + [PreserveSig] + new int GetSystemVersion( + out uint PlatformId, + out uint Major, + out uint Minor, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ServicePackString, + int ServicePackStringSize, + out uint ServicePackStringUsed, + out uint ServicePackNumber, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder BuildString, + int BuildStringSize, + out uint BuildStringUsed); + + [PreserveSig] + new int GetPageSize( + out uint Size); + + [PreserveSig] + new int IsPointer64Bit(); + + [PreserveSig] + new int ReadBugCheckData( + out uint Code, + out ulong Arg1, + out ulong Arg2, + out ulong Arg3, + out ulong Arg4); + + [PreserveSig] + new int GetNumberSupportedProcessorTypes( + out uint Number); + + [PreserveSig] + new int GetSupportedProcessorTypes( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + IMAGE_FILE_MACHINE[] Types); + + [PreserveSig] + new int GetProcessorTypeNames( + IMAGE_FILE_MACHINE Type, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + new int GetEffectiveProcessorType( + out IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int SetEffectiveProcessorType( + IMAGE_FILE_MACHINE Type); + + [PreserveSig] + new int GetExecutionStatus( + out DEBUG_STATUS Status); + + [PreserveSig] + new int SetExecutionStatus( + DEBUG_STATUS Status); + + [PreserveSig] + new int GetCodeLevel( + out DEBUG_LEVEL Level); + + [PreserveSig] + new int SetCodeLevel( + DEBUG_LEVEL Level); + + [PreserveSig] + new int GetEngineOptions( + out DEBUG_ENGOPT Options); + + [PreserveSig] + new int AddEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int RemoveEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int SetEngineOptions( + DEBUG_ENGOPT Options); + + [PreserveSig] + new int GetSystemErrorControl( + out ERROR_LEVEL OutputLevel, + out ERROR_LEVEL BreakLevel); + + [PreserveSig] + new int SetSystemErrorControl( + ERROR_LEVEL OutputLevel, + ERROR_LEVEL BreakLevel); + + [PreserveSig] + new int GetTextMacro( + uint Slot, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint MacroSize); + + [PreserveSig] + new int SetTextMacro( + uint Slot, + [In][MarshalAs(UnmanagedType.LPStr)] string Macro); + + [PreserveSig] + new int GetRadix( + out uint Radix); + + [PreserveSig] + new int SetRadix( + uint Radix); + + [PreserveSig] + new int Evaluate( + [In][MarshalAs(UnmanagedType.LPStr)] string Expression, + DEBUG_VALUE_TYPE DesiredType, + out DEBUG_VALUE Value, + out uint RemainderIndex); + + [PreserveSig] + new int CoerceValue( + DEBUG_VALUE In, + DEBUG_VALUE_TYPE OutType, + out DEBUG_VALUE Out); + + [PreserveSig] + new int CoerceValues( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] In, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE_TYPE[] OutType, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_VALUE[] Out); + + [PreserveSig] + new int Execute( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string Command, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int ExecuteCommandFile( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPStr)] string CommandFile, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int GetNumberBreakpoints( + out uint Number); + + [PreserveSig] + new int GetBreakpointByIndex( + uint Index, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint bp); + + [PreserveSig] + new int GetBreakpointById( + uint Id, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint bp); + + [PreserveSig] + new int GetBreakpointParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Ids, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_BREAKPOINT_PARAMETERS[] Params); + + [PreserveSig] + new int AddBreakpoint( + DEBUG_BREAKPOINT_TYPE Type, + uint DesiredId, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint Bp); + + [PreserveSig] + new int RemoveBreakpoint( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugBreakpoint Bp); + + [PreserveSig] + new int AddExtension( + [In][MarshalAs(UnmanagedType.LPStr)] string Path, + uint Flags, + out ulong Handle); + + [PreserveSig] + new int RemoveExtension( + ulong Handle); + + [PreserveSig] + new int GetExtensionByPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path, + out ulong Handle); + + [PreserveSig] + new int CallExtension( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPStr)] string Function, + [In][MarshalAs(UnmanagedType.LPStr)] string Arguments); + + [PreserveSig] + new int GetExtensionFunction( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPStr)] string FuncName, + out IntPtr Function); + + [PreserveSig] + new int GetWindbgExtensionApis32( + ref WINDBG_EXTENSION_APIS Api); + + /* Must be In and Out as the nSize member has to be initialized */ + + [PreserveSig] + new int GetWindbgExtensionApis64( + ref WINDBG_EXTENSION_APIS Api); + + /* Must be In and Out as the nSize member has to be initialized */ + + [PreserveSig] + new int GetNumberEventFilters( + out uint SpecificEvents, + out uint SpecificExceptions, + out uint ArbitraryExceptions); + + [PreserveSig] + new int GetEventFilterText( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int GetEventFilterCommand( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetEventFilterCommand( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + new int GetSpecificFilterParameters( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int SetSpecificFilterParameters( + uint Start, + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int GetSpecificEventFilterArgument( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ArgumentSize); + + [PreserveSig] + new int SetSpecificEventFilterArgument( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Argument); + + [PreserveSig] + new int GetExceptionFilterParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Codes, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int SetExceptionFilterParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params); + + [PreserveSig] + new int GetExceptionFilterSecondCommand( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetExceptionFilterSecondCommand( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Command); + + [PreserveSig] + new int WaitForEvent( + DEBUG_WAIT Flags, + uint Timeout); + + [PreserveSig] + new int GetLastEventInformation( + out DEBUG_EVENT Type, + out uint ProcessId, + out uint ThreadId, + IntPtr ExtraInformation, + uint ExtraInformationSize, + out uint ExtraInformationUsed, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Description, + int DescriptionSize, + out uint DescriptionUsed); + + /* IDebugControl2 */ + + [PreserveSig] + new int GetCurrentTimeDate( + out uint TimeDate); + + [PreserveSig] + new int GetCurrentSystemUpTime( + out uint UpTime); + + [PreserveSig] + new int GetDumpFormatFlags( + out DEBUG_FORMAT FormatFlags); + + [PreserveSig] + new int GetNumberTextReplacements( + out uint NumRepl); + + [PreserveSig] + new int GetTextReplacement( + [In][MarshalAs(UnmanagedType.LPStr)] string SrcText, + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder SrcBuffer, + int SrcBufferSize, + out uint SrcSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder DstBuffer, + int DstBufferSize, + out uint DstSize); + + [PreserveSig] + new int SetTextReplacement( + [In][MarshalAs(UnmanagedType.LPStr)] string SrcText, + [In][MarshalAs(UnmanagedType.LPStr)] string DstText); + + [PreserveSig] + new int RemoveTextReplacements(); + + [PreserveSig] + new int OutputTextReplacements( + DEBUG_OUTCTL OutputControl, + DEBUG_OUT_TEXT_REPL Flags); + + /* IDebugControl3 */ + + [PreserveSig] + new int GetAssemblyOptions( + out DEBUG_ASMOPT Options); + + [PreserveSig] + new int AddAssemblyOptions( + DEBUG_ASMOPT Options); + + [PreserveSig] + new int RemoveAssemblyOptions( + DEBUG_ASMOPT Options); + + [PreserveSig] + new int SetAssemblyOptions( + DEBUG_ASMOPT Options); + + [PreserveSig] + new int GetExpressionSyntax( + out DEBUG_EXPR Flags); + + [PreserveSig] + new int SetExpressionSyntax( + DEBUG_EXPR Flags); + + [PreserveSig] + new int SetExpressionSyntaxByName( + [In][MarshalAs(UnmanagedType.LPStr)] string AbbrevName); + + [PreserveSig] + new int GetNumberExpressionSyntaxes( + out uint Number); + + [PreserveSig] + new int GetExpressionSyntaxNames( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + new int GetNumberEvents( + out uint Events); + + [PreserveSig] + new int GetEventIndexDescription( + uint Index, + DEBUG_EINDEX Which, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint DescSize); + + [PreserveSig] + new int GetCurrentEventIndex( + out uint Index); + + [PreserveSig] + new int SetNextEventIndex( + DEBUG_EINDEX Relation, + uint Value, + out uint NextIndex); + + /* IDebugControl4 */ + + [PreserveSig] + new int GetLogFileWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + [Out][MarshalAs(UnmanagedType.Bool)] out bool Append); + + [PreserveSig] + new int OpenLogFileWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + [In][MarshalAs(UnmanagedType.Bool)] bool Append); + + [PreserveSig] + new int InputWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint InputSize); + + [PreserveSig] + new int ReturnInputWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Buffer); + + [PreserveSig] + new int OutputWide( + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format); + + [PreserveSig] + new int OutputVaListWide( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int ControlledOutputWide( + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format); + + [PreserveSig] + new int ControlledOutputVaListWide( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int OutputPromptWide( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format); + + [PreserveSig] + new int OutputPromptVaListWide( /* THIS SHOULD NEVER BE CALLED FROM C# */ + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string Format, + IntPtr va_list_Args); + + [PreserveSig] + new int GetPromptTextWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int AssembleWide( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPWStr)] string Instr, + out ulong EndOffset); + + [PreserveSig] + new int DisassembleWide( + ulong Offset, + DEBUG_DISASM Flags, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint DisassemblySize, + out ulong EndOffset); + + [PreserveSig] + new int GetProcessorTypeNamesWide( + IMAGE_FILE_MACHINE Type, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + new int GetTextMacroWide( + uint Slot, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint MacroSize); + + [PreserveSig] + new int SetTextMacroWide( + uint Slot, + [In][MarshalAs(UnmanagedType.LPWStr)] string Macro); + + [PreserveSig] + new int EvaluateWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Expression, + DEBUG_VALUE_TYPE DesiredType, + out DEBUG_VALUE Value, + out uint RemainderIndex); + + [PreserveSig] + new int ExecuteWide( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string Command, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int ExecuteCommandFileWide( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPWStr)] string CommandFile, + DEBUG_EXECUTE Flags); + + [PreserveSig] + new int GetBreakpointByIndex2( + uint Index, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint2 bp); + + [PreserveSig] + new int GetBreakpointById2( + uint Id, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint2 bp); + + [PreserveSig] + new int AddBreakpoint2( + DEBUG_BREAKPOINT_TYPE Type, + uint DesiredId, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugBreakpoint2 Bp); + + [PreserveSig] + new int RemoveBreakpoint2( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugBreakpoint2 Bp); + + [PreserveSig] + new int AddExtensionWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path, + uint Flags, + out ulong Handle); + + [PreserveSig] + new int GetExtensionByPathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path, + out ulong Handle); + + [PreserveSig] + new int CallExtensionWide( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPWStr)] string Function, + [In][MarshalAs(UnmanagedType.LPWStr)] string Arguments); + + [PreserveSig] + new int GetExtensionFunctionWide( + ulong Handle, + [In][MarshalAs(UnmanagedType.LPWStr)] string FuncName, + out IntPtr Function); + + [PreserveSig] + new int GetEventFilterTextWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint TextSize); + + [PreserveSig] + new int GetEventFilterCommandWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetEventFilterCommandWide( + uint Index, + [In][MarshalAs(UnmanagedType.LPWStr)] string Command); + + [PreserveSig] + new int GetSpecificEventFilterArgumentWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint ArgumentSize); + + [PreserveSig] + new int SetSpecificEventFilterArgumentWide( + uint Index, + [In][MarshalAs(UnmanagedType.LPWStr)] string Argument); + + [PreserveSig] + new int GetExceptionFilterSecondCommandWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint CommandSize); + + [PreserveSig] + new int SetExceptionFilterSecondCommandWide( + uint Index, + [In][MarshalAs(UnmanagedType.LPWStr)] string Command); + + [PreserveSig] + new int GetLastEventInformationWide( + out DEBUG_EVENT Type, + out uint ProcessId, + out uint ThreadId, + IntPtr ExtraInformation, + int ExtraInformationSize, + out uint ExtraInformationUsed, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Description, + int DescriptionSize, + out uint DescriptionUsed); + + [PreserveSig] + new int GetTextReplacementWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string SrcText, + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder SrcBuffer, + int SrcBufferSize, + out uint SrcSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder DstBuffer, + int DstBufferSize, + out uint DstSize); + + [PreserveSig] + new int SetTextReplacementWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string SrcText, + [In][MarshalAs(UnmanagedType.LPWStr)] string DstText); + + [PreserveSig] + new int SetExpressionSyntaxByNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string AbbrevName); + + [PreserveSig] + new int GetExpressionSyntaxNamesWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder FullNameBuffer, + int FullNameBufferSize, + out uint FullNameSize, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder AbbrevNameBuffer, + int AbbrevNameBufferSize, + out uint AbbrevNameSize); + + [PreserveSig] + new int GetEventIndexDescriptionWide( + uint Index, + DEBUG_EINDEX Which, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint DescSize); + + [PreserveSig] + new int GetLogFile2( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + out DEBUG_LOG Flags); + + [PreserveSig] + new int OpenLogFile2( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + out DEBUG_LOG Flags); + + [PreserveSig] + new int GetLogFile2Wide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint FileSize, + out DEBUG_LOG Flags); + + [PreserveSig] + new int OpenLogFile2Wide( + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + out DEBUG_LOG Flags); + + [PreserveSig] + new int GetSystemVersionValues( + out uint PlatformId, + out uint Win32Major, + out uint Win32Minor, + out uint KdMajor, + out uint KdMinor); + + [PreserveSig] + new int GetSystemVersionString( + DEBUG_SYSVERSTR Which, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize); + + [PreserveSig] + new int GetSystemVersionStringWide( + DEBUG_SYSVERSTR Which, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize); + + [PreserveSig] + new int GetContextStackTrace( + IntPtr StartContext, + uint StartContextSize, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_STACK_FRAME[] Frames, + int FrameSize, + IntPtr FrameContexts, + uint FrameContextsSize, + uint FrameContextsEntrySize, + out uint FramesFilled); + + [PreserveSig] + new int OutputContextStackTrace( + DEBUG_OUTCTL OutputControl, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames, + int FramesSize, + IntPtr FrameContexts, + uint FrameContextsSize, + uint FrameContextsEntrySize, + DEBUG_STACK Flags); + + [PreserveSig] + new int GetStoredEventInformation( + out DEBUG_EVENT Type, + out uint ProcessId, + out uint ThreadId, + IntPtr Context, + uint ContextSize, + out uint ContextUsed, + IntPtr ExtraInformation, + uint ExtraInformationSize, + out uint ExtraInformationUsed); + + [PreserveSig] + new int GetManagedStatus( + out DEBUG_MANAGED Flags, + DEBUG_MANSTR WhichString, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder String, + int StringSize, + out uint StringNeeded); + + [PreserveSig] + new int GetManagedStatusWide( + out DEBUG_MANAGED Flags, + DEBUG_MANSTR WhichString, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder String, + int StringSize, + out uint StringNeeded); + + [PreserveSig] + new int ResetManagedStatus( + DEBUG_MANRESET Flags); + + /* IDebugControl5 */ + + [PreserveSig] + new int GetStackTraceEx( + ulong FrameOffset, + ulong StackOffset, + ulong InstructionOffset, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_STACK_FRAME_EX[] Frames, + int FramesSize, + out uint FramesFilled); + + [PreserveSig] + new int OutputStackTraceEx( + uint OutputControl, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME_EX[] Frames, + int FramesSize, + DEBUG_STACK Flags); + + [PreserveSig] + new int GetContextStackTraceEx( + IntPtr StartContext, + uint StartContextSize, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_STACK_FRAME_EX[] Frames, + int FramesSize, + IntPtr FrameContexts, + uint FrameContextsSize, + uint FrameContextsEntrySize, + out uint FramesFilled); + + [PreserveSig] + new int OutputContextStackTraceEx( + uint OutputControl, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME_EX[] Frames, + int FramesSize, + IntPtr FrameContexts, + uint FrameContextsSize, + uint FrameContextsEntrySize, + DEBUG_STACK Flags); + + [PreserveSig] + new int GetBreakpointByGuid( + [In][MarshalAs(UnmanagedType.LPStruct)] + Guid Guid, + out IDebugBreakpoint3 Bp); + + /* IDebugControl6 */ + + [PreserveSig] + int GetExecutionStatusEx(out DEBUG_STATUS Status); + + [PreserveSig] + int GetSynchronizationStatus( + out uint SendsAttempted, + out uint SecondsSinceLastResponse); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugDataSpaces.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugDataSpaces.cs new file mode 100644 index 0000000000..aedd2a3e28 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugDataSpaces.cs @@ -0,0 +1,336 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("88f7dfab-3ea7-4c3a-aefb-c4e8106173aa")] + public interface IDebugDataSpaces + { + /* IDebugDataSpaces */ + + [PreserveSig] + int ReadVirtual( + ulong Offset, + [Out] + IntPtr buffer, + int BufferSize, + out int BytesRead); + + [PreserveSig] + int WriteVirtual( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + int SearchVirtual( + ulong Offset, + ulong Length, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] pattern, + uint PatternSize, + uint PatternGranularity, + out ulong MatchOffset); + + [PreserveSig] + int ReadVirtualUncached( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + int WriteVirtualUncached( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + int ReadPointersVirtual( + uint Count, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] + ulong[] Ptrs); + + [PreserveSig] + int WritePointersVirtual( + uint Count, + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray)] ulong[] Ptrs); + + [PreserveSig] + int ReadPhysical( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + int WritePhysical( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + int ReadControl( + uint Processor, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + int BufferSize, + out uint BytesRead); + + [PreserveSig] + int WriteControl( + uint Processor, + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + int BufferSize, + out uint BytesWritten); + + [PreserveSig] + int ReadIo( + INTERFACE_TYPE InterfaceType, + uint BusNumber, + uint AddressSpace, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + int WriteIo( + INTERFACE_TYPE InterfaceType, + uint BusNumber, + uint AddressSpace, + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + int ReadMsr( + uint Msr, + out ulong MsrValue); + + [PreserveSig] + int WriteMsr( + uint Msr, + ulong MsrValue); + + [PreserveSig] + int ReadBusData( + BUS_DATA_TYPE BusDataType, + uint BusNumber, + uint SlotNumber, + uint Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + int WriteBusData( + BUS_DATA_TYPE BusDataType, + uint BusNumber, + uint SlotNumber, + uint Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + int CheckLowMemory(); + + [PreserveSig] + int ReadDebuggerData( + uint Index, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint DataSize); + + [PreserveSig] + int ReadProcessorSystemData( + uint Processor, + DEBUG_DATA Index, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint BufferSize, + out uint DataSize); + } + + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("88f7dfab-3ea7-4c3a-aefb-c4e8106173aa")] + public interface IDebugDataSpacesPtr + { + /* IDebugDataSpaces */ + + [PreserveSig] + int ReadVirtual( + ulong Offset, + IntPtr buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + int WriteVirtual( + ulong Offset, + IntPtr buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + int SearchVirtual( + ulong Offset, + ulong Length, + IntPtr pattern, + uint PatternSize, + uint PatternGranularity, + out ulong MatchOffset); + + [PreserveSig] + int ReadVirtualUncached( + ulong Offset, + IntPtr buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + int WriteVirtualUncached( + ulong Offset, + IntPtr buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + int ReadPointersVirtual( + uint Count, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] + ulong[] Ptrs); + + [PreserveSig] + int WritePointersVirtual( + uint Count, + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray)] ulong[] Ptrs); + + [PreserveSig] + int ReadPhysical( + ulong Offset, + IntPtr buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + int WritePhysical( + ulong Offset, + IntPtr buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + int ReadControl( + uint Processor, + ulong Offset, + IntPtr buffer, + int BufferSize, + out uint BytesRead); + + [PreserveSig] + int WriteControl( + uint Processor, + ulong Offset, + IntPtr buffer, + int BufferSize, + out uint BytesWritten); + + [PreserveSig] + int ReadIo( + INTERFACE_TYPE InterfaceType, + uint BusNumber, + uint AddressSpace, + ulong Offset, + IntPtr buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + int WriteIo( + INTERFACE_TYPE InterfaceType, + uint BusNumber, + uint AddressSpace, + ulong Offset, + IntPtr buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + int ReadMsr( + uint Msr, + out ulong MsrValue); + + [PreserveSig] + int WriteMsr( + uint Msr, + ulong MsrValue); + + [PreserveSig] + int ReadBusData( + BUS_DATA_TYPE BusDataType, + uint BusNumber, + uint SlotNumber, + uint Offset, + IntPtr buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + int WriteBusData( + BUS_DATA_TYPE BusDataType, + uint BusNumber, + uint SlotNumber, + uint Offset, + IntPtr buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + int CheckLowMemory(); + + [PreserveSig] + int ReadDebuggerData( + uint Index, + IntPtr buffer, + uint BufferSize, + out uint DataSize); + + [PreserveSig] + int ReadProcessorSystemData( + uint Processor, + DEBUG_DATA Index, + IntPtr buffer, + uint BufferSize, + out uint DataSize); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugDataSpaces2.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugDataSpaces2.cs new file mode 100644 index 0000000000..afd9c3477d --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugDataSpaces2.cs @@ -0,0 +1,227 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("7a5e852f-96e9-468f-ac1b-0b3addc4a049")] + public interface IDebugDataSpaces2 : IDebugDataSpaces + { + /* IDebugDataSpaces */ + + [PreserveSig] + new int ReadVirtual( + ulong Offset, + [Out] + IntPtr buffer, + int BufferSize, + out int BytesRead); + + [PreserveSig] + new int WriteVirtual( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int SearchVirtual( + ulong Offset, + ulong Length, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] pattern, + uint PatternSize, + uint PatternGranularity, + out ulong MatchOffset); + + [PreserveSig] + new int ReadVirtualUncached( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteVirtualUncached( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int ReadPointersVirtual( + uint Count, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] + ulong[] Ptrs); + + [PreserveSig] + new int WritePointersVirtual( + uint Count, + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray)] ulong[] Ptrs); + + [PreserveSig] + new int ReadPhysical( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WritePhysical( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int ReadControl( + uint Processor, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + int BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteControl( + uint Processor, + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + int BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int ReadIo( + INTERFACE_TYPE InterfaceType, + uint BusNumber, + uint AddressSpace, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteIo( + INTERFACE_TYPE InterfaceType, + uint BusNumber, + uint AddressSpace, + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int ReadMsr( + uint Msr, + out ulong MsrValue); + + [PreserveSig] + new int WriteMsr( + uint Msr, + ulong MsrValue); + + [PreserveSig] + new int ReadBusData( + BUS_DATA_TYPE BusDataType, + uint BusNumber, + uint SlotNumber, + uint Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteBusData( + BUS_DATA_TYPE BusDataType, + uint BusNumber, + uint SlotNumber, + uint Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int CheckLowMemory(); + + [PreserveSig] + new int ReadDebuggerData( + uint Index, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint DataSize); + + [PreserveSig] + new int ReadProcessorSystemData( + uint Processor, + DEBUG_DATA Index, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint BufferSize, + out uint DataSize); + + /* IDebugDataSpaces2 */ + + [PreserveSig] + int VirtualToPhysical( + ulong Virtual, + out ulong Physical); + + [PreserveSig] + int GetVirtualTranslationPhysicalOffsets( + ulong Virtual, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Offsets, + uint OffsetsSize, + out uint Levels); + + [PreserveSig] + int ReadHandleData( + ulong Handle, + DEBUG_HANDLE_DATA_TYPE DataType, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint BufferSize, + out uint DataSize); + + [PreserveSig] + int FillVirtual( + ulong Start, + uint Size, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint PatternSize, + out uint Filled); + + [PreserveSig] + int FillPhysical( + ulong Start, + uint Size, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint PatternSize, + out uint Filled); + + [PreserveSig] + int QueryVirtual( + ulong Offset, + out MEMORY_BASIC_INFORMATION64 Info); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugDataSpaces3.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugDataSpaces3.cs new file mode 100644 index 0000000000..e995460693 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugDataSpaces3.cs @@ -0,0 +1,258 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("23f79d6c-8aaf-4f7c-a607-9995f5407e63")] + public interface IDebugDataSpaces3 : IDebugDataSpaces2 + { + /* IDebugDataSpaces */ + + [PreserveSig] + new int ReadVirtual( + ulong Offset, + [Out] + IntPtr buffer, + int BufferSize, + out int BytesRead); + + [PreserveSig] + new int WriteVirtual( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int SearchVirtual( + ulong Offset, + ulong Length, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] pattern, + uint PatternSize, + uint PatternGranularity, + out ulong MatchOffset); + + [PreserveSig] + new int ReadVirtualUncached( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteVirtualUncached( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int ReadPointersVirtual( + uint Count, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] + ulong[] Ptrs); + + [PreserveSig] + new int WritePointersVirtual( + uint Count, + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray)] ulong[] Ptrs); + + [PreserveSig] + new int ReadPhysical( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WritePhysical( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int ReadControl( + uint Processor, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + int BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteControl( + uint Processor, + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + int BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int ReadIo( + INTERFACE_TYPE InterfaceType, + uint BusNumber, + uint AddressSpace, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteIo( + INTERFACE_TYPE InterfaceType, + uint BusNumber, + uint AddressSpace, + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int ReadMsr( + uint Msr, + out ulong MsrValue); + + [PreserveSig] + new int WriteMsr( + uint Msr, + ulong MsrValue); + + [PreserveSig] + new int ReadBusData( + BUS_DATA_TYPE BusDataType, + uint BusNumber, + uint SlotNumber, + uint Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteBusData( + BUS_DATA_TYPE BusDataType, + uint BusNumber, + uint SlotNumber, + uint Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int CheckLowMemory(); + + [PreserveSig] + new int ReadDebuggerData( + uint Index, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint DataSize); + + [PreserveSig] + new int ReadProcessorSystemData( + uint Processor, + DEBUG_DATA Index, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint BufferSize, + out uint DataSize); + + /* IDebugDataSpaces2 */ + + [PreserveSig] + new int VirtualToPhysical( + ulong Virtual, + out ulong Physical); + + [PreserveSig] + new int GetVirtualTranslationPhysicalOffsets( + ulong Virtual, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Offsets, + uint OffsetsSize, + out uint Levels); + + [PreserveSig] + new int ReadHandleData( + ulong Handle, + DEBUG_HANDLE_DATA_TYPE DataType, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint BufferSize, + out uint DataSize); + + [PreserveSig] + new int FillVirtual( + ulong Start, + uint Size, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint PatternSize, + out uint Filled); + + [PreserveSig] + new int FillPhysical( + ulong Start, + uint Size, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint PatternSize, + out uint Filled); + + [PreserveSig] + new int QueryVirtual( + ulong Offset, + out MEMORY_BASIC_INFORMATION64 Info); + + /* IDebugDataSpaces3 */ + + [PreserveSig] + int ReadImageNtHeaders( + ulong ImageBase, + out IMAGE_NT_HEADERS64 Headers); + + [PreserveSig] + int ReadTagged( + [In][MarshalAs(UnmanagedType.LPStruct)] + Guid Tag, + uint Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint BufferSize, + out uint TotalSize); + + [PreserveSig] + int StartEnumTagged( + out ulong Handle); + + [PreserveSig] + int GetNextTagged( + ulong Handle, + out Guid Tag, + out uint Size); + + [PreserveSig] + int EndEnumTagged( + ulong Handle); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugDataSpaces4.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugDataSpaces4.cs new file mode 100644 index 0000000000..4886e22167 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugDataSpaces4.cs @@ -0,0 +1,346 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("d98ada1f-29e9-4ef5-a6c0-e53349883212")] + public interface IDebugDataSpaces4 : IDebugDataSpaces3 + { + /* IDebugDataSpaces */ + + [PreserveSig] + new int ReadVirtual( + ulong Offset, + [Out] + IntPtr buffer, + int BufferSize, + out int BytesRead); + + [PreserveSig] + new int WriteVirtual( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int SearchVirtual( + ulong Offset, + ulong Length, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] pattern, + uint PatternSize, + uint PatternGranularity, + out ulong MatchOffset); + + [PreserveSig] + new int ReadVirtualUncached( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteVirtualUncached( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int ReadPointersVirtual( + uint Count, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] + ulong[] Ptrs); + + [PreserveSig] + new int WritePointersVirtual( + uint Count, + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray)] ulong[] Ptrs); + + [PreserveSig] + new int ReadPhysical( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WritePhysical( + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int ReadControl( + uint Processor, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + int BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteControl( + uint Processor, + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + int BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int ReadIo( + INTERFACE_TYPE InterfaceType, + uint BusNumber, + uint AddressSpace, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteIo( + INTERFACE_TYPE InterfaceType, + uint BusNumber, + uint AddressSpace, + ulong Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int ReadMsr( + uint Msr, + out ulong MsrValue); + + [PreserveSig] + new int WriteMsr( + uint Msr, + ulong MsrValue); + + [PreserveSig] + new int ReadBusData( + BUS_DATA_TYPE BusDataType, + uint BusNumber, + uint SlotNumber, + uint Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteBusData( + BUS_DATA_TYPE BusDataType, + uint BusNumber, + uint SlotNumber, + uint Offset, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int CheckLowMemory(); + + [PreserveSig] + new int ReadDebuggerData( + uint Index, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] + byte[] buffer, + uint BufferSize, + out uint DataSize); + + [PreserveSig] + new int ReadProcessorSystemData( + uint Processor, + DEBUG_DATA Index, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint BufferSize, + out uint DataSize); + + /* IDebugDataSpaces2 */ + + [PreserveSig] + new int VirtualToPhysical( + ulong Virtual, + out ulong Physical); + + [PreserveSig] + new int GetVirtualTranslationPhysicalOffsets( + ulong Virtual, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Offsets, + uint OffsetsSize, + out uint Levels); + + [PreserveSig] + new int ReadHandleData( + ulong Handle, + DEBUG_HANDLE_DATA_TYPE DataType, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint BufferSize, + out uint DataSize); + + [PreserveSig] + new int FillVirtual( + ulong Start, + uint Size, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint PatternSize, + out uint Filled); + + [PreserveSig] + new int FillPhysical( + ulong Start, + uint Size, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint PatternSize, + out uint Filled); + + [PreserveSig] + new int QueryVirtual( + ulong Offset, + out MEMORY_BASIC_INFORMATION64 Info); + + /* IDebugDataSpaces3 */ + + [PreserveSig] + new int ReadImageNtHeaders( + ulong ImageBase, + out IMAGE_NT_HEADERS64 Headers); + + [PreserveSig] + new int ReadTagged( + [In][MarshalAs(UnmanagedType.LPStruct)] + Guid Tag, + uint Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint BufferSize, + out uint TotalSize); + + [PreserveSig] + new int StartEnumTagged( + out ulong Handle); + + [PreserveSig] + new int GetNextTagged( + ulong Handle, + out Guid Tag, + out uint Size); + + [PreserveSig] + new int EndEnumTagged( + ulong Handle); + + /* IDebugDataSpaces4 */ + + [PreserveSig] + int GetOffsetInformation( + DEBUG_DATA_SPACE Space, + DEBUG_OFFSINFO Which, + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] buffer, + uint BufferSize, + out uint InfoSize); + + [PreserveSig] + int GetNextDifferentlyValidOffsetVirtual( + ulong Offset, + out ulong NextOffset); + + [PreserveSig] + int GetValidRegionVirtual( + ulong Base, + uint Size, + out ulong ValidBase, + out uint ValidSize); + + [PreserveSig] + int SearchVirtual2( + ulong Offset, + ulong Length, + DEBUG_VSEARCH Flags, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] buffer, + uint PatternSize, + uint PatternGranularity, + out ulong MatchOffset); + + [PreserveSig] + int ReadMultiByteStringVirtual( + ulong Offset, + uint MaxBytes, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + uint BufferSize, + out uint StringBytes); + + [PreserveSig] + int ReadMultiByteStringVirtualWide( + ulong Offset, + uint MaxBytes, + CODE_PAGE CodePage, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + uint BufferSize, + out uint StringBytes); + + [PreserveSig] + int ReadUnicodeStringVirtual( + ulong Offset, + uint MaxBytes, + CODE_PAGE CodePage, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + uint BufferSize, + out uint StringBytes); + + [PreserveSig] + int ReadUnicodeStringVirtualWide( + ulong Offset, + uint MaxBytes, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + uint BufferSize, + out uint StringBytes); + + [PreserveSig] + int ReadPhysical2( + ulong Offset, + DEBUG_PHYSICAL Flags, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + int WritePhysical2( + ulong Offset, + DEBUG_PHYSICAL Flags, + [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + byte[] buffer, + uint BufferSize, + out uint BytesWritten); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugEventCallbacks.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugEventCallbacks.cs new file mode 100644 index 0000000000..992d16574f --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugEventCallbacks.cs @@ -0,0 +1,95 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("337be28b-5036-4d72-b6bf-c45fbb9f2eaa")] + public interface IDebugEventCallbacks + { + [PreserveSig] + int GetInterestMask( + out DEBUG_EVENT Mask); + + [PreserveSig] + int Breakpoint( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugBreakpoint Bp); + + [PreserveSig] + int Exception( + in EXCEPTION_RECORD64 Exception, + uint FirstChance); + + [PreserveSig] + int CreateThread( + ulong Handle, + ulong DataOffset, + ulong StartOffset); + + [PreserveSig] + int ExitThread( + uint ExitCode); + + [PreserveSig] + int CreateProcess( + ulong ImageFileHandle, + ulong Handle, + ulong BaseOffset, + uint ModuleSize, + [In][MarshalAs(UnmanagedType.LPStr)] string ModuleName, + [In][MarshalAs(UnmanagedType.LPStr)] string ImageName, + uint CheckSum, + uint TimeDateStamp, + ulong InitialThreadHandle, + ulong ThreadDataOffset, + ulong StartOffset); + + [PreserveSig] + int ExitProcess( + uint ExitCode); + + [PreserveSig] + int LoadModule( + ulong ImageFileHandle, + ulong BaseOffset, + uint ModuleSize, + [In][MarshalAs(UnmanagedType.LPStr)] string ModuleName, + [In][MarshalAs(UnmanagedType.LPStr)] string ImageName, + uint CheckSum, + uint TimeDateStamp); + + [PreserveSig] + int UnloadModule( + [In][MarshalAs(UnmanagedType.LPStr)] string ImageBaseName, + ulong BaseOffset); + + [PreserveSig] + int SystemError( + uint Error, + uint Level); + + [PreserveSig] + int SessionStatus( + DEBUG_SESSION Status); + + [PreserveSig] + int ChangeDebuggeeState( + DEBUG_CDS Flags, + ulong Argument); + + [PreserveSig] + int ChangeEngineState( + DEBUG_CES Flags, + ulong Argument); + + [PreserveSig] + int ChangeSymbolState( + DEBUG_CSS Flags, + ulong Argument); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugEventCallbacksWide.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugEventCallbacksWide.cs new file mode 100644 index 0000000000..ebddc71987 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugEventCallbacksWide.cs @@ -0,0 +1,95 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("0690e046-9c23-45ac-a04f-987ac29ad0d3")] + public interface IDebugEventCallbacksWide + { + [PreserveSig] + int GetInterestMask( + out DEBUG_EVENT Mask); + + [PreserveSig] + int Breakpoint( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugBreakpoint2 Bp); + + [PreserveSig] + int Exception( + in EXCEPTION_RECORD64 Exception, + uint FirstChance); + + [PreserveSig] + int CreateThread( + ulong Handle, + ulong DataOffset, + ulong StartOffset); + + [PreserveSig] + int ExitThread( + uint ExitCode); + + [PreserveSig] + int CreateProcess( + ulong ImageFileHandle, + ulong Handle, + ulong BaseOffset, + uint ModuleSize, + [In][MarshalAs(UnmanagedType.LPWStr)] string ModuleName, + [In][MarshalAs(UnmanagedType.LPWStr)] string ImageName, + uint CheckSum, + uint TimeDateStamp, + ulong InitialThreadHandle, + ulong ThreadDataOffset, + ulong StartOffset); + + [PreserveSig] + int ExitProcess( + uint ExitCode); + + [PreserveSig] + int LoadModule( + ulong ImageFileHandle, + ulong BaseOffset, + uint ModuleSize, + [In][MarshalAs(UnmanagedType.LPWStr)] string ModuleName, + [In][MarshalAs(UnmanagedType.LPWStr)] string ImageName, + uint CheckSum, + uint TimeDateStamp); + + [PreserveSig] + int UnloadModule( + [In][MarshalAs(UnmanagedType.LPWStr)] string ImageBaseName, + ulong BaseOffset); + + [PreserveSig] + int SystemError( + uint Error, + uint Level); + + [PreserveSig] + int SessionStatus( + DEBUG_SESSION Status); + + [PreserveSig] + int ChangeDebuggeeState( + DEBUG_CDS Flags, + ulong Argument); + + [PreserveSig] + int ChangeEngineState( + DEBUG_CES Flags, + ulong Argument); + + [PreserveSig] + int ChangeSymbolState( + DEBUG_CSS Flags, + ulong Argument); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugEventContextCallbacks.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugEventContextCallbacks.cs new file mode 100644 index 0000000000..0e6ad79923 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugEventContextCallbacks.cs @@ -0,0 +1,117 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("61a4905b-23f9-4247-b3c5-53d087529ab7")] + public unsafe interface IDebugEventContextCallbacks + { + [PreserveSig] + int GetInterestMask( + out DEBUG_EVENT Mask); + + [PreserveSig] + int Breakpoint( + [In][MarshalAs(UnmanagedType.Interface)] + IDebugBreakpoint2 Bp, + in DEBUG_EVENT_CONTEXT Context, + uint ContextSize); + + [PreserveSig] + int Exception( + in EXCEPTION_RECORD64 Exception, + uint FirstChance, + in DEBUG_EVENT_CONTEXT Context, + uint ContextSize); + + [PreserveSig] + int CreateThread( + ulong Handle, + ulong DataOffset, + ulong StartOffset, + in DEBUG_EVENT_CONTEXT Context, + uint ContextSize); + + [PreserveSig] + int ExitThread( + uint ExitCode, + in DEBUG_EVENT_CONTEXT Context, + uint ContextSize); + + [PreserveSig] + int CreateProcess( + ulong ImageFileHandle, + ulong Handle, + ulong BaseOffset, + uint ModuleSize, + [In][MarshalAs(UnmanagedType.LPWStr)] string ModuleName, + [In][MarshalAs(UnmanagedType.LPWStr)] string ImageName, + uint CheckSum, + uint TimeDateStamp, + ulong InitialThreadHandle, + ulong ThreadDataOffset, + ulong StartOffset, + in DEBUG_EVENT_CONTEXT Context, + uint ContextSize); + + [PreserveSig] + int ExitProcess( + uint ExitCode, + in DEBUG_EVENT_CONTEXT Context, + uint ContextSize); + + [PreserveSig] + int LoadModule( + ulong ImageFileHandle, + ulong BaseOffset, + uint ModuleSize, + [In][MarshalAs(UnmanagedType.LPWStr)] string ModuleName, + [In][MarshalAs(UnmanagedType.LPWStr)] string ImageName, + uint CheckSum, + uint TimeDateStamp, + in DEBUG_EVENT_CONTEXT Context, + uint ContextSize); + + [PreserveSig] + int UnloadModule( + [In][MarshalAs(UnmanagedType.LPWStr)] string ImageBaseName, + ulong BaseOffset, + in DEBUG_EVENT_CONTEXT Context, + uint ContextSize); + + [PreserveSig] + int SystemError( + uint Error, + uint Level, + in DEBUG_EVENT_CONTEXT Context, + uint ContextSize); + + [PreserveSig] + int SessionStatus( + DEBUG_SESSION Status); + + [PreserveSig] + int ChangeDebuggeeState( + DEBUG_CDS Flags, + ulong Argument, + in DEBUG_EVENT_CONTEXT Context, + uint ContextSize); + + [PreserveSig] + int ChangeEngineState( + DEBUG_CES Flags, + ulong Argument, + in DEBUG_EVENT_CONTEXT Context, + uint ContextSize); + + [PreserveSig] + int ChangeSymbolState( + DEBUG_CSS Flags, + ulong Argument); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugInputCallbacks.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugInputCallbacks.cs new file mode 100644 index 0000000000..ee65369df1 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugInputCallbacks.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("9f50e42c-f136-499e-9a97-73036c94ed2d")] + public interface IDebugInputCallbacks + { + [PreserveSig] + int StartInput( + uint BufferSize); + + [PreserveSig] + int EndInput(); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugOutputCallbacks.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugOutputCallbacks.cs new file mode 100644 index 0000000000..cca6eb5729 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugOutputCallbacks.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("4bf58045-d654-4c40-b0af-683090f356dc")] + public interface IDebugOutputCallbacks + { + [PreserveSig] + int Output( + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Text); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugOutputCallbacks2.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugOutputCallbacks2.cs new file mode 100644 index 0000000000..0637901f58 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugOutputCallbacks2.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("67721fe9-56d2-4a44-a325-2b65513ce6eb")] + public interface IDebugOutputCallbacks2 : IDebugOutputCallbacks + { + /* IDebugOutputCallbacks */ + + /// + /// This method is not used. + /// + [PreserveSig] + new int Output( + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPStr)] string Text); + + /* IDebugOutputCallbacks2 */ + + [PreserveSig] + int GetInterestMask( + out DEBUG_OUTCBI Mask); + + [PreserveSig] + int Output2( + DEBUG_OUTCB Which, + DEBUG_OUTCBF Flags, + ulong Arg, + [In][MarshalAs(UnmanagedType.LPWStr)] string Text); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugOutputCallbacksWide.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugOutputCallbacksWide.cs new file mode 100644 index 0000000000..9fefcaab82 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugOutputCallbacksWide.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("4c7fd663-c394-4e26-8ef1-34ad5ed3764c")] + public interface IDebugOutputCallbacksWide + { + [PreserveSig] + int Output( + DEBUG_OUTPUT Mask, + [In][MarshalAs(UnmanagedType.LPWStr)] string Text); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugRegisters.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugRegisters.cs new file mode 100644 index 0000000000..5f4b718e85 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugRegisters.cs @@ -0,0 +1,74 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("ce289126-9e84-45a7-937e-67bb18691493")] + public interface IDebugRegisters + { + [PreserveSig] + int GetNumberRegisters( + out uint Number); + + [PreserveSig] + int GetDescription( + uint Register, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out DEBUG_REGISTER_DESCRIPTION Desc); + + [PreserveSig] + int GetIndexByName( + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + out uint Index); + + [PreserveSig] + int GetValue( + uint Register, + out DEBUG_VALUE Value); + + [PreserveSig] + int SetValue( + uint Register, + in DEBUG_VALUE Value); + + [PreserveSig] + int GetValues( //FIX ME!!! This needs to be tested + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Indices, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_VALUE[] Values); + + [PreserveSig] + int SetValues( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Indices, + uint Start, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] Values); + + [PreserveSig] + int OutputRegisters( + DEBUG_OUTCTL OutputControl, + DEBUG_REGISTERS Flags); + + [PreserveSig] + int GetInstructionOffset( + out ulong Offset); + + [PreserveSig] + int GetStackOffset( + out ulong Offset); + + [PreserveSig] + int GetFrameOffset( + out ulong Offset); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugRegisters2.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugRegisters2.cs new file mode 100644 index 0000000000..ffe3f0f2ff --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugRegisters2.cs @@ -0,0 +1,189 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("1656afa9-19c6-4e3a-97e7-5dc9160cf9c4")] + public interface IDebugRegisters2 : IDebugRegisters + { + [PreserveSig] + new int GetNumberRegisters( + out uint Number); + + [PreserveSig] + new int GetDescription( + uint Register, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out DEBUG_REGISTER_DESCRIPTION Desc); + + [PreserveSig] + new int GetIndexByName( + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + out uint Index); + + [PreserveSig] + new int GetValue( + uint Register, + out DEBUG_VALUE Value); + + [PreserveSig] + new int SetValue( + uint Register, + in DEBUG_VALUE Value); + + [PreserveSig] + new int GetValues( //FIX ME!!! This needs to be tested + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Indices, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_VALUE[] Values); + + [PreserveSig] + new int SetValues( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Indices, + uint Start, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] Values); + + [PreserveSig] + new int OutputRegisters( + DEBUG_OUTCTL OutputControl, + DEBUG_REGISTERS Flags); + + [PreserveSig] + new int GetInstructionOffset( + out ulong Offset); + + [PreserveSig] + new int GetStackOffset( + out ulong Offset); + + [PreserveSig] + new int GetFrameOffset( + out ulong Offset); + + /* IDebugRegisters2 */ + + [PreserveSig] + int GetDescriptionWide( + uint Register, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out DEBUG_REGISTER_DESCRIPTION Desc); + + [PreserveSig] + int GetIndexByNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + out uint Index); + + [PreserveSig] + int GetNumberPseudoRegisters( + out uint Number + ); + + [PreserveSig] + int GetPseudoDescription( + uint Register, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong TypeModule, + out uint TypeId + ); + + [PreserveSig] + int GetPseudoDescriptionWide( + uint Register, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong TypeModule, + out uint TypeId + ); + + [PreserveSig] + int GetPseudoIndexByName( + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + out uint Index + ); + + [PreserveSig] + int GetPseudoIndexByNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + out uint Index + ); + + [PreserveSig] + int GetPseudoValues( + uint Source, + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Indices, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_VALUE[] Values + ); + + [PreserveSig] + int SetPseudoValues( + uint Source, + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Indices, + uint Start, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] Values + ); + + [PreserveSig] + int GetValues2( + DEBUG_REGSRC Source, + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Indices, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_VALUE[] Values + ); + + [PreserveSig] + int SetValues2( + uint Source, + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] uint[] Indices, + uint Start, + [In][MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] Values + ); + + [PreserveSig] + int OutputRegisters2( + uint OutputControl, + uint Source, + uint Flags + ); + + [PreserveSig] + int GetInstructionOffset2( + uint Source, + out ulong Offset + ); + + [PreserveSig] + int GetStackOffset2( + uint Source, + out ulong Offset + ); + + [PreserveSig] + int GetFrameOffset2( + uint Source, + out ulong Offset + ); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbolGroup.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbolGroup.cs new file mode 100644 index 0000000000..a4c6952b6a --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbolGroup.cs @@ -0,0 +1,70 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("f2528316-0f1a-4431-aeed-11d096e1e2ab")] + public interface IDebugSymbolGroup + { + /* IDebugSymbolGroup */ + + [PreserveSig] + int GetNumberSymbols( + out uint Number); + + [PreserveSig] + int AddSymbol( + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + ref uint Index); + + [PreserveSig] + int RemoveSymbolByName( + [In][MarshalAs(UnmanagedType.LPStr)] string Name); + + [PreserveSig] + int RemoveSymbolsByIndex( + uint Index); + + [PreserveSig] + int GetSymbolName( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + int GetSymbolParameters( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SYMBOL_PARAMETERS[] Params); + + [PreserveSig] + int ExpandSymbol( + uint Index, + [In][MarshalAs(UnmanagedType.Bool)] bool Expand); + + [PreserveSig] + int OutputSymbols( + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT_SYMBOLS Flags, + uint Start, + uint Count); + + [PreserveSig] + int WriteSymbol( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Value); + + [PreserveSig] + int OutputAsType( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Type); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbolGroup2.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbolGroup2.cs new file mode 100644 index 0000000000..46b3cf515e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbolGroup2.cs @@ -0,0 +1,146 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("6a7ccc5f-fb5e-4dcc-b41c-6c20307bccc7")] + public interface IDebugSymbolGroup2 : IDebugSymbolGroup + { + /* IDebugSymbolGroup */ + + [PreserveSig] + new int GetNumberSymbols( + out uint Number); + + [PreserveSig] + new int AddSymbol( + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + ref uint Index); + + [PreserveSig] + new int RemoveSymbolByName( + [In][MarshalAs(UnmanagedType.LPStr)] string Name); + + [PreserveSig] + new int RemoveSymbolsByIndex( + uint Index); + + [PreserveSig] + new int GetSymbolName( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetSymbolParameters( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SYMBOL_PARAMETERS[] Params); + + [PreserveSig] + new int ExpandSymbol( + uint Index, + [In][MarshalAs(UnmanagedType.Bool)] bool Expand); + + [PreserveSig] + new int OutputSymbols( + DEBUG_OUTCTL OutputControl, + DEBUG_OUTPUT_SYMBOLS Flags, + uint Start, + uint Count); + + [PreserveSig] + new int WriteSymbol( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Value); + + [PreserveSig] + new int OutputAsType( + uint Index, + [In][MarshalAs(UnmanagedType.LPStr)] string Type); + + /* IDebugSymbolGroup2 */ + + [PreserveSig] + int AddSymbolWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + ref uint Index); + + [PreserveSig] + int RemoveSymbolByNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Name); + + [PreserveSig] + int GetSymbolNameWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + int WriteSymbolWide( + uint Index, + [In][MarshalAs(UnmanagedType.LPWStr)] string Value); + + [PreserveSig] + int OutputAsTypeWide( + uint Index, + [In][MarshalAs(UnmanagedType.LPWStr)] string Type); + + [PreserveSig] + int GetSymbolTypeName( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + int GetSymbolTypeNameWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + int GetSymbolSize( + uint Index, + out uint Size); + + [PreserveSig] + int GetSymbolOffset( + uint Index, + out ulong Offset); + + [PreserveSig] + int GetSymbolRegister( + uint Index, + out uint Register); + + [PreserveSig] + int GetSymbolValueText( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + int GetSymbolValueTextWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + int GetSymbolEntryInformation( + uint Index, + out DEBUG_SYMBOL_ENTRY Info); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols.cs new file mode 100644 index 0000000000..20b2c28e09 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols.cs @@ -0,0 +1,332 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("8c31e98c-983a-48a5-9016-6fe5d667a950")] + public interface IDebugSymbols + { + /* IDebugSymbols */ + + [PreserveSig] + int GetSymbolOptions( + out SYMOPT Options); + + [PreserveSig] + int AddSymbolOptions( + SYMOPT Options); + + [PreserveSig] + int RemoveSymbolOptions( + SYMOPT Options); + + [PreserveSig] + int SetSymbolOptions( + SYMOPT Options); + + [PreserveSig] + int GetNameByOffset( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + int GetOffsetByName( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out ulong Offset); + + [PreserveSig] + int GetNearNameByOffset( + ulong Offset, + int Delta, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + int GetLineByOffset( + ulong Offset, + out uint Line, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer, + int FileBufferSize, + out uint FileSize, + out ulong Displacement); + + [PreserveSig] + int GetOffsetByLine( + uint Line, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + out ulong Offset); + + [PreserveSig] + int GetNumberModules( + out uint Loaded, + out uint Unloaded); + + [PreserveSig] + int GetModuleByIndex( + uint Index, + out ulong Base); + + [PreserveSig] + int GetModuleByModuleName( + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + uint StartIndex, + out uint Index, + out ulong Base); + + [PreserveSig] + int GetModuleByOffset( + ulong Offset, + uint StartIndex, + out uint Index, + out ulong Base); + + [PreserveSig] + int GetModuleNames( + uint Index, + ulong Base, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ImageNameBuffer, + int ImageNameBufferSize, + out uint ImageNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ModuleNameBuffer, + int ModuleNameBufferSize, + out uint ModuleNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder LoadedImageNameBuffer, + int LoadedImageNameBufferSize, + out uint LoadedImageNameSize); + + [PreserveSig] + int GetModuleParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] ulong[] Bases, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_PARAMETERS[] Params); + + [PreserveSig] + int GetSymbolModule( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out ulong Base); + + [PreserveSig] + int GetTypeName( + ulong Module, + uint TypeId, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize); + + [PreserveSig] + int GetTypeId( + ulong Module, + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + out uint TypeId); + + [PreserveSig] + int GetTypeSize( + ulong Module, + uint TypeId, + out uint Size); + + [PreserveSig] + int GetFieldOffset( + ulong Module, + uint TypeId, + [In][MarshalAs(UnmanagedType.LPStr)] string Field, + out uint Offset); + + [PreserveSig] + int GetSymbolTypeId( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out uint TypeId, + out ulong Module); + + [PreserveSig] + int GetOffsetTypeId( + ulong Offset, + out uint TypeId, + out ulong Module); + + [PreserveSig] + int ReadTypedDataVirtual( + ulong Offset, + ulong Module, + uint TypeId, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] Buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + int WriteTypedDataVirtual( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + int OutputTypedDataVirtual( + DEBUG_OUTCTL OutputControl, + ulong Offset, + ulong Module, + uint TypeId, + DEBUG_TYPEOPTS Flags); + + [PreserveSig] + int ReadTypedDataPhysical( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + int WriteTypedDataPhysical( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + int OutputTypedDataPhysical( + DEBUG_OUTCTL OutputControl, + ulong Offset, + ulong Module, + uint TypeId, + DEBUG_TYPEOPTS Flags); + + [PreserveSig] + int GetScope( + out ulong InstructionOffset, + out DEBUG_STACK_FRAME ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize); + + [PreserveSig] + int SetScope( + ulong InstructionOffset, + in DEBUG_STACK_FRAME ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize); + + [PreserveSig] + int ResetScope(); + + [PreserveSig] + int GetScopeSymbolGroup( + DEBUG_SCOPE_GROUP Flags, + [In][MarshalAs(UnmanagedType.Interface)] + IDebugSymbolGroup Update, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup Symbols); + + [PreserveSig] + int CreateSymbolGroup( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup Group); + + [PreserveSig] + int StartSymbolMatch( + [In][MarshalAs(UnmanagedType.LPStr)] string Pattern, + out ulong Handle); + + [PreserveSig] + int GetNextSymbolMatch( + ulong Handle, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint MatchSize, + out ulong Offset); + + [PreserveSig] + int EndSymbolMatch( + ulong Handle); + + [PreserveSig] + int Reload( + [In][MarshalAs(UnmanagedType.LPStr)] string Module); + + [PreserveSig] + int GetSymbolPath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + int SetSymbolPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + int AppendSymbolPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + int GetImagePath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + int SetImagePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + int AppendImagePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + int GetSourcePath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + int GetSourcePathElement( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ElementSize); + + [PreserveSig] + int SetSourcePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + int AppendSourcePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + int FindSourceFile( + uint StartElement, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + DEBUG_FIND_SOURCE Flags, + out uint FoundElement, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FoundSize); + + [PreserveSig] + int GetSourceFileLineOffsets( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Buffer, + int BufferLines, + out uint FileLines); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols2.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols2.cs new file mode 100644 index 0000000000..7a82114b2f --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols2.cs @@ -0,0 +1,387 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("3a707211-afdd-4495-ad4f-56fecdf8163f")] + public interface IDebugSymbols2 : IDebugSymbols + { + /* IDebugSymbols */ + + [PreserveSig] + new int GetSymbolOptions( + out SYMOPT Options); + + [PreserveSig] + new int AddSymbolOptions( + SYMOPT Options); + + [PreserveSig] + new int RemoveSymbolOptions( + SYMOPT Options); + + [PreserveSig] + new int SetSymbolOptions( + SYMOPT Options); + + [PreserveSig] + new int GetNameByOffset( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + new int GetOffsetByName( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out ulong Offset); + + [PreserveSig] + new int GetNearNameByOffset( + ulong Offset, + int Delta, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + new int GetLineByOffset( + ulong Offset, + out uint Line, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer, + int FileBufferSize, + out uint FileSize, + out ulong Displacement); + + [PreserveSig] + new int GetOffsetByLine( + uint Line, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + out ulong Offset); + + [PreserveSig] + new int GetNumberModules( + out uint Loaded, + out uint Unloaded); + + [PreserveSig] + new int GetModuleByIndex( + uint Index, + out ulong Base); + + [PreserveSig] + new int GetModuleByModuleName( + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + uint StartIndex, + out uint Index, + out ulong Base); + + [PreserveSig] + new int GetModuleByOffset( + ulong Offset, + uint StartIndex, + out uint Index, + out ulong Base); + + [PreserveSig] + new int GetModuleNames( + uint Index, + ulong Base, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ImageNameBuffer, + int ImageNameBufferSize, + out uint ImageNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ModuleNameBuffer, + int ModuleNameBufferSize, + out uint ModuleNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder LoadedImageNameBuffer, + int LoadedImageNameBufferSize, + out uint LoadedImageNameSize); + + [PreserveSig] + new int GetModuleParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] ulong[] Bases, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_PARAMETERS[] Params); + + [PreserveSig] + new int GetSymbolModule( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out ulong Base); + + [PreserveSig] + new int GetTypeName( + ulong Module, + uint TypeId, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize); + + [PreserveSig] + new int GetTypeId( + ulong Module, + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + out uint TypeId); + + [PreserveSig] + new int GetTypeSize( + ulong Module, + uint TypeId, + out uint Size); + + [PreserveSig] + new int GetFieldOffset( + ulong Module, + uint TypeId, + [In][MarshalAs(UnmanagedType.LPStr)] string Field, + out uint Offset); + + [PreserveSig] + new int GetSymbolTypeId( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out uint TypeId, + out ulong Module); + + [PreserveSig] + new int GetOffsetTypeId( + ulong Offset, + out uint TypeId, + out ulong Module); + + [PreserveSig] + new int ReadTypedDataVirtual( + ulong Offset, + ulong Module, + uint TypeId, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] Buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteTypedDataVirtual( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int OutputTypedDataVirtual( + DEBUG_OUTCTL OutputControl, + ulong Offset, + ulong Module, + uint TypeId, + DEBUG_TYPEOPTS Flags); + + [PreserveSig] + new int ReadTypedDataPhysical( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteTypedDataPhysical( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int OutputTypedDataPhysical( + DEBUG_OUTCTL OutputControl, + ulong Offset, + ulong Module, + uint TypeId, + DEBUG_TYPEOPTS Flags); + + [PreserveSig] + new int GetScope( + out ulong InstructionOffset, + out DEBUG_STACK_FRAME ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize); + + [PreserveSig] + new int SetScope( + ulong InstructionOffset, + in DEBUG_STACK_FRAME ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize); + + [PreserveSig] + new int ResetScope(); + + [PreserveSig] + new int GetScopeSymbolGroup( + DEBUG_SCOPE_GROUP Flags, + [In][MarshalAs(UnmanagedType.Interface)] + IDebugSymbolGroup Update, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup Symbols); + + [PreserveSig] + new int CreateSymbolGroup( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup Group); + + [PreserveSig] + new int StartSymbolMatch( + [In][MarshalAs(UnmanagedType.LPStr)] string Pattern, + out ulong Handle); + + [PreserveSig] + new int GetNextSymbolMatch( + ulong Handle, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint MatchSize, + out ulong Offset); + + [PreserveSig] + new int EndSymbolMatch( + ulong Handle); + + [PreserveSig] + new int Reload( + [In][MarshalAs(UnmanagedType.LPStr)] string Module); + + [PreserveSig] + new int GetSymbolPath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int SetSymbolPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + new int AppendSymbolPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + new int GetImagePath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int SetImagePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + new int AppendImagePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + new int GetSourcePath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int GetSourcePathElement( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ElementSize); + + [PreserveSig] + new int SetSourcePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + new int AppendSourcePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + new int FindSourceFile( + uint StartElement, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + DEBUG_FIND_SOURCE Flags, + out uint FoundElement, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FoundSize); + + [PreserveSig] + new int GetSourceFileLineOffsets( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Buffer, + int BufferLines, + out uint FileLines); + + /* IDebugSymbols2 */ + + [PreserveSig] + int GetModuleVersionInformation( + uint Index, + ulong Base, + [In][MarshalAs(UnmanagedType.LPStr)] string Item, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] buffer, + uint BufferSize, + out uint VerInfoSize); + + [PreserveSig] + int GetModuleNameString( + DEBUG_MODNAME Which, + uint Index, + ulong Base, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + uint BufferSize, + out uint NameSize); + + [PreserveSig] + int GetConstantName( + ulong Module, + uint TypeId, + ulong Value, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + int GetFieldName( + ulong Module, + uint TypeId, + uint FieldIndex, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + int GetTypeOptions( + out DEBUG_TYPEOPTS Options); + + [PreserveSig] + int AddTypeOptions( + DEBUG_TYPEOPTS Options); + + [PreserveSig] + int RemoveTypeOptions( + DEBUG_TYPEOPTS Options); + + [PreserveSig] + int SetTypeOptions( + DEBUG_TYPEOPTS Options); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols3.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols3.cs new file mode 100644 index 0000000000..7df1ad12a7 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols3.cs @@ -0,0 +1,889 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("f02fbecc-50ac-4f36-9ad9-c975e8f32ff8")] + public interface IDebugSymbols3 : IDebugSymbols2 + { + /* IDebugSymbols */ + + [PreserveSig] + new int GetSymbolOptions( + out SYMOPT Options); + + [PreserveSig] + new int AddSymbolOptions( + SYMOPT Options); + + [PreserveSig] + new int RemoveSymbolOptions( + SYMOPT Options); + + [PreserveSig] + new int SetSymbolOptions( + SYMOPT Options); + + [PreserveSig] + new int GetNameByOffset( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + new int GetOffsetByName( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out ulong Offset); + + [PreserveSig] + new int GetNearNameByOffset( + ulong Offset, + int Delta, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + new int GetLineByOffset( + ulong Offset, + out uint Line, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer, + int FileBufferSize, + out uint FileSize, + out ulong Displacement); + + [PreserveSig] + new int GetOffsetByLine( + uint Line, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + out ulong Offset); + + [PreserveSig] + new int GetNumberModules( + out uint Loaded, + out uint Unloaded); + + [PreserveSig] + new int GetModuleByIndex( + uint Index, + out ulong Base); + + [PreserveSig] + new int GetModuleByModuleName( + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + uint StartIndex, + out uint Index, + out ulong Base); + + [PreserveSig] + new int GetModuleByOffset( + ulong Offset, + uint StartIndex, + out uint Index, + out ulong Base); + + [PreserveSig] + new int GetModuleNames( + uint Index, + ulong Base, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ImageNameBuffer, + int ImageNameBufferSize, + out uint ImageNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ModuleNameBuffer, + int ModuleNameBufferSize, + out uint ModuleNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder LoadedImageNameBuffer, + int LoadedImageNameBufferSize, + out uint LoadedImageNameSize); + + [PreserveSig] + new int GetModuleParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] ulong[] Bases, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_PARAMETERS[] Params); + + [PreserveSig] + new int GetSymbolModule( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out ulong Base); + + [PreserveSig] + new int GetTypeName( + ulong Module, + uint TypeId, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize); + + [PreserveSig] + new int GetTypeId( + ulong Module, + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + out uint TypeId); + + [PreserveSig] + new int GetTypeSize( + ulong Module, + uint TypeId, + out uint Size); + + [PreserveSig] + new int GetFieldOffset( + ulong Module, + uint TypeId, + [In][MarshalAs(UnmanagedType.LPStr)] string Field, + out uint Offset); + + [PreserveSig] + new int GetSymbolTypeId( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out uint TypeId, + out ulong Module); + + [PreserveSig] + new int GetOffsetTypeId( + ulong Offset, + out uint TypeId, + out ulong Module); + + [PreserveSig] + new int ReadTypedDataVirtual( + ulong Offset, + ulong Module, + uint TypeId, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] Buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteTypedDataVirtual( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int OutputTypedDataVirtual( + DEBUG_OUTCTL OutputControl, + ulong Offset, + ulong Module, + uint TypeId, + DEBUG_TYPEOPTS Flags); + + [PreserveSig] + new int ReadTypedDataPhysical( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteTypedDataPhysical( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int OutputTypedDataPhysical( + DEBUG_OUTCTL OutputControl, + ulong Offset, + ulong Module, + uint TypeId, + DEBUG_TYPEOPTS Flags); + + [PreserveSig] + new int GetScope( + out ulong InstructionOffset, + out DEBUG_STACK_FRAME ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize); + + [PreserveSig] + new int SetScope( + ulong InstructionOffset, + in DEBUG_STACK_FRAME ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize); + + [PreserveSig] + new int ResetScope(); + + [PreserveSig] + new int GetScopeSymbolGroup( + DEBUG_SCOPE_GROUP Flags, + [In][MarshalAs(UnmanagedType.Interface)] + IDebugSymbolGroup Update, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup Symbols); + + [PreserveSig] + new int CreateSymbolGroup( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup Group); + + [PreserveSig] + new int StartSymbolMatch( + [In][MarshalAs(UnmanagedType.LPStr)] string Pattern, + out ulong Handle); + + [PreserveSig] + new int GetNextSymbolMatch( + ulong Handle, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint MatchSize, + out ulong Offset); + + [PreserveSig] + new int EndSymbolMatch( + ulong Handle); + + [PreserveSig] + new int Reload( + [In][MarshalAs(UnmanagedType.LPStr)] string Module); + + [PreserveSig] + new int GetSymbolPath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int SetSymbolPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + new int AppendSymbolPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + new int GetImagePath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int SetImagePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + new int AppendImagePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + new int GetSourcePath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int GetSourcePathElement( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ElementSize); + + [PreserveSig] + new int SetSourcePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + new int AppendSourcePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + new int FindSourceFile( + uint StartElement, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + DEBUG_FIND_SOURCE Flags, + out uint FoundElement, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FoundSize); + + [PreserveSig] + new int GetSourceFileLineOffsets( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Buffer, + int BufferLines, + out uint FileLines); + + /* IDebugSymbols2 */ + + [PreserveSig] + new int GetModuleVersionInformation( + uint Index, + ulong Base, + [In][MarshalAs(UnmanagedType.LPStr)] string Item, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] buffer, + uint BufferSize, + out uint VerInfoSize); + + [PreserveSig] + new int GetModuleNameString( + DEBUG_MODNAME Which, + uint Index, + ulong Base, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + uint BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetConstantName( + ulong Module, + uint TypeId, + ulong Value, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetFieldName( + ulong Module, + uint TypeId, + uint FieldIndex, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetTypeOptions( + out DEBUG_TYPEOPTS Options); + + [PreserveSig] + new int AddTypeOptions( + DEBUG_TYPEOPTS Options); + + [PreserveSig] + new int RemoveTypeOptions( + DEBUG_TYPEOPTS Options); + + [PreserveSig] + new int SetTypeOptions( + DEBUG_TYPEOPTS Options); + + /* IDebugSymbols3 */ + + [PreserveSig] + int GetNameByOffsetWide( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + int GetOffsetByNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Symbol, + out ulong Offset); + + [PreserveSig] + int GetNearNameByOffsetWide( + ulong Offset, + int Delta, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + int GetLineByOffsetWide( + ulong Offset, + out uint Line, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder FileBuffer, + int FileBufferSize, + out uint FileSize, + out ulong Displacement); + + [PreserveSig] + int GetOffsetByLineWide( + uint Line, + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + out ulong Offset); + + [PreserveSig] + int GetModuleByModuleNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + uint StartIndex, + out uint Index, + out ulong Base); + + [PreserveSig] + int GetSymbolModuleWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Symbol, + out ulong Base); + + [PreserveSig] + int GetTypeNameWide( + ulong Module, + uint TypeId, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize); + + [PreserveSig] + int GetTypeIdWide( + ulong Module, + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + out uint TypeId); + + [PreserveSig] + int GetFieldOffsetWide( + ulong Module, + uint TypeId, + [In][MarshalAs(UnmanagedType.LPWStr)] string Field, + out uint Offset); + + [PreserveSig] + int GetSymbolTypeIdWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Symbol, + out uint TypeId, + out ulong Module); + + [PreserveSig] + int GetScopeSymbolGroup2( + DEBUG_SCOPE_GROUP Flags, + [In][MarshalAs(UnmanagedType.Interface)] + IDebugSymbolGroup2 Update, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup2 Symbols); + + [PreserveSig] + int CreateSymbolGroup2( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup2 Group); + + [PreserveSig] + int StartSymbolMatchWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Pattern, + out ulong Handle); + + [PreserveSig] + int GetNextSymbolMatchWide( + ulong Handle, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint MatchSize, + out ulong Offset); + + [PreserveSig] + int ReloadWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Module); + + [PreserveSig] + int GetSymbolPathWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + int SetSymbolPathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path); + + [PreserveSig] + int AppendSymbolPathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Addition); + + [PreserveSig] + int GetImagePathWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + int SetImagePathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path); + + [PreserveSig] + int AppendImagePathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Addition); + + [PreserveSig] + int GetSourcePathWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + int GetSourcePathElementWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint ElementSize); + + [PreserveSig] + int SetSourcePathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path); + + [PreserveSig] + int AppendSourcePathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Addition); + + [PreserveSig] + int FindSourceFileWide( + uint StartElement, + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + DEBUG_FIND_SOURCE Flags, + out uint FoundElement, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint FoundSize); + + [PreserveSig] + int GetSourceFileLineOffsetsWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Buffer, + int BufferLines, + out uint FileLines); + + [PreserveSig] + int GetModuleVersionInformationWide( + uint Index, + ulong Base, + [In][MarshalAs(UnmanagedType.LPWStr)] string Item, + IntPtr Buffer, + int BufferSize, + out uint VerInfoSize); + + [PreserveSig] + int GetModuleNameStringWide( + DEBUG_MODNAME Which, + uint Index, + ulong Base, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + int GetConstantNameWide( + ulong Module, + uint TypeId, + ulong Value, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + int GetFieldNameWide( + ulong Module, + uint TypeId, + uint FieldIndex, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + int IsManagedModule( + uint Index, + ulong Base + ); + + [PreserveSig] + int GetModuleByModuleName2( + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + uint StartIndex, + DEBUG_GETMOD Flags, + out uint Index, + out ulong Base + ); + + [PreserveSig] + int GetModuleByModuleName2Wide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + uint StartIndex, + DEBUG_GETMOD Flags, + out uint Index, + out ulong Base + ); + + [PreserveSig] + int GetModuleByOffset2( + ulong Offset, + uint StartIndex, + DEBUG_GETMOD Flags, + out uint Index, + out ulong Base + ); + + [PreserveSig] + int AddSyntheticModule( + ulong Base, + uint Size, + [In][MarshalAs(UnmanagedType.LPStr)] string ImagePath, + [In][MarshalAs(UnmanagedType.LPStr)] string ModuleName, + DEBUG_ADDSYNTHMOD Flags + ); + + [PreserveSig] + int AddSyntheticModuleWide( + ulong Base, + uint Size, + [In][MarshalAs(UnmanagedType.LPWStr)] string ImagePath, + [In][MarshalAs(UnmanagedType.LPWStr)] string ModuleName, + DEBUG_ADDSYNTHMOD Flags + ); + + [PreserveSig] + int RemoveSyntheticModule( + ulong Base + ); + + [PreserveSig] + int GetCurrentScopeFrameIndex( + out uint Index + ); + + [PreserveSig] + int SetScopeFrameByIndex( + uint Index + ); + + [PreserveSig] + int SetScopeFromJitDebugInfo( + uint OutputControl, + ulong InfoOffset + ); + + [PreserveSig] + int SetScopeFromStoredEvent( + ); + + [PreserveSig] + int OutputSymbolByOffset( + uint OutputControl, + DEBUG_OUTSYM Flags, + ulong Offset + ); + + [PreserveSig] + int GetFunctionEntryByOffset( + ulong Offset, + DEBUG_GETFNENT Flags, + IntPtr Buffer, + uint BufferSize, + out uint BufferNeeded + ); + + [PreserveSig] + int GetFieldTypeAndOffset( + ulong Module, + uint ContainerTypeId, + [In][MarshalAs(UnmanagedType.LPStr)] string Field, + out uint FieldTypeId, + out uint Offset + ); + + [PreserveSig] + int GetFieldTypeAndOffsetWide( + ulong Module, + uint ContainerTypeId, + [In][MarshalAs(UnmanagedType.LPWStr)] string Field, + out uint FieldTypeId, + out uint Offset + ); + + [PreserveSig] + int AddSyntheticSymbol( + ulong Offset, + uint Size, + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + DEBUG_ADDSYNTHSYM Flags, + out DEBUG_MODULE_AND_ID Id + ); + + [PreserveSig] + int AddSyntheticSymbolWide( + ulong Offset, + uint Size, + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + DEBUG_ADDSYNTHSYM Flags, + out DEBUG_MODULE_AND_ID Id + ); + + [PreserveSig] + int RemoveSyntheticSymbol( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id + ); + + [PreserveSig] + int GetSymbolEntriesByOffset( + ulong Offset, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_AND_ID[] Ids, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Displacements, + uint IdsCount, + out uint Entries + ); + + [PreserveSig] + int GetSymbolEntriesByName( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_AND_ID[] Ids, + uint IdsCount, + out uint Entries + ); + + [PreserveSig] + int GetSymbolEntriesByNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Symbol, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_AND_ID[] Ids, + uint IdsCount, + out uint Entries + ); + + [PreserveSig] + int GetSymbolEntryByToken( + ulong ModuleBase, + uint Token, + out DEBUG_MODULE_AND_ID Id + ); + + [PreserveSig] + int GetSymbolEntryInformation( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id, + out DEBUG_SYMBOL_ENTRY Info + ); + + [PreserveSig] + int GetSymbolEntryString( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id, + uint Which, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize + ); + + [PreserveSig] + int GetSymbolEntryStringWide( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id, + uint Which, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize + ); + + [PreserveSig] + int GetSymbolEntryOffsetRegions( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_OFFSET_REGION[] Regions, + uint RegionsCount, + out uint RegionsAvail + ); + + [Obsolete("Do not use: no longer implemented.", true)] + [PreserveSig] + int GetSymbolEntryBySymbolEntry( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID FromId, + uint Flags, + out DEBUG_MODULE_AND_ID ToId + ); + + [PreserveSig] + int GetSourceEntriesByOffset( + ulong Offset, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SYMBOL_SOURCE_ENTRY[] Entries, + uint EntriesCount, + out uint EntriesAvail + ); + + [PreserveSig] + int GetSourceEntriesByLine( + uint Line, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SYMBOL_SOURCE_ENTRY[] Entries, + uint EntriesCount, + out uint EntriesAvail + ); + + [PreserveSig] + int GetSourceEntriesByLineWide( + uint Line, + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SYMBOL_SOURCE_ENTRY[] Entries, + uint EntriesCount, + out uint EntriesAvail + ); + + [PreserveSig] + int GetSourceEntryString( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_SYMBOL_SOURCE_ENTRY Entry, + uint Which, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize + ); + + [PreserveSig] + int GetSourceEntryStringWide( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_SYMBOL_SOURCE_ENTRY Entry, + uint Which, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize + ); + + [PreserveSig] + int GetSourceEntryOffsetRegions( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_SYMBOL_SOURCE_ENTRY Entry, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_OFFSET_REGION[] Regions, + uint RegionsCount, + out uint RegionsAvail + ); + + [PreserveSig] + int GetSourceEntryBySourceEntry( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_SYMBOL_SOURCE_ENTRY FromEntry, + uint Flags, + out DEBUG_SYMBOL_SOURCE_ENTRY ToEntry + ); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols4.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols4.cs new file mode 100644 index 0000000000..463704e475 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols4.cs @@ -0,0 +1,958 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("e391bbd8-9d8c-4418-840b-c006592a1752")] + public interface IDebugSymbols4 : IDebugSymbols3 + { + /* IDebugSymbols */ + + [PreserveSig] + new int GetSymbolOptions( + out SYMOPT Options); + + [PreserveSig] + new int AddSymbolOptions( + SYMOPT Options); + + [PreserveSig] + new int RemoveSymbolOptions( + SYMOPT Options); + + [PreserveSig] + new int SetSymbolOptions( + SYMOPT Options); + + [PreserveSig] + new int GetNameByOffset( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + new int GetOffsetByName( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out ulong Offset); + + [PreserveSig] + new int GetNearNameByOffset( + ulong Offset, + int Delta, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + new int GetLineByOffset( + ulong Offset, + out uint Line, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer, + int FileBufferSize, + out uint FileSize, + out ulong Displacement); + + [PreserveSig] + new int GetOffsetByLine( + uint Line, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + out ulong Offset); + + [PreserveSig] + new int GetNumberModules( + out uint Loaded, + out uint Unloaded); + + [PreserveSig] + new int GetModuleByIndex( + uint Index, + out ulong Base); + + [PreserveSig] + new int GetModuleByModuleName( + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + uint StartIndex, + out uint Index, + out ulong Base); + + [PreserveSig] + new int GetModuleByOffset( + ulong Offset, + uint StartIndex, + out uint Index, + out ulong Base); + + [PreserveSig] + new int GetModuleNames( + uint Index, + ulong Base, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ImageNameBuffer, + int ImageNameBufferSize, + out uint ImageNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ModuleNameBuffer, + int ModuleNameBufferSize, + out uint ModuleNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder LoadedImageNameBuffer, + int LoadedImageNameBufferSize, + out uint LoadedImageNameSize); + + [PreserveSig] + new int GetModuleParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] ulong[] Bases, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_PARAMETERS[] Params); + + [PreserveSig] + new int GetSymbolModule( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out ulong Base); + + [PreserveSig] + new int GetTypeName( + ulong Module, + uint TypeId, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize); + + [PreserveSig] + new int GetTypeId( + ulong Module, + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + out uint TypeId); + + [PreserveSig] + new int GetTypeSize( + ulong Module, + uint TypeId, + out uint Size); + + [PreserveSig] + new int GetFieldOffset( + ulong Module, + uint TypeId, + [In][MarshalAs(UnmanagedType.LPStr)] string Field, + out uint Offset); + + [PreserveSig] + new int GetSymbolTypeId( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out uint TypeId, + out ulong Module); + + [PreserveSig] + new int GetOffsetTypeId( + ulong Offset, + out uint TypeId, + out ulong Module); + + [PreserveSig] + new int ReadTypedDataVirtual( + ulong Offset, + ulong Module, + uint TypeId, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] Buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteTypedDataVirtual( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int OutputTypedDataVirtual( + DEBUG_OUTCTL OutputControl, + ulong Offset, + ulong Module, + uint TypeId, + DEBUG_TYPEOPTS Flags); + + [PreserveSig] + new int ReadTypedDataPhysical( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteTypedDataPhysical( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int OutputTypedDataPhysical( + DEBUG_OUTCTL OutputControl, + ulong Offset, + ulong Module, + uint TypeId, + DEBUG_TYPEOPTS Flags); + + [PreserveSig] + new int GetScope( + out ulong InstructionOffset, + out DEBUG_STACK_FRAME ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize); + + [PreserveSig] + new int SetScope( + ulong InstructionOffset, + in DEBUG_STACK_FRAME ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize); + + [PreserveSig] + new int ResetScope(); + + [PreserveSig] + new int GetScopeSymbolGroup( + DEBUG_SCOPE_GROUP Flags, + [In][MarshalAs(UnmanagedType.Interface)] + IDebugSymbolGroup Update, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup Symbols); + + [PreserveSig] + new int CreateSymbolGroup( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup Group); + + [PreserveSig] + new int StartSymbolMatch( + [In][MarshalAs(UnmanagedType.LPStr)] string Pattern, + out ulong Handle); + + [PreserveSig] + new int GetNextSymbolMatch( + ulong Handle, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint MatchSize, + out ulong Offset); + + [PreserveSig] + new int EndSymbolMatch( + ulong Handle); + + [PreserveSig] + new int Reload( + [In][MarshalAs(UnmanagedType.LPStr)] string Module); + + [PreserveSig] + new int GetSymbolPath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int SetSymbolPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + new int AppendSymbolPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + new int GetImagePath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int SetImagePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + new int AppendImagePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + new int GetSourcePath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int GetSourcePathElement( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ElementSize); + + [PreserveSig] + new int SetSourcePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + new int AppendSourcePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + new int FindSourceFile( + uint StartElement, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + DEBUG_FIND_SOURCE Flags, + out uint FoundElement, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FoundSize); + + [PreserveSig] + new int GetSourceFileLineOffsets( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Buffer, + int BufferLines, + out uint FileLines); + + /* IDebugSymbols2 */ + + [PreserveSig] + new int GetModuleVersionInformation( + uint Index, + ulong Base, + [In][MarshalAs(UnmanagedType.LPStr)] string Item, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] buffer, + uint BufferSize, + out uint VerInfoSize); + + [PreserveSig] + new int GetModuleNameString( + DEBUG_MODNAME Which, + uint Index, + ulong Base, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + uint BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetConstantName( + ulong Module, + uint TypeId, + ulong Value, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetFieldName( + ulong Module, + uint TypeId, + uint FieldIndex, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetTypeOptions( + out DEBUG_TYPEOPTS Options); + + [PreserveSig] + new int AddTypeOptions( + DEBUG_TYPEOPTS Options); + + [PreserveSig] + new int RemoveTypeOptions( + DEBUG_TYPEOPTS Options); + + [PreserveSig] + new int SetTypeOptions( + DEBUG_TYPEOPTS Options); + + /* IDebugSymbols3 */ + + [PreserveSig] + new int GetNameByOffsetWide( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + new int GetOffsetByNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Symbol, + out ulong Offset); + + [PreserveSig] + new int GetNearNameByOffsetWide( + ulong Offset, + int Delta, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + new int GetLineByOffsetWide( + ulong Offset, + out uint Line, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder FileBuffer, + int FileBufferSize, + out uint FileSize, + out ulong Displacement); + + [PreserveSig] + new int GetOffsetByLineWide( + uint Line, + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + out ulong Offset); + + [PreserveSig] + new int GetModuleByModuleNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + uint StartIndex, + out uint Index, + out ulong Base); + + [PreserveSig] + new int GetSymbolModuleWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Symbol, + out ulong Base); + + [PreserveSig] + new int GetTypeNameWide( + ulong Module, + uint TypeId, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize); + + [PreserveSig] + new int GetTypeIdWide( + ulong Module, + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + out uint TypeId); + + [PreserveSig] + new int GetFieldOffsetWide( + ulong Module, + uint TypeId, + [In][MarshalAs(UnmanagedType.LPWStr)] string Field, + out uint Offset); + + [PreserveSig] + new int GetSymbolTypeIdWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Symbol, + out uint TypeId, + out ulong Module); + + [PreserveSig] + new int GetScopeSymbolGroup2( + DEBUG_SCOPE_GROUP Flags, + [In][MarshalAs(UnmanagedType.Interface)] + IDebugSymbolGroup2 Update, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup2 Symbols); + + [PreserveSig] + new int CreateSymbolGroup2( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup2 Group); + + [PreserveSig] + new int StartSymbolMatchWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Pattern, + out ulong Handle); + + [PreserveSig] + new int GetNextSymbolMatchWide( + ulong Handle, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint MatchSize, + out ulong Offset); + + [PreserveSig] + new int ReloadWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Module); + + [PreserveSig] + new int GetSymbolPathWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int SetSymbolPathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path); + + [PreserveSig] + new int AppendSymbolPathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Addition); + + [PreserveSig] + new int GetImagePathWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int SetImagePathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path); + + [PreserveSig] + new int AppendImagePathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Addition); + + [PreserveSig] + new int GetSourcePathWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int GetSourcePathElementWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint ElementSize); + + [PreserveSig] + new int SetSourcePathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path); + + [PreserveSig] + new int AppendSourcePathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Addition); + + [PreserveSig] + new int FindSourceFileWide( + uint StartElement, + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + DEBUG_FIND_SOURCE Flags, + out uint FoundElement, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint FoundSize); + + [PreserveSig] + new int GetSourceFileLineOffsetsWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Buffer, + int BufferLines, + out uint FileLines); + + [PreserveSig] + new int GetModuleVersionInformationWide( + uint Index, + ulong Base, + [In][MarshalAs(UnmanagedType.LPWStr)] string Item, + IntPtr Buffer, + int BufferSize, + out uint VerInfoSize); + + [PreserveSig] + new int GetModuleNameStringWide( + DEBUG_MODNAME Which, + uint Index, + ulong Base, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetConstantNameWide( + ulong Module, + uint TypeId, + ulong Value, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetFieldNameWide( + ulong Module, + uint TypeId, + uint FieldIndex, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + new int IsManagedModule( + uint Index, + ulong Base + ); + + [PreserveSig] + new int GetModuleByModuleName2( + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + uint StartIndex, + DEBUG_GETMOD Flags, + out uint Index, + out ulong Base + ); + + [PreserveSig] + new int GetModuleByModuleName2Wide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + uint StartIndex, + DEBUG_GETMOD Flags, + out uint Index, + out ulong Base + ); + + [PreserveSig] + new int GetModuleByOffset2( + ulong Offset, + uint StartIndex, + DEBUG_GETMOD Flags, + out uint Index, + out ulong Base + ); + + [PreserveSig] + new int AddSyntheticModule( + ulong Base, + uint Size, + [In][MarshalAs(UnmanagedType.LPStr)] string ImagePath, + [In][MarshalAs(UnmanagedType.LPStr)] string ModuleName, + DEBUG_ADDSYNTHMOD Flags + ); + + [PreserveSig] + new int AddSyntheticModuleWide( + ulong Base, + uint Size, + [In][MarshalAs(UnmanagedType.LPWStr)] string ImagePath, + [In][MarshalAs(UnmanagedType.LPWStr)] string ModuleName, + DEBUG_ADDSYNTHMOD Flags + ); + + [PreserveSig] + new int RemoveSyntheticModule( + ulong Base + ); + + [PreserveSig] + new int GetCurrentScopeFrameIndex( + out uint Index + ); + + [PreserveSig] + new int SetScopeFrameByIndex( + uint Index + ); + + [PreserveSig] + new int SetScopeFromJitDebugInfo( + uint OutputControl, + ulong InfoOffset + ); + + [PreserveSig] + new int SetScopeFromStoredEvent( + ); + + [PreserveSig] + new int OutputSymbolByOffset( + uint OutputControl, + DEBUG_OUTSYM Flags, + ulong Offset + ); + + [PreserveSig] + new int GetFunctionEntryByOffset( + ulong Offset, + DEBUG_GETFNENT Flags, + IntPtr Buffer, + uint BufferSize, + out uint BufferNeeded + ); + + [PreserveSig] + new int GetFieldTypeAndOffset( + ulong Module, + uint ContainerTypeId, + [In][MarshalAs(UnmanagedType.LPStr)] string Field, + out uint FieldTypeId, + out uint Offset + ); + + [PreserveSig] + new int GetFieldTypeAndOffsetWide( + ulong Module, + uint ContainerTypeId, + [In][MarshalAs(UnmanagedType.LPWStr)] string Field, + out uint FieldTypeId, + out uint Offset + ); + + [PreserveSig] + new int AddSyntheticSymbol( + ulong Offset, + uint Size, + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + DEBUG_ADDSYNTHSYM Flags, + out DEBUG_MODULE_AND_ID Id + ); + + [PreserveSig] + new int AddSyntheticSymbolWide( + ulong Offset, + uint Size, + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + DEBUG_ADDSYNTHSYM Flags, + out DEBUG_MODULE_AND_ID Id + ); + + [PreserveSig] + new int RemoveSyntheticSymbol( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id + ); + + [PreserveSig] + new int GetSymbolEntriesByOffset( + ulong Offset, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_AND_ID[] Ids, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Displacements, + uint IdsCount, + out uint Entries + ); + + [PreserveSig] + new int GetSymbolEntriesByName( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_AND_ID[] Ids, + uint IdsCount, + out uint Entries + ); + + [PreserveSig] + new int GetSymbolEntriesByNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Symbol, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_AND_ID[] Ids, + uint IdsCount, + out uint Entries + ); + + [PreserveSig] + new int GetSymbolEntryByToken( + ulong ModuleBase, + uint Token, + out DEBUG_MODULE_AND_ID Id + ); + + [PreserveSig] + new int GetSymbolEntryInformation( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id, + out DEBUG_SYMBOL_ENTRY Info + ); + + [PreserveSig] + new int GetSymbolEntryString( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id, + uint Which, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize + ); + + [PreserveSig] + new int GetSymbolEntryStringWide( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id, + uint Which, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize + ); + + [PreserveSig] + new int GetSymbolEntryOffsetRegions( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_OFFSET_REGION[] Regions, + uint RegionsCount, + out uint RegionsAvail + ); + + [Obsolete("Do not use: no longer implemented.", true)] + [PreserveSig] + new int GetSymbolEntryBySymbolEntry( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID FromId, + uint Flags, + out DEBUG_MODULE_AND_ID ToId + ); + + [PreserveSig] + new int GetSourceEntriesByOffset( + ulong Offset, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SYMBOL_SOURCE_ENTRY[] Entries, + uint EntriesCount, + out uint EntriesAvail + ); + + [PreserveSig] + new int GetSourceEntriesByLine( + uint Line, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SYMBOL_SOURCE_ENTRY[] Entries, + uint EntriesCount, + out uint EntriesAvail + ); + + [PreserveSig] + new int GetSourceEntriesByLineWide( + uint Line, + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SYMBOL_SOURCE_ENTRY[] Entries, + uint EntriesCount, + out uint EntriesAvail + ); + + [PreserveSig] + new int GetSourceEntryString( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_SYMBOL_SOURCE_ENTRY Entry, + uint Which, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize + ); + + [PreserveSig] + new int GetSourceEntryStringWide( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_SYMBOL_SOURCE_ENTRY Entry, + uint Which, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize + ); + + [PreserveSig] + new int GetSourceEntryOffsetRegions( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_SYMBOL_SOURCE_ENTRY Entry, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_OFFSET_REGION[] Regions, + uint RegionsCount, + out uint RegionsAvail + ); + + [PreserveSig] + new int GetSourceEntryBySourceEntry( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_SYMBOL_SOURCE_ENTRY FromEntry, + uint Flags, + out DEBUG_SYMBOL_SOURCE_ENTRY ToEntry + ); + + /* IDebugSymbols4 */ + + [PreserveSig] + int GetScopeEx( + out ulong InstructionOffset, + out DEBUG_STACK_FRAME_EX ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize + ); + + [PreserveSig] + int SetScopeEx( + ulong InstructionOffset, + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_STACK_FRAME_EX ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize + ); + + [PreserveSig] + int GetNameByInlineContext( + ulong Offset, + uint InlineContext, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement + ); + + [PreserveSig] + int GetNameByInlineContextWide( + ulong Offset, + uint InlineContext, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement + ); + + [PreserveSig] + int GetLineByInlineContext( + ulong Offset, + uint InlineContext, + out uint Line, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer, + int FileBufferSize, + out uint FileSize, + out ulong Displacement + ); + + [PreserveSig] + int GetLineByInlineContextWide( + ulong Offset, + uint InlineContext, + out uint Line, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder FileBuffer, + int FileBufferSize, + out uint FileSize, + out ulong Displacement + ); + + [PreserveSig] + int OutputSymbolByInlineContext( + uint OutputControl, + uint Flags, + ulong Offset, + uint InlineContext + ); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols5.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols5.cs new file mode 100644 index 0000000000..1246471467 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSymbols5.cs @@ -0,0 +1,972 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("c65fa83e-1e69-475e-8e0e-b5d79e9cc17e")] + public interface IDebugSymbols5 : IDebugSymbols4 + { + /* IDebugSymbols */ + + [PreserveSig] + new int GetSymbolOptions( + out SYMOPT Options); + + [PreserveSig] + new int AddSymbolOptions( + SYMOPT Options); + + [PreserveSig] + new int RemoveSymbolOptions( + SYMOPT Options); + + [PreserveSig] + new int SetSymbolOptions( + SYMOPT Options); + + [PreserveSig] + new int GetNameByOffset( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + new int GetOffsetByName( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out ulong Offset); + + [PreserveSig] + new int GetNearNameByOffset( + ulong Offset, + int Delta, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + new int GetLineByOffset( + ulong Offset, + out uint Line, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer, + int FileBufferSize, + out uint FileSize, + out ulong Displacement); + + [PreserveSig] + new int GetOffsetByLine( + uint Line, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + out ulong Offset); + + [PreserveSig] + new int GetNumberModules( + out uint Loaded, + out uint Unloaded); + + [PreserveSig] + new int GetModuleByIndex( + uint Index, + out ulong Base); + + [PreserveSig] + new int GetModuleByModuleName( + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + uint StartIndex, + out uint Index, + out ulong Base); + + [PreserveSig] + new int GetModuleByOffset( + ulong Offset, + uint StartIndex, + out uint Index, + out ulong Base); + + [PreserveSig] + new int GetModuleNames( + uint Index, + ulong Base, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ImageNameBuffer, + int ImageNameBufferSize, + out uint ImageNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder ModuleNameBuffer, + int ModuleNameBufferSize, + out uint ModuleNameSize, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder LoadedImageNameBuffer, + int LoadedImageNameBufferSize, + out uint LoadedImageNameSize); + + [PreserveSig] + new int GetModuleParameters( + uint Count, + [In][MarshalAs(UnmanagedType.LPArray)] ulong[] Bases, + uint Start, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_PARAMETERS[] Params); + + [PreserveSig] + new int GetSymbolModule( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out ulong Base); + + [PreserveSig] + new int GetTypeName( + ulong Module, + uint TypeId, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize); + + [PreserveSig] + new int GetTypeId( + ulong Module, + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + out uint TypeId); + + [PreserveSig] + new int GetTypeSize( + ulong Module, + uint TypeId, + out uint Size); + + [PreserveSig] + new int GetFieldOffset( + ulong Module, + uint TypeId, + [In][MarshalAs(UnmanagedType.LPStr)] string Field, + out uint Offset); + + [PreserveSig] + new int GetSymbolTypeId( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + out uint TypeId, + out ulong Module); + + [PreserveSig] + new int GetOffsetTypeId( + ulong Offset, + out uint TypeId, + out ulong Module); + + [PreserveSig] + new int ReadTypedDataVirtual( + ulong Offset, + ulong Module, + uint TypeId, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] Buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteTypedDataVirtual( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int OutputTypedDataVirtual( + DEBUG_OUTCTL OutputControl, + ulong Offset, + ulong Module, + uint TypeId, + DEBUG_TYPEOPTS Flags); + + [PreserveSig] + new int ReadTypedDataPhysical( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesRead); + + [PreserveSig] + new int WriteTypedDataPhysical( + ulong Offset, + ulong Module, + uint TypeId, + IntPtr Buffer, + uint BufferSize, + out uint BytesWritten); + + [PreserveSig] + new int OutputTypedDataPhysical( + DEBUG_OUTCTL OutputControl, + ulong Offset, + ulong Module, + uint TypeId, + DEBUG_TYPEOPTS Flags); + + [PreserveSig] + new int GetScope( + out ulong InstructionOffset, + out DEBUG_STACK_FRAME ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize); + + [PreserveSig] + new int SetScope( + ulong InstructionOffset, + in DEBUG_STACK_FRAME ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize); + + [PreserveSig] + new int ResetScope(); + + [PreserveSig] + new int GetScopeSymbolGroup( + DEBUG_SCOPE_GROUP Flags, + [In][MarshalAs(UnmanagedType.Interface)] + IDebugSymbolGroup Update, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup Symbols); + + [PreserveSig] + new int CreateSymbolGroup( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup Group); + + [PreserveSig] + new int StartSymbolMatch( + [In][MarshalAs(UnmanagedType.LPStr)] string Pattern, + out ulong Handle); + + [PreserveSig] + new int GetNextSymbolMatch( + ulong Handle, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint MatchSize, + out ulong Offset); + + [PreserveSig] + new int EndSymbolMatch( + ulong Handle); + + [PreserveSig] + new int Reload( + [In][MarshalAs(UnmanagedType.LPStr)] string Module); + + [PreserveSig] + new int GetSymbolPath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int SetSymbolPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + new int AppendSymbolPath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + new int GetImagePath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int SetImagePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + new int AppendImagePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + new int GetSourcePath( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int GetSourcePathElement( + uint Index, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ElementSize); + + [PreserveSig] + new int SetSourcePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Path); + + [PreserveSig] + new int AppendSourcePath( + [In][MarshalAs(UnmanagedType.LPStr)] string Addition); + + [PreserveSig] + new int FindSourceFile( + uint StartElement, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + DEBUG_FIND_SOURCE Flags, + out uint FoundElement, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint FoundSize); + + [PreserveSig] + new int GetSourceFileLineOffsets( + [In][MarshalAs(UnmanagedType.LPStr)] string File, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Buffer, + int BufferLines, + out uint FileLines); + + /* IDebugSymbols2 */ + + [PreserveSig] + new int GetModuleVersionInformation( + uint Index, + ulong Base, + [In][MarshalAs(UnmanagedType.LPStr)] string Item, + [Out][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + byte[] buffer, + uint BufferSize, + out uint VerInfoSize); + + [PreserveSig] + new int GetModuleNameString( + DEBUG_MODNAME Which, + uint Index, + ulong Base, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + uint BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetConstantName( + ulong Module, + uint TypeId, + ulong Value, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetFieldName( + ulong Module, + uint TypeId, + uint FieldIndex, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetTypeOptions( + out DEBUG_TYPEOPTS Options); + + [PreserveSig] + new int AddTypeOptions( + DEBUG_TYPEOPTS Options); + + [PreserveSig] + new int RemoveTypeOptions( + DEBUG_TYPEOPTS Options); + + [PreserveSig] + new int SetTypeOptions( + DEBUG_TYPEOPTS Options); + + /* IDebugSymbols3 */ + + [PreserveSig] + new int GetNameByOffsetWide( + ulong Offset, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + new int GetOffsetByNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Symbol, + out ulong Offset); + + [PreserveSig] + new int GetNearNameByOffsetWide( + ulong Offset, + int Delta, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement); + + [PreserveSig] + new int GetLineByOffsetWide( + ulong Offset, + out uint Line, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder FileBuffer, + int FileBufferSize, + out uint FileSize, + out ulong Displacement); + + [PreserveSig] + new int GetOffsetByLineWide( + uint Line, + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + out ulong Offset); + + [PreserveSig] + new int GetModuleByModuleNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + uint StartIndex, + out uint Index, + out ulong Base); + + [PreserveSig] + new int GetSymbolModuleWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Symbol, + out ulong Base); + + [PreserveSig] + new int GetTypeNameWide( + ulong Module, + uint TypeId, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize); + + [PreserveSig] + new int GetTypeIdWide( + ulong Module, + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + out uint TypeId); + + [PreserveSig] + new int GetFieldOffsetWide( + ulong Module, + uint TypeId, + [In][MarshalAs(UnmanagedType.LPWStr)] string Field, + out uint Offset); + + [PreserveSig] + new int GetSymbolTypeIdWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Symbol, + out uint TypeId, + out ulong Module); + + [PreserveSig] + new int GetScopeSymbolGroup2( + DEBUG_SCOPE_GROUP Flags, + [In][MarshalAs(UnmanagedType.Interface)] + IDebugSymbolGroup2 Update, + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup2 Symbols); + + [PreserveSig] + new int CreateSymbolGroup2( + [Out][MarshalAs(UnmanagedType.Interface)] + out IDebugSymbolGroup2 Group); + + [PreserveSig] + new int StartSymbolMatchWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Pattern, + out ulong Handle); + + [PreserveSig] + new int GetNextSymbolMatchWide( + ulong Handle, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint MatchSize, + out ulong Offset); + + [PreserveSig] + new int ReloadWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Module); + + [PreserveSig] + new int GetSymbolPathWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int SetSymbolPathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path); + + [PreserveSig] + new int AppendSymbolPathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Addition); + + [PreserveSig] + new int GetImagePathWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int SetImagePathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path); + + [PreserveSig] + new int AppendImagePathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Addition); + + [PreserveSig] + new int GetSourcePathWide( + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint PathSize); + + [PreserveSig] + new int GetSourcePathElementWide( + uint Index, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint ElementSize); + + [PreserveSig] + new int SetSourcePathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Path); + + [PreserveSig] + new int AppendSourcePathWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Addition); + + [PreserveSig] + new int FindSourceFileWide( + uint StartElement, + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + DEBUG_FIND_SOURCE Flags, + out uint FoundElement, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint FoundSize); + + [PreserveSig] + new int GetSourceFileLineOffsetsWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Buffer, + int BufferLines, + out uint FileLines); + + [PreserveSig] + new int GetModuleVersionInformationWide( + uint Index, + ulong Base, + [In][MarshalAs(UnmanagedType.LPWStr)] string Item, + IntPtr Buffer, + int BufferSize, + out uint VerInfoSize); + + [PreserveSig] + new int GetModuleNameStringWide( + DEBUG_MODNAME Which, + uint Index, + ulong Base, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetConstantNameWide( + ulong Module, + uint TypeId, + ulong Value, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + new int GetFieldNameWide( + ulong Module, + uint TypeId, + uint FieldIndex, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint NameSize); + + [PreserveSig] + new int IsManagedModule( + uint Index, + ulong Base + ); + + [PreserveSig] + new int GetModuleByModuleName2( + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + uint StartIndex, + DEBUG_GETMOD Flags, + out uint Index, + out ulong Base + ); + + [PreserveSig] + new int GetModuleByModuleName2Wide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + uint StartIndex, + DEBUG_GETMOD Flags, + out uint Index, + out ulong Base + ); + + [PreserveSig] + new int GetModuleByOffset2( + ulong Offset, + uint StartIndex, + DEBUG_GETMOD Flags, + out uint Index, + out ulong Base + ); + + [PreserveSig] + new int AddSyntheticModule( + ulong Base, + uint Size, + [In][MarshalAs(UnmanagedType.LPStr)] string ImagePath, + [In][MarshalAs(UnmanagedType.LPStr)] string ModuleName, + DEBUG_ADDSYNTHMOD Flags + ); + + [PreserveSig] + new int AddSyntheticModuleWide( + ulong Base, + uint Size, + [In][MarshalAs(UnmanagedType.LPWStr)] string ImagePath, + [In][MarshalAs(UnmanagedType.LPWStr)] string ModuleName, + DEBUG_ADDSYNTHMOD Flags + ); + + [PreserveSig] + new int RemoveSyntheticModule( + ulong Base + ); + + [PreserveSig] + new int GetCurrentScopeFrameIndex( + out uint Index + ); + + [PreserveSig] + new int SetScopeFrameByIndex( + uint Index + ); + + [PreserveSig] + new int SetScopeFromJitDebugInfo( + uint OutputControl, + ulong InfoOffset + ); + + [PreserveSig] + new int SetScopeFromStoredEvent( + ); + + [PreserveSig] + new int OutputSymbolByOffset( + uint OutputControl, + DEBUG_OUTSYM Flags, + ulong Offset + ); + + [PreserveSig] + new int GetFunctionEntryByOffset( + ulong Offset, + DEBUG_GETFNENT Flags, + IntPtr Buffer, + uint BufferSize, + out uint BufferNeeded + ); + + [PreserveSig] + new int GetFieldTypeAndOffset( + ulong Module, + uint ContainerTypeId, + [In][MarshalAs(UnmanagedType.LPStr)] string Field, + out uint FieldTypeId, + out uint Offset + ); + + [PreserveSig] + new int GetFieldTypeAndOffsetWide( + ulong Module, + uint ContainerTypeId, + [In][MarshalAs(UnmanagedType.LPWStr)] string Field, + out uint FieldTypeId, + out uint Offset + ); + + [PreserveSig] + new int AddSyntheticSymbol( + ulong Offset, + uint Size, + [In][MarshalAs(UnmanagedType.LPStr)] string Name, + DEBUG_ADDSYNTHSYM Flags, + out DEBUG_MODULE_AND_ID Id + ); + + [PreserveSig] + new int AddSyntheticSymbolWide( + ulong Offset, + uint Size, + [In][MarshalAs(UnmanagedType.LPWStr)] string Name, + DEBUG_ADDSYNTHSYM Flags, + out DEBUG_MODULE_AND_ID Id + ); + + [PreserveSig] + new int RemoveSyntheticSymbol( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id + ); + + [PreserveSig] + new int GetSymbolEntriesByOffset( + ulong Offset, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_AND_ID[] Ids, + [Out][MarshalAs(UnmanagedType.LPArray)] + ulong[] Displacements, + uint IdsCount, + out uint Entries + ); + + [PreserveSig] + new int GetSymbolEntriesByName( + [In][MarshalAs(UnmanagedType.LPStr)] string Symbol, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_AND_ID[] Ids, + uint IdsCount, + out uint Entries + ); + + [PreserveSig] + new int GetSymbolEntriesByNameWide( + [In][MarshalAs(UnmanagedType.LPWStr)] string Symbol, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_MODULE_AND_ID[] Ids, + uint IdsCount, + out uint Entries + ); + + [PreserveSig] + new int GetSymbolEntryByToken( + ulong ModuleBase, + uint Token, + out DEBUG_MODULE_AND_ID Id + ); + + [PreserveSig] + new int GetSymbolEntryInformation( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id, + out DEBUG_SYMBOL_ENTRY Info + ); + + [PreserveSig] + new int GetSymbolEntryString( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id, + uint Which, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize + ); + + [PreserveSig] + new int GetSymbolEntryStringWide( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id, + uint Which, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize + ); + + [PreserveSig] + new int GetSymbolEntryOffsetRegions( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID Id, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_OFFSET_REGION[] Regions, + uint RegionsCount, + out uint RegionsAvail + ); + + [Obsolete("Do not use: no longer implemented.", true)] + [PreserveSig] + new int GetSymbolEntryBySymbolEntry( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_MODULE_AND_ID FromId, + uint Flags, + out DEBUG_MODULE_AND_ID ToId + ); + + [PreserveSig] + new int GetSourceEntriesByOffset( + ulong Offset, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SYMBOL_SOURCE_ENTRY[] Entries, + uint EntriesCount, + out uint EntriesAvail + ); + + [PreserveSig] + new int GetSourceEntriesByLine( + uint Line, + [In][MarshalAs(UnmanagedType.LPStr)] string File, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SYMBOL_SOURCE_ENTRY[] Entries, + uint EntriesCount, + out uint EntriesAvail + ); + + [PreserveSig] + new int GetSourceEntriesByLineWide( + uint Line, + [In][MarshalAs(UnmanagedType.LPWStr)] string File, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_SYMBOL_SOURCE_ENTRY[] Entries, + uint EntriesCount, + out uint EntriesAvail + ); + + [PreserveSig] + new int GetSourceEntryString( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_SYMBOL_SOURCE_ENTRY Entry, + uint Which, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize + ); + + [PreserveSig] + new int GetSourceEntryStringWide( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_SYMBOL_SOURCE_ENTRY Entry, + uint Which, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer, + int BufferSize, + out uint StringSize + ); + + [PreserveSig] + new int GetSourceEntryOffsetRegions( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_SYMBOL_SOURCE_ENTRY Entry, + uint Flags, + [Out][MarshalAs(UnmanagedType.LPArray)] + DEBUG_OFFSET_REGION[] Regions, + uint RegionsCount, + out uint RegionsAvail + ); + + [PreserveSig] + new int GetSourceEntryBySourceEntry( + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_SYMBOL_SOURCE_ENTRY FromEntry, + uint Flags, + out DEBUG_SYMBOL_SOURCE_ENTRY ToEntry + ); + + /* IDebugSymbols4 */ + + [PreserveSig] + new int GetScopeEx( + out ulong InstructionOffset, + out DEBUG_STACK_FRAME_EX ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize + ); + + [PreserveSig] + new int SetScopeEx( + ulong InstructionOffset, + [In][MarshalAs(UnmanagedType.LPStruct)] + DEBUG_STACK_FRAME_EX ScopeFrame, + IntPtr ScopeContext, + uint ScopeContextSize + ); + + [PreserveSig] + new int GetNameByInlineContext( + ulong Offset, + uint InlineContext, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement + ); + + [PreserveSig] + new int GetNameByInlineContextWide( + ulong Offset, + uint InlineContext, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer, + int NameBufferSize, + out uint NameSize, + out ulong Displacement + ); + + [PreserveSig] + new int GetLineByInlineContext( + ulong Offset, + uint InlineContext, + out uint Line, + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer, + int FileBufferSize, + out uint FileSize, + out ulong Displacement + ); + + [PreserveSig] + new int GetLineByInlineContextWide( + ulong Offset, + uint InlineContext, + out uint Line, + [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder FileBuffer, + int FileBufferSize, + out uint FileSize, + out ulong Displacement + ); + + [PreserveSig] + new int OutputSymbolByInlineContext( + uint OutputControl, + uint Flags, + ulong Offset, + uint InlineContext + ); + + /* IDebugSymbols5 */ + + [PreserveSig] + int GetCurrentScopeFrameIndexEx( + DEBUG_FRAME Flags, + out uint Index + ); + + [PreserveSig] + int SetScopeFrameByIndexEx( + DEBUG_FRAME Flags, + uint Index + ); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSystemObjects.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSystemObjects.cs new file mode 100644 index 0000000000..c861ab80f8 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSystemObjects.cs @@ -0,0 +1,153 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("6b86fe2c-2c4f-4f0c-9da2-174311acc327")] + public interface IDebugSystemObjects + { + [PreserveSig] + int GetEventThread( + out uint Id); + + [PreserveSig] + int GetEventProcess( + out uint Id); + + [PreserveSig] + int GetCurrentThreadId( + out uint Id); + + [PreserveSig] + int SetCurrentThreadId( + uint Id); + + [PreserveSig] + int GetCurrentProcessId( + out uint Id); + + [PreserveSig] + int SetCurrentProcessId( + uint Id); + + [PreserveSig] + int GetNumberThreads( + out uint Number); + + [PreserveSig] + int GetTotalNumberThreads( + out uint Total, + out uint LargestProcess); + + [PreserveSig] + int GetThreadIdsByIndex( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] Ids, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] SysIds); + + [PreserveSig] + int GetThreadIdByProcessor( + uint Processor, + out uint Id); + + [PreserveSig] + int GetCurrentThreadDataOffset( + out ulong Offset); + + [PreserveSig] + int GetThreadIdByDataOffset( + ulong Offset, + out uint Id); + + [PreserveSig] + int GetCurrentThreadTeb( + out ulong Offset); + + [PreserveSig] + int GetThreadIdByTeb( + ulong Offset, + out uint Id); + + [PreserveSig] + int GetCurrentThreadSystemId( + out uint SysId); + + [PreserveSig] + int GetThreadIdBySystemId( + uint SysId, + out uint Id); + + [PreserveSig] + int GetCurrentThreadHandle( + out ulong Handle); + + [PreserveSig] + int GetThreadIdByHandle( + ulong Handle, + out uint Id); + + [PreserveSig] + int GetNumberProcesses( + out uint Number); + + [PreserveSig] + int GetProcessIdsByIndex( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] Ids, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] SysIds); + + [PreserveSig] + int GetCurrentProcessDataOffset( + out ulong Offset); + + [PreserveSig] + int GetProcessIdByDataOffset( + ulong Offset, + out uint Id); + + [PreserveSig] + int GetCurrentProcessPeb( + out ulong Offset); + + [PreserveSig] + int GetProcessIdByPeb( + ulong Offset, + out uint Id); + + [PreserveSig] + int GetCurrentProcessSystemId( + out uint SysId); + + [PreserveSig] + int GetProcessIdBySystemId( + uint SysId, + out uint Id); + + [PreserveSig] + int GetCurrentProcessHandle( + out ulong Handle); + + [PreserveSig] + int GetProcessIdByHandle( + ulong Handle, + out uint Id); + + [PreserveSig] + int GetCurrentProcessExecutableName( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ExeSize); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSystemObjects2.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSystemObjects2.cs new file mode 100644 index 0000000000..d7cf7052f0 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSystemObjects2.cs @@ -0,0 +1,177 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("0ae9f5ff-1852-4679-b055-494bee6407ee")] + public interface IDebugSystemObjects2 : IDebugSystemObjects + { + /* IDebugSystemObjects */ + + [PreserveSig] + new int GetEventThread( + out uint Id); + + [PreserveSig] + new int GetEventProcess( + out uint Id); + + [PreserveSig] + new int GetCurrentThreadId( + out uint Id); + + [PreserveSig] + new int SetCurrentThreadId( + uint Id); + + [PreserveSig] + new int GetCurrentProcessId( + out uint Id); + + [PreserveSig] + new int SetCurrentProcessId( + uint Id); + + [PreserveSig] + new int GetNumberThreads( + out uint Number); + + [PreserveSig] + new int GetTotalNumberThreads( + out uint Total, + out uint LargestProcess); + + [PreserveSig] + new int GetThreadIdsByIndex( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] Ids, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] SysIds); + + [PreserveSig] + new int GetThreadIdByProcessor( + uint Processor, + out uint Id); + + [PreserveSig] + new int GetCurrentThreadDataOffset( + out ulong Offset); + + [PreserveSig] + new int GetThreadIdByDataOffset( + ulong Offset, + out uint Id); + + [PreserveSig] + new int GetCurrentThreadTeb( + out ulong Offset); + + [PreserveSig] + new int GetThreadIdByTeb( + ulong Offset, + out uint Id); + + [PreserveSig] + new int GetCurrentThreadSystemId( + out uint SysId); + + [PreserveSig] + new int GetThreadIdBySystemId( + uint SysId, + out uint Id); + + [PreserveSig] + new int GetCurrentThreadHandle( + out ulong Handle); + + [PreserveSig] + new int GetThreadIdByHandle( + ulong Handle, + out uint Id); + + [PreserveSig] + new int GetNumberProcesses( + out uint Number); + + [PreserveSig] + new int GetProcessIdsByIndex( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] Ids, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] SysIds); + + [PreserveSig] + new int GetCurrentProcessDataOffset( + out ulong Offset); + + [PreserveSig] + new int GetProcessIdByDataOffset( + ulong Offset, + out uint Id); + + [PreserveSig] + new int GetCurrentProcessPeb( + out ulong Offset); + + [PreserveSig] + new int GetProcessIdByPeb( + ulong Offset, + out uint Id); + + [PreserveSig] + new int GetCurrentProcessSystemId( + out uint SysId); + + [PreserveSig] + new int GetProcessIdBySystemId( + uint SysId, + out uint Id); + + [PreserveSig] + new int GetCurrentProcessHandle( + out ulong Handle); + + [PreserveSig] + new int GetProcessIdByHandle( + ulong Handle, + out uint Id); + + [PreserveSig] + new int GetCurrentProcessExecutableName( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ExeSize); + + /* IDebugSystemObjects2 */ + + [PreserveSig] + int GetCurrentProcessUpTime( + out uint UpTime); + + [PreserveSig] + int GetImplicitThreadDataOffset( + out ulong Offset); + + [PreserveSig] + int SetImplicitThreadDataOffset( + ulong Offset); + + [PreserveSig] + int GetImplicitProcessDataOffset( + out ulong Offset); + + [PreserveSig] + int SetImplicitProcessDataOffset( + ulong Offset); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSystemObjects3.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSystemObjects3.cs new file mode 100644 index 0000000000..e995a0a248 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/IDebugSystemObjects3.cs @@ -0,0 +1,214 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Text; + +namespace SOS.Hosting.DbgEng.Interop +{ + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("e9676e2f-e286-4ea3-b0f9-dfe5d9fc330e")] + public interface IDebugSystemObjects3 : IDebugSystemObjects + { + /* IDebugSystemObjects */ + + [PreserveSig] + new int GetEventThread( + out uint Id); + + [PreserveSig] + new int GetEventProcess( + out uint Id); + + [PreserveSig] + new int GetCurrentThreadId( + out uint Id); + + [PreserveSig] + new int SetCurrentThreadId( + uint Id); + + [PreserveSig] + new int GetCurrentProcessId( + out uint Id); + + [PreserveSig] + new int SetCurrentProcessId( + uint Id); + + [PreserveSig] + new int GetNumberThreads( + out uint Number); + + [PreserveSig] + new int GetTotalNumberThreads( + out uint Total, + out uint LargestProcess); + + [PreserveSig] + new int GetThreadIdsByIndex( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] Ids, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] SysIds); + + [PreserveSig] + new int GetThreadIdByProcessor( + uint Processor, + out uint Id); + + [PreserveSig] + new int GetCurrentThreadDataOffset( + out ulong Offset); + + [PreserveSig] + new int GetThreadIdByDataOffset( + ulong Offset, + out uint Id); + + [PreserveSig] + new int GetCurrentThreadTeb( + out ulong Offset); + + [PreserveSig] + new int GetThreadIdByTeb( + ulong Offset, + out uint Id); + + [PreserveSig] + new int GetCurrentThreadSystemId( + out uint SysId); + + [PreserveSig] + new int GetThreadIdBySystemId( + uint SysId, + out uint Id); + + [PreserveSig] + new int GetCurrentThreadHandle( + out ulong Handle); + + [PreserveSig] + new int GetThreadIdByHandle( + ulong Handle, + out uint Id); + + [PreserveSig] + new int GetNumberProcesses( + out uint Number); + + [PreserveSig] + new int GetProcessIdsByIndex( + uint Start, + uint Count, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] Ids, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] SysIds); + + [PreserveSig] + new int GetCurrentProcessDataOffset( + out ulong Offset); + + [PreserveSig] + new int GetProcessIdByDataOffset( + ulong Offset, + out uint Id); + + [PreserveSig] + new int GetCurrentProcessPeb( + out ulong Offset); + + [PreserveSig] + new int GetProcessIdByPeb( + ulong Offset, + out uint Id); + + [PreserveSig] + new int GetCurrentProcessSystemId( + out uint SysId); + + [PreserveSig] + new int GetProcessIdBySystemId( + uint SysId, + out uint Id); + + [PreserveSig] + new int GetCurrentProcessHandle( + out ulong Handle); + + [PreserveSig] + new int GetProcessIdByHandle( + ulong Handle, + out uint Id); + + [PreserveSig] + new int GetCurrentProcessExecutableName( + [Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer, + int BufferSize, + out uint ExeSize); + + /* IDebugSystemObjects2 */ + + [PreserveSig] + int GetCurrentProcessUpTime( + out uint UpTime); + + [PreserveSig] + int GetImplicitThreadDataOffset( + out ulong Offset); + + [PreserveSig] + int SetImplicitThreadDataOffset( + ulong Offset); + + [PreserveSig] + int GetImplicitProcessDataOffset( + out ulong Offset); + + [PreserveSig] + int SetImplicitProcessDataOffset( + ulong Offset); + + /* IDebugSystemObjects3 */ + [PreserveSig] + int GetEventSystem(out uint id); + + [PreserveSig] + int GetCurrentSystemId(out uint id); + + [PreserveSig] + int SetCurrentSystemId(uint id); + + [PreserveSig] + int GetNumberSystems(out uint count); + + [PreserveSig] + int GetSystemIdsByIndex( + uint start, + uint count, + [Out][MarshalAs(UnmanagedType.LPArray)] + uint[] Ids); + + [PreserveSig] + int GetTotalNumberThreadsAndProcesses( + out uint totalThreads, + out uint totalProcesses, + out uint largestProcessThreads, + out uint largestSystemThreads, + out uint largestSystemProcesses); + + [PreserveSig] + int GetCurrentSystemServer(out ulong server); + + [PreserveSig] + int GetSystemByServer(ulong server, out uint id); + + [PreserveSig] + int GetCurrentSystemServerName([Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder buffer, uint size, out uint needed); + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugBreakpointParameters.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugBreakpointParameters.cs new file mode 100644 index 0000000000..411667c536 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugBreakpointParameters.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_BREAKPOINT_PARAMETERS + { + public ulong Offset; + public uint Id; + public DEBUG_BREAKPOINT_TYPE BreakType; + public uint ProcType; + public DEBUG_BREAKPOINT_FLAG Flags; + public uint DataSize; + public DEBUG_BREAKPOINT_ACCESS_TYPE DataAccessType; + public uint PassCount; + public uint CurrentPassCount; + public uint MatchThread; + public uint CommandSize; + public uint OffsetExpressionSize; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugCachedSymbolInfo.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugCachedSymbolInfo.cs new file mode 100644 index 0000000000..315826be3b --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugCachedSymbolInfo.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_CACHED_SYMBOL_INFO + { + public ulong ModBase; + public ulong Arg1; + public ulong Arg2; + public uint Id; + public uint Arg3; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugCreateProcessOptions.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugCreateProcessOptions.cs new file mode 100644 index 0000000000..7bf036c91f --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugCreateProcessOptions.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_CREATE_PROCESS_OPTIONS + { + public DEBUG_CREATE_PROCESS CreateFlags; + public DEBUG_ECREATE_PROCESS EngCreateFlags; + public uint VerifierFlags; + public uint Reserved; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugEventContext.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugEventContext.cs new file mode 100644 index 0000000000..460e29c8ab --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugEventContext.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_EVENT_CONTEXT + { + public uint Size; + public uint ProcessEngineId; + public uint ThreadEngineId; + public uint FrameEngineId; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugExceptionFilterParameters.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugExceptionFilterParameters.cs new file mode 100644 index 0000000000..16b6fecb37 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugExceptionFilterParameters.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_EXCEPTION_FILTER_PARAMETERS + { + public DEBUG_FILTER_EXEC_OPTION ExecutionOption; + public DEBUG_FILTER_CONTINUE_OPTION ContinueOption; + public uint TextSize; + public uint CommandSize; + public uint SecondCommandSize; + public uint ExceptionCode; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugGetTextCompletionsIn.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugGetTextCompletionsIn.cs new file mode 100644 index 0000000000..e9ff2ba4af --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugGetTextCompletionsIn.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_GET_TEXT_COMPLETIONS_IN + { + public DEBUG_GET_TEXT_COMPLETIONS Flags; + public uint MatchCountLimit; + public ulong Reserved0; + public ulong Reserved1; + public ulong Reserved2; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugGetTextCompletionsOut.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugGetTextCompletionsOut.cs new file mode 100644 index 0000000000..c70463aaef --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugGetTextCompletionsOut.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_GET_TEXT_COMPLETIONS_OUT + { + public DEBUG_GET_TEXT_COMPLETIONS Flags; + public uint ReplaceIndex; + public uint MatchCount; + public uint Reserved1; + public ulong Reserved2; + public ulong Reserved3; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugHandleDataBasic.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugHandleDataBasic.cs new file mode 100644 index 0000000000..b5db002e5e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugHandleDataBasic.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_HANDLE_DATA_BASIC + { + public uint TypeNameSize; + public uint ObjectNameSize; + public uint Attributes; + public uint GrantedAccess; + public uint HandleCount; + public uint PointerCount; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfo.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfo.cs new file mode 100644 index 0000000000..af922e63d4 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfo.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public struct DEBUG_LAST_EVENT_INFO + { + [FieldOffset(0)] + public DEBUG_LAST_EVENT_INFO_BREAKPOINT Breakpoint; + [FieldOffset(0)] + public DEBUG_LAST_EVENT_INFO_EXCEPTION Exception; + [FieldOffset(0)] + public DEBUG_LAST_EVENT_INFO_EXIT_THREAD ExitThread; + [FieldOffset(0)] + public DEBUG_LAST_EVENT_INFO_EXIT_PROCESS ExitProcess; + [FieldOffset(0)] + public DEBUG_LAST_EVENT_INFO_LOAD_MODULE LoadModule; + [FieldOffset(0)] + public DEBUG_LAST_EVENT_INFO_UNLOAD_MODULE UnloadModule; + [FieldOffset(0)] + public DEBUG_LAST_EVENT_INFO_SYSTEM_ERROR SystemError; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoBreakpoint.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoBreakpoint.cs new file mode 100644 index 0000000000..f159112ad7 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoBreakpoint.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_LAST_EVENT_INFO_BREAKPOINT + { + public uint Id; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoException.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoException.cs new file mode 100644 index 0000000000..8ec1a30abf --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoException.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_LAST_EVENT_INFO_EXCEPTION + { + public EXCEPTION_RECORD64 ExceptionRecord; + public uint FirstChance; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoExitProcess.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoExitProcess.cs new file mode 100644 index 0000000000..0cfa5fdd27 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoExitProcess.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_LAST_EVENT_INFO_EXIT_PROCESS + { + public uint ExitCode; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoExitThread.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoExitThread.cs new file mode 100644 index 0000000000..eb01311c8a --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoExitThread.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_LAST_EVENT_INFO_EXIT_THREAD + { + public uint ExitCode; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoLoadModule.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoLoadModule.cs new file mode 100644 index 0000000000..3e984511a1 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoLoadModule.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_LAST_EVENT_INFO_LOAD_MODULE + { + public ulong Base; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoSystemError.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoSystemError.cs new file mode 100644 index 0000000000..3ce01d4c18 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoSystemError.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_LAST_EVENT_INFO_SYSTEM_ERROR + { + public uint Error; + public uint Level; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoUnloadModule.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoUnloadModule.cs new file mode 100644 index 0000000000..dbf5ebfaba --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugLastEventInfoUnloadModule.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_LAST_EVENT_INFO_UNLOAD_MODULE + { + public ulong Base; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugModuleAndId.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugModuleAndId.cs new file mode 100644 index 0000000000..bb91ac4967 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugModuleAndId.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + /// + /// Describes a symbol within a module. + /// + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_MODULE_AND_ID + { + /// + /// The location in the target's virtual address space of the module's base address. + /// + public ulong ModuleBase; + + /// + /// The symbol ID of the symbol within the module. + /// + public ulong Id; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugModuleParameters.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugModuleParameters.cs new file mode 100644 index 0000000000..807bdcbeed --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugModuleParameters.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public unsafe struct DEBUG_MODULE_PARAMETERS + { + public ulong Base; + public uint Size; + public uint TimeDateStamp; + public uint Checksum; + public DEBUG_MODULE Flags; + public DEBUG_SYMTYPE SymbolType; + public uint ImageNameSize; + public uint ModuleNameSize; + public uint LoadedImageNameSize; + public uint SymbolFileNameSize; + public uint MappedImageNameSize; + public fixed ulong Reserved[2]; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugOffsetRegion.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugOffsetRegion.cs new file mode 100644 index 0000000000..8e55a14a0d --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugOffsetRegion.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public readonly struct DEBUG_OFFSET_REGION + { + private readonly ulong _base; + private readonly ulong _size; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugReadUserMinidumpStream.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugReadUserMinidumpStream.cs new file mode 100644 index 0000000000..5d512b7a80 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugReadUserMinidumpStream.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_READ_USER_MINIDUMP_STREAM + { + public uint StreamType; + public uint Flags; + public ulong Offset; + public IntPtr Buffer; + public uint BufferSize; + public uint BufferUsed; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugRegisterDescription.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugRegisterDescription.cs new file mode 100644 index 0000000000..7001b0f11e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugRegisterDescription.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_REGISTER_DESCRIPTION + { + public DEBUG_VALUE_TYPE Type; + public DEBUG_REGISTER Flags; + public ulong SubregMaster; + public ulong SubregLength; + public ulong SubregMask; + public ulong SubregShift; + public ulong Reserved0; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugSpecificFilterParameters.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugSpecificFilterParameters.cs new file mode 100644 index 0000000000..64f410cae5 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugSpecificFilterParameters.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_SPECIFIC_FILTER_PARAMETERS + { + public DEBUG_FILTER_EXEC_OPTION ExecutionOption; + public DEBUG_FILTER_CONTINUE_OPTION ContinueOption; + public uint TextSize; + public uint CommandSize; + public uint ArgumentSize; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugStackFrame.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugStackFrame.cs new file mode 100644 index 0000000000..8c49521184 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugStackFrame.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public unsafe struct DEBUG_STACK_FRAME + { + public ulong InstructionOffset; + public ulong ReturnOffset; + public ulong FrameOffset; + public ulong StackOffset; + public ulong FuncTableEntry; + public fixed ulong Params[4]; + public fixed ulong Reserved[6]; + public uint Virtual; + public uint FrameNumber; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugStackFrameEx.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugStackFrameEx.cs new file mode 100644 index 0000000000..3f6a181dcb --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugStackFrameEx.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public unsafe struct DEBUG_STACK_FRAME_EX + { + /* DEBUG_STACK_FRAME */ + public ulong InstructionOffset; + public ulong ReturnOffset; + public ulong FrameOffset; + public ulong StackOffset; + public ulong FuncTableEntry; + public fixed ulong Params[4]; + public fixed ulong Reserved[6]; + public uint Virtual; + public uint FrameNumber; + + /* DEBUG_STACK_FRAME_EX */ + public uint InlineFrameContext; + public uint Reserved1; + + public DEBUG_STACK_FRAME_EX(DEBUG_STACK_FRAME dsf) + { + InstructionOffset = dsf.InstructionOffset; + ReturnOffset = dsf.ReturnOffset; + FrameOffset = dsf.FrameOffset; + StackOffset = dsf.StackOffset; + FuncTableEntry = dsf.FuncTableEntry; + + fixed (ulong* pParams = Params) + for (int i = 0; i < 4; ++i) + pParams[i] = dsf.Params[i]; + + fixed (ulong* pReserved = Params) + for (int i = 0; i < 6; ++i) + pReserved[i] = dsf.Reserved[i]; + + Virtual = dsf.Virtual; + FrameNumber = dsf.FrameNumber; + InlineFrameContext = 0xFFFFFFFF; + Reserved1 = 0; + } + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugSymbolEntry.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugSymbolEntry.cs new file mode 100644 index 0000000000..de2d955d9f --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugSymbolEntry.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_SYMBOL_ENTRY + { + public ulong ModuleBase; + public ulong Offset; + public ulong Id; + public ulong Arg64; + public uint Size; + public uint Flags; + public uint TypeId; + public uint NameSize; + public uint Token; + public SymTag Tag; + public uint Arg32; + public uint Reserved; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugSymbolParameters.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugSymbolParameters.cs new file mode 100644 index 0000000000..168f47f5cb --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugSymbolParameters.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_SYMBOL_PARAMETERS + { + public ulong Module; + public uint TypeId; + public uint ParentSymbol; + public uint SubElements; + public DEBUG_SYMBOL Flags; + public ulong Reserved; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugSymbolSourceEntry.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugSymbolSourceEntry.cs new file mode 100644 index 0000000000..8a4b6f4983 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugSymbolSourceEntry.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public readonly struct DEBUG_SYMBOL_SOURCE_ENTRY + { + private readonly ulong _moduleBase; + private readonly ulong _offset; + private readonly ulong _fileNameId; + private readonly ulong _engineInternal; + private readonly uint _size; + private readonly uint _flags; + private readonly uint _fileNameSize; + // Line numbers are one-based. + // May be DEBUG_ANY_ID if unknown. + private readonly uint _startLine; + private readonly uint _endLine; + // Column numbers are one-based byte indices. + // May be DEBUG_ANY_ID if unknown. + private readonly uint _startColumn; + private readonly uint _endColumn; + private readonly uint _reserved; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugThreadBasicInformation.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugThreadBasicInformation.cs new file mode 100644 index 0000000000..7e78376028 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugThreadBasicInformation.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEBUG_THREAD_BASIC_INFORMATION + { + public DEBUG_TBINFO Valid; + public uint ExitStatus; + public uint PriorityClass; + public uint Priority; + public ulong CreateTime; + public ulong ExitTime; + public ulong KernelTime; + public ulong UserTime; + public ulong StartOffset; + public ulong Affinity; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugTypedData.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugTypedData.cs new file mode 100644 index 0000000000..6bd40eb51d --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugTypedData.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public unsafe struct _DEBUG_TYPED_DATA + { + public ulong ModBase; + public ulong Offset; + public ulong EngineHandle; + public ulong Data; + public uint Size; + public uint Flags; + public uint TypeId; + public uint BaseTypeId; + public uint Tag; + public uint Register; + public fixed ulong Internal[9]; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugValue.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugValue.cs new file mode 100644 index 0000000000..0a7db56ecc --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/DebugValue.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public unsafe struct DEBUG_VALUE + { + [FieldOffset(0)] + public byte I8; + [FieldOffset(0)] + public ushort I16; + [FieldOffset(0)] + public uint I32; + [FieldOffset(0)] + public ulong I64; + [FieldOffset(8)] + public uint Nat; + [FieldOffset(0)] + public float F32; + [FieldOffset(0)] + public double F64; + [FieldOffset(0)] + public fixed byte F80Bytes[10]; + [FieldOffset(0)] + public fixed byte F82Bytes[11]; + [FieldOffset(0)] + public fixed byte F128Bytes[16]; + [FieldOffset(0)] + public fixed byte VI8[16]; + [FieldOffset(0)] + public fixed ushort VI16[8]; + [FieldOffset(0)] + public fixed uint VI32[4]; + [FieldOffset(0)] + public fixed ulong VI64[2]; + [FieldOffset(0)] + public fixed float VF32[4]; + [FieldOffset(0)] + public fixed double VF64[2]; + [FieldOffset(0)] + public I64PARTS32 I64Parts32; + [FieldOffset(0)] + public F128PARTS64 F128Parts64; + [FieldOffset(0)] + public fixed byte RawBytes[24]; + [FieldOffset(24)] + public uint TailOfRawBytes; + [FieldOffset(28)] + public DEBUG_VALUE_TYPE Type; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ExceptionRecord64.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ExceptionRecord64.cs new file mode 100644 index 0000000000..6768177618 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ExceptionRecord64.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public unsafe struct EXCEPTION_RECORD64 + { + public uint ExceptionCode; + public uint ExceptionFlags; + public ulong ExceptionRecord; + public ulong ExceptionAddress; + public uint NumberParameters; + public uint __unusedAlignment; + public fixed ulong ExceptionInformation[15]; //EXCEPTION_MAXIMUM_PARAMETERS + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ExtTypedData.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ExtTypedData.cs new file mode 100644 index 0000000000..e14bafee20 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ExtTypedData.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public unsafe struct _EXT_TYPED_DATA + { + public _EXT_TDOP Operation; + public uint Flags; + public _DEBUG_TYPED_DATA InData; + public _DEBUG_TYPED_DATA OutData; + public uint InStrIndex; + public uint In32; + public uint Out32; + public ulong In64; + public ulong Out64; + public uint StrBufferIndex; + public uint StrBufferChars; + public uint StrCharsNeeded; + public uint DataBufferIndex; + public uint DataBufferBytes; + public uint DataBytesNeeded; + public uint Status; + public fixed ulong Reserved[8]; + } + + [StructLayout(LayoutKind.Sequential)] + public class EXT_TYPED_DATA + { + public _EXT_TDOP Operation; + public uint Flags; + public _DEBUG_TYPED_DATA InData; + public _DEBUG_TYPED_DATA OutData; + public uint InStrIndex; + public uint In32; + public uint Out32; + public ulong In64; + public ulong Out64; + public uint StrBufferIndex; + public uint StrBufferChars; + public uint StrCharsNeeded; + public uint DataBufferIndex; + public uint DataBufferBytes; + public uint DataBytesNeeded; + public uint Status; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/F128Parts64.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/F128Parts64.cs new file mode 100644 index 0000000000..1b028e5a38 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/F128Parts64.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public struct F128PARTS64 + { + [FieldOffset(0)] + public ulong LowPart; + [FieldOffset(8)] + public ulong HighPart; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/I64Parts32.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/I64Parts32.cs new file mode 100644 index 0000000000..0083645951 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/I64Parts32.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public struct I64PARTS32 + { + [FieldOffset(0)] + public uint LowPart; + [FieldOffset(4)] + public uint HighPart; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageCor20Header.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageCor20Header.cs new file mode 100644 index 0000000000..4bb0662b5f --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageCor20Header.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct IMAGE_COR20_HEADER + { + // Header versioning + public uint cb; + public ushort MajorRuntimeVersion; + public ushort MinorRuntimeVersion; + + // Symbol table and startup information + public IMAGE_DATA_DIRECTORY MetaData; + public uint Flags; + + // The main program if it is an EXE (not used if a DLL?) + // If COMIMAGE_FLAGS_NATIVE_ENTRYPOINT is not set, EntryPointToken represents a managed entrypoint. + // If COMIMAGE_FLAGS_NATIVE_ENTRYPOINT is set, EntryPointRVA represents an RVA to a native entrypoint + // (deprecated for DLLs, use modules constructors instead). + public IMAGE_COR20_HEADER_ENTRYPOINT EntryPoint; + + // This is the blob of managed resources. Fetched using code:AssemblyNative.GetResource and + // code:PEFile.GetResource and accessible from managed code from + // System.Assembly.GetManifestResourceStream. The meta data has a table that maps names to offsets into + // this blob, so logically the blob is a set of resources. + public IMAGE_DATA_DIRECTORY Resources; + // IL assemblies can be signed with a public-private key to validate who created it. The signature goes + // here if this feature is used. + public IMAGE_DATA_DIRECTORY StrongNameSignature; + + public IMAGE_DATA_DIRECTORY CodeManagerTable; // Deprecated, not used + // Used for managed code that has unmanaged code inside it (or exports methods as unmanaged entry points) + public IMAGE_DATA_DIRECTORY VTableFixups; + public IMAGE_DATA_DIRECTORY ExportAddressTableJumps; + + // null for ordinary IL images. NGEN images it points at a code:CORCOMPILE_HEADER structure + public IMAGE_DATA_DIRECTORY ManagedNativeHeader; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageCor20HeaderEntryPoint.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageCor20HeaderEntryPoint.cs new file mode 100644 index 0000000000..fad1546439 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageCor20HeaderEntryPoint.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public readonly struct IMAGE_COR20_HEADER_ENTRYPOINT + { + [FieldOffset(0)] + public readonly uint Token; + [FieldOffset(0)] + public readonly uint RVA; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageDataDirectory.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageDataDirectory.cs new file mode 100644 index 0000000000..92f5eec3b3 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageDataDirectory.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct IMAGE_DATA_DIRECTORY + { + public uint VirtualAddress; + public uint Size; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageDosHeader.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageDosHeader.cs new file mode 100644 index 0000000000..5e1c26e022 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageDosHeader.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public unsafe struct IMAGE_DOS_HEADER + { + [FieldOffset(0)] + public ushort e_magic; // Magic number + [FieldOffset(2)] + public ushort e_cblp; // Bytes on last page of file + [FieldOffset(4)] + public ushort e_cp; // Pages in file + [FieldOffset(6)] + public ushort e_crlc; // Relocations + [FieldOffset(8)] + public ushort e_cparhdr; // Size of header in paragraphs + [FieldOffset(10)] + public ushort e_minalloc; // Minimum extra paragraphs needed + [FieldOffset(12)] + public ushort e_maxalloc; // Maximum extra paragraphs needed + [FieldOffset(14)] + public ushort e_ss; // Initial (relative) SS value + [FieldOffset(16)] + public ushort e_sp; // Initial SP value + [FieldOffset(18)] + public ushort e_csum; // Checksum + [FieldOffset(20)] + public ushort e_ip; // Initial IP value + [FieldOffset(22)] + public ushort e_cs; // Initial (relative) CS value + [FieldOffset(24)] + public ushort e_lfarlc; // File address of relocation table + [FieldOffset(26)] + public ushort e_ovno; // Overlay number + [FieldOffset(28)] + public fixed ushort e_res[4]; // Reserved words + [FieldOffset(36)] + public ushort e_oemid; // OEM identifier (for e_oeminfo) + [FieldOffset(38)] + public ushort e_oeminfo; // OEM information; e_oemid specific + [FieldOffset(40)] + public fixed ushort e_res2[10]; // Reserved words + [FieldOffset(60)] + public uint e_lfanew; // File address of new exe header + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageFileHeader.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageFileHeader.cs new file mode 100644 index 0000000000..1890b4812e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageFileHeader.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public struct IMAGE_FILE_HEADER + { + [FieldOffset(0)] + public ushort Machine; + [FieldOffset(2)] + public ushort NumberOfSections; + [FieldOffset(4)] + public uint TimeDateStamp; + [FieldOffset(8)] + public uint PointerToSymbolTable; + [FieldOffset(12)] + public uint NumberOfSymbols; + [FieldOffset(16)] + public ushort SizeOfOptionalHeader; + [FieldOffset(18)] + public ushort Characteristics; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageHlpModule64.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageHlpModule64.cs new file mode 100644 index 0000000000..75168937d1 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageHlpModule64.cs @@ -0,0 +1,125 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public unsafe struct IMAGEHLP_MODULE64 + { + private const int MAX_PATH = 260; + + public uint SizeOfStruct; + public ulong BaseOfImage; + public uint ImageSize; + public uint TimeDateStamp; + public uint CheckSum; + public uint NumSyms; + public DEBUG_SYMTYPE SymType; + private fixed char _ModuleName[32]; + private fixed char _ImageName[256]; + private fixed char _LoadedImageName[256]; + private fixed char _LoadedPdbName[256]; + public uint CVSig; + public fixed char CVData[MAX_PATH * 3]; + public uint PdbSig; + public Guid PdbSig70; + public uint PdbAge; + private uint _bPdbUnmatched; /* BOOL */ + private uint _bDbgUnmatched; /* BOOL */ + private uint _bLineNumbers; /* BOOL */ + private uint _bGlobalSymbols; /* BOOL */ + private uint _bTypeInfo; /* BOOL */ + private uint _bSourceIndexed; /* BOOL */ + private uint _bPublics; /* BOOL */ + + public bool PdbUnmatched + { + get => _bPdbUnmatched != 0; + set => _bPdbUnmatched = value ? 1U : 0U; + } + + public bool DbgUnmatched + { + get => _bDbgUnmatched != 0; + set => _bDbgUnmatched = value ? 1U : 0U; + } + + public bool LineNumbers + { + get => _bLineNumbers != 0; + set => _bLineNumbers = value ? 1U : 0U; + } + + public bool GlobalSymbols + { + get => _bGlobalSymbols != 0; + set => _bGlobalSymbols = value ? 1U : 0U; + } + + public bool TypeInfo + { + get => _bTypeInfo != 0; + set => _bTypeInfo = value ? 1U : 0U; + } + + public bool SourceIndexed + { + get => _bSourceIndexed != 0; + set => _bSourceIndexed = value ? 1U : 0U; + } + + public bool Publics + { + get => _bPublics != 0; + set => _bPublics = value ? 1U : 0U; + } + + public string ModuleName + { + get + { + fixed (char* moduleNamePtr = _ModuleName) + { + return Marshal.PtrToStringUni((IntPtr)moduleNamePtr, 32); + } + } + } + + public string ImageName + { + get + { + fixed (char* imageNamePtr = _ImageName) + { + return Marshal.PtrToStringUni((IntPtr)imageNamePtr, 256); + } + } + } + + public string LoadedImageName + { + get + { + fixed (char* loadedImageNamePtr = _LoadedImageName) + { + return Marshal.PtrToStringUni((IntPtr)loadedImageNamePtr, 256); + } + } + } + + public string LoadedPdbName + { + get + { + fixed (char* loadedPdbNamePtr = _LoadedPdbName) + { + return Marshal.PtrToStringUni((IntPtr)loadedPdbNamePtr, 256); + } + } + } + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageImportDescriptor.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageImportDescriptor.cs new file mode 100644 index 0000000000..6de40c5671 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageImportDescriptor.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public struct IMAGE_IMPORT_DESCRIPTOR + { + [FieldOffset(0)] + public uint Characteristics; // 0 for terminating null import descriptor + [FieldOffset(0)] + public uint OriginalFirstThunk; // RVA to original unbound IAT (PIMAGE_THUNK_DATA) + [FieldOffset(4)] + public uint TimeDateStamp; // 0 if not bound, + // -1 if bound, and real date\time stamp + // in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT (new BIND) + // O.W. date/time stamp of DLL bound to (Old BIND) + + [FieldOffset(8)] + public uint ForwarderChain; // -1 if no forwarders + [FieldOffset(12)] + public uint Name; + [FieldOffset(16)] + public uint FirstThunk; // RVA to IAT (if bound this IAT has actual addresses) + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageNtHeaders32.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageNtHeaders32.cs new file mode 100644 index 0000000000..6a890682c1 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageNtHeaders32.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public struct IMAGE_NT_HEADERS32 + { + [FieldOffset(0)] + public uint Signature; + [FieldOffset(4)] + public IMAGE_FILE_HEADER FileHeader; + [FieldOffset(24)] + public IMAGE_OPTIONAL_HEADER32 OptionalHeader; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageNtHeaders64.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageNtHeaders64.cs new file mode 100644 index 0000000000..b7914ecb16 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageNtHeaders64.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public struct IMAGE_NT_HEADERS64 + { + [FieldOffset(0)] + public uint Signature; + [FieldOffset(4)] + public IMAGE_FILE_HEADER FileHeader; + [FieldOffset(24)] + public IMAGE_OPTIONAL_HEADER64 OptionalHeader; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageOptionalHeader32.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageOptionalHeader32.cs new file mode 100644 index 0000000000..dc0fa8703d --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageOptionalHeader32.cs @@ -0,0 +1,110 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public struct IMAGE_OPTIONAL_HEADER32 + { + [FieldOffset(0)] + public ushort Magic; + [FieldOffset(2)] + public byte MajorLinkerVersion; + [FieldOffset(3)] + public byte MinorLinkerVersion; + [FieldOffset(4)] + public uint SizeOfCode; + [FieldOffset(8)] + public uint SizeOfInitializedData; + [FieldOffset(12)] + public uint SizeOfUninitializedData; + [FieldOffset(16)] + public uint AddressOfEntryPoint; + [FieldOffset(20)] + public uint BaseOfCode; + [FieldOffset(24)] + public uint BaseOfData; + [FieldOffset(28)] + public uint ImageBase; + [FieldOffset(32)] + public uint SectionAlignment; + [FieldOffset(36)] + public uint FileAlignment; + [FieldOffset(40)] + public ushort MajorOperatingSystemVersion; + [FieldOffset(42)] + public ushort MinorOperatingSystemVersion; + [FieldOffset(44)] + public ushort MajorImageVersion; + [FieldOffset(46)] + public ushort MinorImageVersion; + [FieldOffset(48)] + public ushort MajorSubsystemVersion; + [FieldOffset(50)] + public ushort MinorSubsystemVersion; + [FieldOffset(52)] + public uint Win32VersionValue; + [FieldOffset(56)] + public uint SizeOfImage; + [FieldOffset(60)] + public uint SizeOfHeaders; + [FieldOffset(64)] + public uint CheckSum; + [FieldOffset(68)] + public ushort Subsystem; + [FieldOffset(70)] + public ushort DllCharacteristics; + [FieldOffset(72)] + public uint SizeOfStackReserve; + [FieldOffset(76)] + public uint SizeOfStackCommit; + [FieldOffset(80)] + public uint SizeOfHeapReserve; + [FieldOffset(84)] + public uint SizeOfHeapCommit; + [FieldOffset(88)] + public uint LoaderFlags; + [FieldOffset(92)] + public uint NumberOfRvaAndSizes; + [FieldOffset(96)] + public IMAGE_DATA_DIRECTORY DataDirectory0; + [FieldOffset(104)] + public IMAGE_DATA_DIRECTORY DataDirectory1; + [FieldOffset(112)] + public IMAGE_DATA_DIRECTORY DataDirectory2; + [FieldOffset(120)] + public IMAGE_DATA_DIRECTORY DataDirectory3; + [FieldOffset(128)] + public IMAGE_DATA_DIRECTORY DataDirectory4; + [FieldOffset(136)] + public IMAGE_DATA_DIRECTORY DataDirectory5; + [FieldOffset(144)] + public IMAGE_DATA_DIRECTORY DataDirectory6; + [FieldOffset(152)] + public IMAGE_DATA_DIRECTORY DataDirectory7; + [FieldOffset(160)] + public IMAGE_DATA_DIRECTORY DataDirectory8; + [FieldOffset(168)] + public IMAGE_DATA_DIRECTORY DataDirectory9; + [FieldOffset(176)] + public IMAGE_DATA_DIRECTORY DataDirectory10; + [FieldOffset(284)] + public IMAGE_DATA_DIRECTORY DataDirectory11; + [FieldOffset(292)] + public IMAGE_DATA_DIRECTORY DataDirectory12; + [FieldOffset(300)] + public IMAGE_DATA_DIRECTORY DataDirectory13; + [FieldOffset(308)] + public IMAGE_DATA_DIRECTORY DataDirectory14; + [FieldOffset(316)] + public IMAGE_DATA_DIRECTORY DataDirectory15; + + public static unsafe IMAGE_DATA_DIRECTORY* GetDataDirectory(IMAGE_OPTIONAL_HEADER32* header, int zeroBasedIndex) + { + return &header->DataDirectory0 + zeroBasedIndex; + } + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageOptionalHeader64.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageOptionalHeader64.cs new file mode 100644 index 0000000000..1b7076fd96 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageOptionalHeader64.cs @@ -0,0 +1,108 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public struct IMAGE_OPTIONAL_HEADER64 + { + [FieldOffset(0)] + public ushort Magic; + [FieldOffset(2)] + public byte MajorLinkerVersion; + [FieldOffset(3)] + public byte MinorLinkerVersion; + [FieldOffset(4)] + public uint SizeOfCode; + [FieldOffset(8)] + public uint SizeOfInitializedData; + [FieldOffset(12)] + public uint SizeOfUninitializedData; + [FieldOffset(16)] + public uint AddressOfEntryPoint; + [FieldOffset(20)] + public uint BaseOfCode; + [FieldOffset(24)] + public ulong ImageBase; + [FieldOffset(32)] + public uint SectionAlignment; + [FieldOffset(36)] + public uint FileAlignment; + [FieldOffset(40)] + public ushort MajorOperatingSystemVersion; + [FieldOffset(42)] + public ushort MinorOperatingSystemVersion; + [FieldOffset(44)] + public ushort MajorImageVersion; + [FieldOffset(46)] + public ushort MinorImageVersion; + [FieldOffset(48)] + public ushort MajorSubsystemVersion; + [FieldOffset(50)] + public ushort MinorSubsystemVersion; + [FieldOffset(52)] + public uint Win32VersionValue; + [FieldOffset(56)] + public uint SizeOfImage; + [FieldOffset(60)] + public uint SizeOfHeaders; + [FieldOffset(64)] + public uint CheckSum; + [FieldOffset(68)] + public ushort Subsystem; + [FieldOffset(70)] + public ushort DllCharacteristics; + [FieldOffset(72)] + public ulong SizeOfStackReserve; + [FieldOffset(80)] + public ulong SizeOfStackCommit; + [FieldOffset(88)] + public ulong SizeOfHeapReserve; + [FieldOffset(96)] + public ulong SizeOfHeapCommit; + [FieldOffset(104)] + public uint LoaderFlags; + [FieldOffset(108)] + public uint NumberOfRvaAndSizes; + [FieldOffset(112)] + public IMAGE_DATA_DIRECTORY DataDirectory0; + [FieldOffset(120)] + public IMAGE_DATA_DIRECTORY DataDirectory1; + [FieldOffset(128)] + public IMAGE_DATA_DIRECTORY DataDirectory2; + [FieldOffset(136)] + public IMAGE_DATA_DIRECTORY DataDirectory3; + [FieldOffset(144)] + public IMAGE_DATA_DIRECTORY DataDirectory4; + [FieldOffset(152)] + public IMAGE_DATA_DIRECTORY DataDirectory5; + [FieldOffset(160)] + public IMAGE_DATA_DIRECTORY DataDirectory6; + [FieldOffset(168)] + public IMAGE_DATA_DIRECTORY DataDirectory7; + [FieldOffset(176)] + public IMAGE_DATA_DIRECTORY DataDirectory8; + [FieldOffset(184)] + public IMAGE_DATA_DIRECTORY DataDirectory9; + [FieldOffset(192)] + public IMAGE_DATA_DIRECTORY DataDirectory10; + [FieldOffset(200)] + public IMAGE_DATA_DIRECTORY DataDirectory11; + [FieldOffset(208)] + public IMAGE_DATA_DIRECTORY DataDirectory12; + [FieldOffset(216)] + public IMAGE_DATA_DIRECTORY DataDirectory13; + [FieldOffset(224)] + public IMAGE_DATA_DIRECTORY DataDirectory14; + [FieldOffset(232)] + public IMAGE_DATA_DIRECTORY DataDirectory15; + + public static unsafe IMAGE_DATA_DIRECTORY* GetDataDirectory(IMAGE_OPTIONAL_HEADER64* header, int zeroBasedIndex) + { + return &header->DataDirectory0 + zeroBasedIndex; + } + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageThunkData32.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageThunkData32.cs new file mode 100644 index 0000000000..028e9afd3b --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageThunkData32.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public struct IMAGE_THUNK_DATA32 + { + [FieldOffset(0)] + public uint ForwarderString; // PBYTE + [FieldOffset(0)] + public uint Function; // PDWORD + [FieldOffset(0)] + public uint Ordinal; + [FieldOffset(0)] + public uint AddressOfData; // PIMAGE_IMPORT_BY_NAME + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageThunkData64.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageThunkData64.cs new file mode 100644 index 0000000000..0211ef8432 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/ImageThunkData64.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public struct IMAGE_THUNK_DATA64 + { + [FieldOffset(0)] + public ulong ForwarderString; // PBYTE + [FieldOffset(0)] + public ulong Function; // PDWORD + [FieldOffset(0)] + public ulong Ordinal; + [FieldOffset(0)] + public ulong AddressOfData; // PIMAGE_IMPORT_BY_NAME + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/LandAndCodePage.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/LandAndCodePage.cs new file mode 100644 index 0000000000..eddc5ae273 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/LandAndCodePage.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Explicit)] + public struct LANGANDCODEPAGE + { + [FieldOffset(0)] + public ushort wLanguage; + [FieldOffset(2)] + public ushort wCodePage; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/MemoryBasicInformation64.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/MemoryBasicInformation64.cs new file mode 100644 index 0000000000..75e6f751bc --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/MemoryBasicInformation64.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct MEMORY_BASIC_INFORMATION64 + { + public ulong BaseAddress; + public ulong AllocationBase; + public PAGE AllocationProtect; + public uint __alignment1; + public ulong RegionSize; + public MEM State; + public PAGE Protect; + public MEM Type; + public uint __alignment2; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/Rect.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/Rect.cs new file mode 100644 index 0000000000..8e250b6f72 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/Rect.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct RECT + { + public int left; + public int top; + public int right; + public int bottom; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/VsFixedFileInfo.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/VsFixedFileInfo.cs new file mode 100644 index 0000000000..6c5418f53e --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/VsFixedFileInfo.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct VS_FIXEDFILEINFO + { + public uint dwSignature; + public uint dwStrucVersion; + public uint dwFileVersionMS; + public uint dwFileVersionLS; + public uint dwProductVersionMS; + public uint dwProductVersionLS; + public uint dwFileFlagsMask; + public VS_FF dwFileFlags; + public uint dwFileOS; + public uint dwFileType; + public uint dwFileSubtype; + public uint dwFileDateMS; + public uint dwFileDateLS; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/WdbgExtsClrDataInterface.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/WdbgExtsClrDataInterface.cs new file mode 100644 index 0000000000..b5060c3e5c --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/WdbgExtsClrDataInterface.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public unsafe struct WDBGEXTS_CLR_DATA_INTERFACE + { + public Guid* Iid; + private readonly void* _iface; + + public WDBGEXTS_CLR_DATA_INTERFACE(Guid* iid) + { + Iid = iid; + _iface = null; + } + + public object Interface => _iface != null ? Marshal.GetObjectForIUnknown((IntPtr)_iface) : null; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/WdbgExtsThreadOsInfo.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/WdbgExtsThreadOsInfo.cs new file mode 100644 index 0000000000..809188866f --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/WdbgExtsThreadOsInfo.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct WDBGEXTS_THREAD_OS_INFO + { + public uint ThreadId; + public uint ExitStatus; + public uint PriorityClass; + public uint Priority; + public ulong CreateTime; + public ulong ExitTime; + public ulong KernelTime; + public ulong UserTime; + public ulong StartOffset; + public ulong Affinity; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/WinDbgExtensionApis.cs b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/WinDbgExtensionApis.cs new file mode 100644 index 0000000000..bbd6375340 --- /dev/null +++ b/src/SOS/SOS.Hosting/DbgEng/Interop/Structs/WinDbgExtensionApis.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace SOS.Hosting.DbgEng.Interop +{ + [StructLayout(LayoutKind.Sequential)] + public struct WINDBG_EXTENSION_APIS /*32 or 64; both are defined the same in managed code*/ + { + public uint nSize; + public IntPtr lpOutputRoutine; + public IntPtr lpGetExpressionRoutine; + public IntPtr lpGetSymbolRoutine; + public IntPtr lpDisasmRoutine; + public IntPtr lpCheckControlCRoutine; + public IntPtr lpReadProcessMemoryRoutine; + public IntPtr lpWriteProcessMemoryRoutine; + public IntPtr lpGetThreadContextRoutine; + public IntPtr lpSetThreadContextRoutine; + public IntPtr lpIoctlRoutine; + public IntPtr lpStackTraceRoutine; + } +} \ No newline at end of file diff --git a/src/SOS/SOS.Hosting/LLDBServices.cs b/src/SOS/SOS.Hosting/LLDBServices.cs index f954c39919..d10050fc5a 100644 --- a/src/SOS/SOS.Hosting/LLDBServices.cs +++ b/src/SOS/SOS.Hosting/LLDBServices.cs @@ -3,14 +3,12 @@ // See the LICENSE file in the project root for more information. using Microsoft.Diagnostics.DebugServices; -using Microsoft.Diagnostics.Runtime; -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng.Interop; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; using System.Runtime.InteropServices; using System.Text; diff --git a/src/SOS/SOS.Hosting/RuntimeWrapper.cs b/src/SOS/SOS.Hosting/RuntimeWrapper.cs index 4cd6d655df..4306f83d43 100644 --- a/src/SOS/SOS.Hosting/RuntimeWrapper.cs +++ b/src/SOS/SOS.Hosting/RuntimeWrapper.cs @@ -4,8 +4,8 @@ using Microsoft.Diagnostics.DebugServices; using Microsoft.Diagnostics.Runtime; -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng.Interop; using System; using System.Diagnostics; using System.IO; @@ -252,8 +252,8 @@ private int GetEEVersion( { return HResult.E_FAIL; } - VersionData versionData = module.GetVersionData(); - if (versionData is null) + Version version = module.GetVersionData(); + if (version is null) { return HResult.E_FAIL; } @@ -261,8 +261,8 @@ private int GetEEVersion( pFileInfo->dwStrucVersion = 0; pFileInfo->dwFileFlagsMask = 0; pFileInfo->dwFileFlags = 0; - pFileInfo->dwFileVersionMS = (uint)versionData.Minor | (uint)versionData.Major << 16; - pFileInfo->dwFileVersionLS = (uint)versionData.Patch | (uint)versionData.Revision << 16; + pFileInfo->dwFileVersionMS = (uint)version.Minor & 0xffff | (uint)version.Major << 16; + pFileInfo->dwFileVersionLS = (uint)version.Revision & 0xffff | (uint)version.Build << 16; // Attempt to get the FileVersion string that contains version and the "built by" and commit id info if (fileVersionBuffer != null) diff --git a/src/SOS/SOS.Hosting/SOS.Hosting.csproj b/src/SOS/SOS.Hosting/SOS.Hosting.csproj index 5eab9ca5bc..1050596453 100644 --- a/src/SOS/SOS.Hosting/SOS.Hosting.csproj +++ b/src/SOS/SOS.Hosting/SOS.Hosting.csproj @@ -11,7 +11,6 @@ - diff --git a/src/SOS/SOS.Hosting/SOSHost.cs b/src/SOS/SOS.Hosting/SOSHost.cs index bc46c91bb1..18cc0ae387 100644 --- a/src/SOS/SOS.Hosting/SOSHost.cs +++ b/src/SOS/SOS.Hosting/SOSHost.cs @@ -3,9 +3,9 @@ // See the LICENSE file in the project root for more information. using Microsoft.Diagnostics.DebugServices; -using Microsoft.Diagnostics.Runtime; -using Microsoft.Diagnostics.Runtime.Interop; using Microsoft.Diagnostics.Runtime.Utilities; +using SOS.Hosting.DbgEng; +using SOS.Hosting.DbgEng.Interop; using System; using System.Diagnostics; using System.IO; @@ -480,8 +480,8 @@ internal unsafe int GetModuleVersionInformation( { return HResult.E_INVALIDARG; } - VersionData versionData = module.GetVersionData(); - if (versionData is null) + Version version = module.GetVersionData(); + if (version is null) { return HResult.E_FAIL; } @@ -490,8 +490,8 @@ internal unsafe int GetModuleVersionInformation( fileInfo->dwStrucVersion = 0; fileInfo->dwFileFlagsMask = 0; fileInfo->dwFileFlags = 0; - fileInfo->dwFileVersionMS = (uint)versionData.Minor | (uint)versionData.Major << 16; - fileInfo->dwFileVersionLS = (uint)versionData.Patch | (uint)versionData.Revision << 16; + fileInfo->dwFileVersionMS = (uint)version.Minor & 0xffff | (uint)version.Major << 16; + fileInfo->dwFileVersionLS = (uint)version.Revision & 0xffff | (uint)version.Build << 16; } else if (item == "\\StringFileInfo\\040904B0\\FileVersion") { diff --git a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/ConfigFiles/Windows/Debugger.Tests.Config.txt b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/ConfigFiles/Windows/Debugger.Tests.Config.txt index c987fb16d8..f25d61ffed 100644 --- a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/ConfigFiles/Windows/Debugger.Tests.Config.txt +++ b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/ConfigFiles/Windows/Debugger.Tests.Config.txt @@ -19,11 +19,13 @@ + +