Initial commit of source, from internal source 65990d74cf1d9ba6fc

This commit is contained in:
Dan Thompson (SBS) 2017-10-10 09:20:36 -07:00
Родитель 0d916eaa10
Коммит fe113f774b
598 изменённых файлов: 231197 добавлений и 127 удалений

22
.gitattributes поставляемый Normal file
Просмотреть файл

@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

176
.gitignore поставляемый
Просмотреть файл

@ -1,3 +1,37 @@
bin/
tmp/
Bugs/
*.tmp
*.bak*
*.swp
*.swo
*.swn
*.swm
*.swl
tmp*
# These files are now generated:
DbgProvider/Debugger.Format.ps1xml
DbgProvider/Debugger.Format.Color.ps1xml
# "nani" index file
*.ndx
*.cs.works*
*.cs.worked*
dead/
*_stack.txt
out.xml
*.instrumented
dumps/
stack*.txt
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
@ -37,11 +71,6 @@ bld/
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# .NET Core
project.lock.json
project.fragment.lock.json
@ -76,6 +105,10 @@ artifacts/
# Chutzpah Test files
_Chutzpah*
# NuGet packages. We don't check them in; you need to enable "package restore" to get them.
packages/*
!packages/repositories.config
# Visual C++ cache files
ipch/
*.aps
@ -145,66 +178,14 @@ DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
sql
TestResults
*.Cache
ClientBin/
stylecop.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
@ -216,73 +197,14 @@ Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
############
## Windows
############
# Microsoft Fakes
FakesAssemblies/
# Windows image file caches
Thumbs.db
# GhostDoc plugin setting file
*.GhostDoc.xml
# Folder config file
Desktop.ini
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Typescript v1 declaration files
typings/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs

24
.nuget/NuGet.Config Normal file
Просмотреть файл

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<!-- We don't want to check binaries in. -->
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageRestore>
<!-- Allow NuGet to download missing packages -->
<add key="enabled" value="True" />
<!-- Automatically check for missing packages during build in Visual Studio -->
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="NuGet official package source" value="https://nuget.org/api/v2/" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>

Просмотреть файл

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using Address = System.UInt64;
namespace Microsoft.Diagnostics.Runtime
{
/// <summary>
/// Represents an AppDomain in the target runtime.
/// </summary>
public abstract class ClrAppDomain
{
/// <summary>
/// Gets the runtime associated with this ClrAppDomain.
/// </summary>
public abstract ClrRuntime Runtime { get; }
/// <summary>
/// Address of the AppDomain.
/// </summary>
public abstract Address Address { get; }
/// <summary>
/// The AppDomain's ID.
/// </summary>
public abstract int Id { get; }
/// <summary>
/// The name of the AppDomain, as specified when the domain was created.
/// </summary>
public abstract string Name { get; }
/// <summary>
/// Returns a list of modules loaded into this AppDomain.
/// </summary>
public abstract IList<ClrModule> Modules { get; }
/// <summary>
/// Returns the config file used for the AppDomain. This may be null if there was no config file
/// loaded, or if the targeted runtime does not support enumerating that data.
/// </summary>
public abstract string ConfigurationFile { get; }
/// <summary>
/// Returns the base directory for this AppDomain. This may return null if the targeted runtime does
/// not support enumerating this information.
/// </summary>
public abstract string ApplicationBase { get; }
/// <summary>
/// To string override.
/// </summary>
/// <returns>The name of this AppDomain.</returns>
public override string ToString()
{
return Name;
}
}
}

Просмотреть файл

@ -0,0 +1,88 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace Microsoft.Diagnostics.Runtime
{
/// <summary>
/// Exception thrown by Microsoft.Diagnostics.Runtime unless there is a more appropriate
/// exception subclass.
/// </summary>
public class ClrDiagnosticsException : Exception
{
/// <summary>
/// Specific HRESULTS for errors.
/// </summary>
public enum HR
{
/// <summary>
/// Unknown error occured.
/// </summary>
UnknownError = unchecked((int)(((ulong)(0x3) << 31) | ((ulong)(0x125) << 16) | ((ulong)(0x0)))),
/// <summary>
/// The dll of the specified runtime (mscorwks.dll or clr.dll) is loaded into the process, but
/// has not actually been initialized and thus cannot be debugged.
/// </summary>
RuntimeUninitialized = UnknownError + 1,
/// <summary>
/// Something unexpected went wrong with the debugger we used to attach to the process or load
/// the crash dump.
/// </summary>
DebuggerError,
/// <summary>
/// Something unexpected went wrong when requesting data from the target process.
/// </summary>
DataRequestError,
/// <summary>
/// Hit an unexpected (non-recoverable) dac error.
/// </summary>
DacError,
/// <summary>
/// The caller attempted to re-use an object after calling ClrRuntime.Flush. See the
/// documentation for ClrRuntime.Flush for more details.
/// </summary>
RevisionError,
/// <summary>
/// An error occurred while processing the given crash dump.
/// </summary>
CrashDumpError,
/// <summary>
/// There is an issue with the configuration of this application.
/// </summary>
ApplicationError,
}
/// <summary>
/// The HRESULT of this exception.
/// </summary>
public new int HResult { get { return base.HResult; } }
#region Functions
internal ClrDiagnosticsException(string message)
: base(message)
{
base.HResult = (int)HR.UnknownError;
}
internal ClrDiagnosticsException(string message, HR hr)
: base(message)
{
base.HResult = (int)hr;
}
#endregion
internal static void ThrowRevisionError(int revision, int runtimeRevision)
{
throw new ClrDiagnosticsException(string.Format("You must not reuse any object other than ClrRuntime after calling flush!\nClrModule revision ({0}) != ClrRuntime revision ({1}).", revision, runtimeRevision), ClrDiagnosticsException.HR.RevisionError);
}
}
}

1100
ClrMemDiag/ClrHeap.cs Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

138
ClrMemDiag/ClrModule.cs Normal file
Просмотреть файл

@ -0,0 +1,138 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Address = System.UInt64;
namespace Microsoft.Diagnostics.Runtime
{
/// <summary>
/// Represents a managed module in the target process.
/// </summary>
public abstract class ClrModule
{
/// <summary>
/// Gets the runtime which contains this module.
/// </summary>
public abstract ClrRuntime Runtime { get; }
/// <summary>
/// Returns a list of all AppDomains this module is loaded into. Please note that unlike
/// ClrRuntime.AppDomains, this list may include the shared AppDomain.
/// </summary>
public abstract IList<ClrAppDomain> AppDomains { get; }
/// <summary>
/// Returns the name of the assembly that this module is defined in.
/// </summary>
public abstract string AssemblyName { get; }
/// <summary>
/// Returns an identifier to uniquely represent this assembly. This value is not used by any other
/// function in ClrMD, but can be used to group modules by their assembly. (Do not use AssemblyName
/// for this, as reflection and other special assemblies can share the same name, but actually be
/// different.)
/// </summary>
public abstract ulong AssemblyId { get; }
/// <summary>
/// Returns the name of the module.
/// </summary>
public abstract string Name { get; }
/// <summary>
/// Returns true if this module was created through Reflection.Emit (and thus has no associated
/// file).
/// </summary>
public abstract bool IsDynamic { get; }
/// <summary>
/// Returns true if this module is an actual PEFile on disk.
/// </summary>
public abstract bool IsFile { get; }
/// <summary>
/// Returns the filename of where the module was loaded from on disk. Undefined results if
/// IsPEFile returns false.
/// </summary>
public abstract string FileName { get; }
/// <summary>
/// Returns the base of the image loaded into memory. This may be 0 if there is not a physical
/// file backing it.
/// </summary>
public abstract Address ImageBase { get; }
/// <summary>
/// Returns the size of the image in memory.
/// </summary>
public abstract ulong Size { get; }
/// <summary>
/// Enumerate all types defined by this module.
/// </summary>
public abstract IEnumerable<ClrType> EnumerateTypes();
/// <summary>
/// The location of metadata for this module in the process's memory. This is useful if you
/// need to manually create IMetaData* objects.
/// </summary>
public abstract ulong MetadataAddress { get; }
/// <summary>
/// The length of the metadata for this module.
/// </summary>
public abstract ulong MetadataLength { get; }
/// <summary>
/// The IMetaDataImport interface for this module. Note that this API does not provide a
/// wrapper for IMetaDataImport. You will need to wrap the API yourself if you need to use this.
/// </summary>
public abstract ICorDebug.IMetadataImport MetadataImport { get; }
/// <summary>
/// The debugging attributes for this module.
/// </summary>
public abstract DebuggableAttribute.DebuggingModes DebuggingMode { get; }
/// <summary>
/// Attempts to obtain a ClrType based on the name of the type. Note this is a "best effort" due to
/// the way that the dac handles types. This function will fail for Generics, and types which have
/// never been constructed in the target process. Please be sure to null-check the return value of
/// this function.
/// </summary>
/// <param name="name">The name of the type. (This would be the EXACT value returned by ClrType.Name.</param>
/// <returns>The requested ClrType, or null if the type doesn't exist or couldn't be constructed.</returns>
public abstract ClrType GetTypeByName(string name);
/// <summary>
/// Returns a name for the assembly.
/// </summary>
/// <returns>A name for the assembly.</returns>
public override string ToString()
{
if (string.IsNullOrEmpty(Name))
{
if (!string.IsNullOrEmpty(AssemblyName))
return AssemblyName;
if (IsDynamic)
return "dynamic";
}
return Name;
}
/// <summary>
/// Returns the pdb information for this module.
/// </summary>
public abstract PdbInfo Pdb { get; }
/// <summary>
/// Returns a given type by its metadata token.
/// </summary>
/// <param name="token">The metadata token to resolve.</param>
/// <returns>A ClrType for the given metadata token.</returns>
public abstract ClrType GetTypeByToken(uint token);
}
}

884
ClrMemDiag/ClrObject.cs Normal file
Просмотреть файл

@ -0,0 +1,884 @@
using System;
using System.Diagnostics;
namespace Microsoft.Diagnostics.Runtime
{
/// <summary>
/// Represents an object in the target process.
/// </summary>
public struct ClrObject
{
private ulong _address;
private ClrType _type;
internal static ClrObject Create(ulong address, ClrType type)
{
ClrObject obj = new ClrObject();
obj._address = address;
obj._type = type;
return obj;
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="address">The address of the object</param>
/// <param name="type">The concrete type of the object.</param>
public ClrObject(ulong address, ClrType type)
{
_address = address;
_type = type;
Debug.Assert(type != null);
Debug.Assert(address == 0 || type.Heap.GetObjectType(address) == type);
}
/// <summary>
/// The address of the object.
/// </summary>
public ulong Address { get { return _address; } }
/// <summary>
/// The type of the object.
/// </summary>
public ClrType Type { get { return _type; } }
/// <summary>
/// Returns if the object value is null.
/// </summary>
public bool IsNull { get { return _address == 0; } }
/// <summary>
/// Returns whether this ClrObject points to a valid object or not. An object may be "invalid"
/// during heap corruption, or if we simply encountered an error and could not determine its type.
/// </summary>
public bool IsValid { get { return _type != _type.Heap.ErrorType; } }
/// <summary>
/// Gets the size of the object.
/// </summary>
public ulong Size { get { return _type.GetSize(Address); } }
#region GetField
/// <summary>
/// Gets the given object reference field from this ClrObject. Throws ArgumentException if the given field does
/// not exist in the object. Throws NullReferenceException if IsNull is true.
/// </summary>
/// <param name="fieldName">The name of the field to retrieve.</param>
/// <returns>A ClrObject of the given field.</returns>
public ClrObject GetObject(string fieldName)
{
if (IsNull)
throw new NullReferenceException();
ClrInstanceField field = _type.GetFieldByName(fieldName);
if (field == null)
throw new ArgumentException($"Type '{_type.Name}' does not contain a field named '{fieldName}'");
if (!field.IsObjectReference)
throw new ArgumentException($"Field '{_type.Name}.{fieldName}' is not an object reference.");
ClrHeap heap = _type.Heap;
ulong addr = field.GetAddress(_address);
ulong obj;
if (!heap.ReadPointer(addr, out obj))
throw new MemoryReadException(addr);
ClrType type = heap.GetObjectType(obj);
return new ClrObject(obj, type);
}
/// <summary>
/// Gets the given field in this object.
/// </summary>
/// <param name="fieldName">The name of the field.</param>
/// <returns>The value of the field.</returns>
public ClrValue GetField(string fieldName)
{
if (IsNull)
throw new NullReferenceException();
ClrInstanceField field = _type.GetFieldByName(fieldName);
if (field == null)
throw new ArgumentException($"Type '{_type.Name}' does not contain a field named '{fieldName}'");
ulong addr = Address;
ulong fieldAddr = field.GetAddress(addr);
if (fieldAddr == 0)
throw new MemoryReadException(addr);
return new ClrValueImpl(_type.Heap.Runtime, fieldAddr, field);
}
/// <summary>
/// Gets a boolean field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public bool GetBoolean(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.Boolean, "bool");
bool result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadBoolean(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a byte field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public byte GetByte(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.UInt8, "byte");
byte result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadByte(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a signed byte field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public sbyte GetSByte(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.Int8, "sbyte");
sbyte result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadByte(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a character field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public char GetChar(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.Char, "char");
char result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadChar(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a short field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public short GetInt16(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.Int16, "short");
short result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadShort(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets an unsigned short field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public ushort GetUInt16(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.UInt16, "ushort");
ushort result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadShort(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a int field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public int GetInt32(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.Int32, "int");
int result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadDword(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a uint field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public uint GetUInt32(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.UInt32, "uint");
uint result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadDword(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a long field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public long GetInt64(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.Int64, "long");
long result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadQword(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a ulong field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public ulong GetUInt64(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.UInt64, "ulong");
ulong result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadQword(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a float field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public float GetFloat(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.Float, "float");
float result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadFloat(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a double field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public double GetDouble(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.Double, "double");
double result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadFloat(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a string field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public string GetString(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.String, "string");
ulong str;
RuntimeBase runtime = (RuntimeBase)_type.Heap.Runtime;
if (!runtime.ReadPointer(address, out str))
throw new MemoryReadException(address);
string result;
if (!runtime.ReadString(str, out result))
throw new MemoryReadException(str);
return result;
}
/// <summary>
/// Gets a pointer field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public IntPtr GetIntPtr(string fieldName)
{
ClrInstanceField field = _type.GetFieldByName(fieldName);
if (field == null)
throw new ArgumentException($"Type '{_type.Name}' does not contain a field named '{fieldName}'");
if (field.ElementType != ClrElementType.NativeInt && field.ElementType != ClrElementType.Pointer && field.ElementType != ClrElementType.FunctionPointer)
throw new InvalidOperationException($"Field '{_type.Name}.{fieldName}' is not a pointer.");
if (IsNull)
throw new NullReferenceException();
ulong address = field.GetAddress(Address);
ulong value;
if (!((RuntimeBase)_type.Heap.Runtime).ReadPointer(address, out value))
throw new MemoryReadException(address);
return new IntPtr((long)value);
}
/// <summary>
/// Gets an unsigned pointer field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw a NullReferenceException if the target object is null (that is,
/// if (IsNull returns true). It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field.</returns>
public UIntPtr GetUIntPtr(string fieldName)
{
ClrInstanceField field = _type.GetFieldByName(fieldName);
if (field == null)
throw new ArgumentException($"Type '{_type.Name}' does not contain a field named '{fieldName}'");
if (field.ElementType != ClrElementType.NativeUInt && field.ElementType != ClrElementType.Pointer && field.ElementType != ClrElementType.FunctionPointer)
throw new InvalidOperationException($"Field '{_type.Name}.{fieldName}' is not a pointer.");
if (IsNull)
throw new NullReferenceException();
ulong address = field.GetAddress(Address);
ulong value;
if (!((RuntimeBase)_type.Heap.Runtime).ReadPointer(address, out value))
throw new MemoryReadException(address);
return new UIntPtr((ulong)value);
}
private ulong GetFieldAddress(string fieldName, ClrElementType element, string typeName)
{
if (IsNull)
throw new NullReferenceException();
ClrInstanceField field = _type.GetFieldByName(fieldName);
if (field == null)
throw new ArgumentException($"Type '{_type.Name}' does not contain a field named '{fieldName}'");
if (field.ElementType != element)
throw new InvalidOperationException($"Field '{_type.Name}.{fieldName}' is not of type '{typeName}'.");
ulong address = field.GetAddress(Address);
return address;
}
#endregion
#region FieldOrNull
/// <summary>
/// Gets an object reference field from ClrObject. Any field which is a subclass of System.Object
/// </summary>
/// <param name="fieldName">The name of the field to retrieve.</param>
/// <returns></returns>
public ClrObject GetObjectOrNull(string fieldName)
{
if (IsNull)
return new ClrObject(0, Type.Heap.NullType);
ClrInstanceField field = _type.GetFieldByName(fieldName);
if (field == null)
throw new ArgumentException($"Type '{_type.Name}' does not contain a field named '{fieldName}'");
if (!field.IsObjectReference)
throw new ArgumentException($"Field '{_type.Name}.{fieldName}' is not an object reference.");
ClrHeap heap = _type.Heap;
ulong addr = field.GetAddress(_address);
ulong obj;
if (!heap.ReadPointer(addr, out obj))
throw new MemoryReadException(addr);
ClrType type = heap.GetObjectType(obj);
return new ClrObject(obj, type);
}
/// <summary>
/// Gets the given field in this object
/// </summary>
/// <param name="fieldName">The name of the field.</param>
/// <returns>The value of the field.</returns>
public ClrValue GetFieldOrNull(string fieldName)
{
if (IsNull)
return new ClrValueImpl(Type.Heap);
ClrInstanceField field = _type.GetFieldByName(fieldName);
if (field == null)
throw new ArgumentException($"Type '{_type.Name}' does not contain a field named '{fieldName}'");
ulong addr = Address;
ulong fieldAddr = field.GetAddress(addr);
if (fieldAddr == 0)
throw new MemoryReadException(addr);
return new ClrValueImpl(_type.Heap.Runtime, fieldAddr, field);
}
/// <summary>
/// Gets a boolean field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public bool? GetBooleanOrNull(string fieldName)
{
ulong address = GetFieldAddress(fieldName, ClrElementType.Boolean, "bool");
bool result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadBoolean(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a byte field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public byte? GetByteOrNull(string fieldName)
{
if (IsNull)
return null;
ulong address = GetFieldAddress(fieldName, ClrElementType.UInt8, "byte");
byte result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadByte(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a signed byte field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public sbyte? GetSByteOrNull(string fieldName)
{
if (IsNull)
return null;
ulong address = GetFieldAddress(fieldName, ClrElementType.Int8, "sbyte");
sbyte result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadByte(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a character field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public char? GetCharOrNull(string fieldName)
{
if (IsNull)
return null;
ulong address = GetFieldAddress(fieldName, ClrElementType.Char, "char");
char result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadChar(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a short field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public short? GetInt16OrNull(string fieldName)
{
if (IsNull)
return null;
ulong address = GetFieldAddress(fieldName, ClrElementType.Int16, "short");
short result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadShort(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets an unsigned short field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public ushort? GetUInt16OrNull(string fieldName)
{
if (IsNull)
return null;
ulong address = GetFieldAddress(fieldName, ClrElementType.UInt16, "ushort");
ushort result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadShort(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a int field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public int? GetInt32OrNull(string fieldName)
{
if (IsNull)
return null;
ulong address = GetFieldAddress(fieldName, ClrElementType.Int32, "int");
int result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadDword(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a uint field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public uint? GetUInt32OrNull(string fieldName)
{
if (IsNull)
return null;
ulong address = GetFieldAddress(fieldName, ClrElementType.UInt32, "uint");
uint result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadDword(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a long field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public long? GetInt64OrNull(string fieldName)
{
if (IsNull)
return null;
ulong address = GetFieldAddress(fieldName, ClrElementType.Int64, "long");
long result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadQword(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a ulong field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public ulong? GetUInt64OrNull(string fieldName)
{
if (IsNull)
return null;
ulong address = GetFieldAddress(fieldName, ClrElementType.UInt64, "ulong");
ulong result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadQword(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a float field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public float? GetFloatOrNull(string fieldName)
{
if (IsNull)
return null;
ulong address = GetFieldAddress(fieldName, ClrElementType.Float, "float");
float result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadFloat(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a double field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public double? GetDoubleOrNull(string fieldName)
{
if (IsNull)
return null;
ulong address = GetFieldAddress(fieldName, ClrElementType.Double, "double");
double result;
if (!((RuntimeBase)_type.Heap.Runtime).ReadFloat(address, out result))
throw new MemoryReadException(address);
return result;
}
/// <summary>
/// Gets a string field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public string GetStringOrNull(string fieldName)
{
if (IsNull)
return null;
ulong address = GetFieldAddress(fieldName, ClrElementType.String, "string");
ulong str;
RuntimeBase runtime = (RuntimeBase)_type.Heap.Runtime;
if (!runtime.ReadPointer(address, out str))
throw new MemoryReadException(address);
string result;
if (!runtime.ReadString(str, out result))
throw new MemoryReadException(str);
return result;
}
/// <summary>
/// Gets a pointer field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public IntPtr GetIntPtrOrZero(string fieldName)
{
if (IsNull)
return IntPtr.Zero;
ClrInstanceField field = _type.GetFieldByName(fieldName);
if (field == null)
throw new ArgumentException($"Type '{_type.Name}' does not contain a field named '{fieldName}'");
if (field.ElementType != ClrElementType.NativeInt && field.ElementType != ClrElementType.Pointer && field.ElementType != ClrElementType.FunctionPointer)
throw new InvalidOperationException($"Field '{_type.Name}.{fieldName}' is not a pointer.");
if (IsNull)
throw new NullReferenceException();
ulong address = field.GetAddress(Address);
ulong value;
if (!((RuntimeBase)_type.Heap.Runtime).ReadPointer(address, out value))
throw new MemoryReadException(address);
return new IntPtr((long)value);
}
/// <summary>
/// Gets an unsigned pointer field from the object. Note that the type must match exactly, as this method
/// will not do type coercion. This method will throw an ArgumentException if no field matches
/// the given name. It will throw an InvalidOperationException if the field is not
/// of the correct type. Lastly, it will throw a MemoryReadException if there was an error reading
/// the value of this field out of the data target.
/// </summary>
/// <param name="fieldName">The name of the field to get the value for.</param>
/// <returns>The value of the given field or null if this object points to a null value.</returns>
public UIntPtr GetUIntPtrOrZero(string fieldName)
{
if (IsNull)
return UIntPtr.Zero;
ClrInstanceField field = _type.GetFieldByName(fieldName);
if (field == null)
throw new ArgumentException($"Type '{_type.Name}' does not contain a field named '{fieldName}'");
if (field.ElementType != ClrElementType.NativeUInt && field.ElementType != ClrElementType.Pointer && field.ElementType != ClrElementType.FunctionPointer)
throw new InvalidOperationException($"Field '{_type.Name}.{fieldName}' is not a pointer.");
if (IsNull)
throw new NullReferenceException();
ulong address = field.GetAddress(Address);
ulong value;
if (!((RuntimeBase)_type.Heap.Runtime).ReadPointer(address, out value))
throw new MemoryReadException(address);
return new UIntPtr((ulong)value);
}
#endregion
}
}

1533
ClrMemDiag/ClrRuntime.cs Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

646
ClrMemDiag/ClrThread.cs Normal file
Просмотреть файл

@ -0,0 +1,646 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading;
using Microsoft.Diagnostics.Runtime.Utilities;
using Address = System.UInt64;
namespace Microsoft.Diagnostics.Runtime
{
/// <summary>
/// The type of frame the ClrStackFrame represents.
/// </summary>
public enum ClrStackFrameType
{
/// <summary>
/// Indicates this stack frame is a standard managed method.
/// </summary>
ManagedMethod,
/// <summary>
/// Indicates this stack frame is a special stack marker that the Clr runtime leaves on the stack.
/// Note that the ClrStackFrame may still have a ClrMethod associated with the marker.
/// </summary>
Runtime
}
/// <summary>
/// A frame in a managed stack trace. Note you can call ToString on an instance of this object to get the
/// function name (or clr!Frame name) similar to SOS's !clrstack output.
/// </summary>
public abstract class ClrStackFrame
{
/// <summary>
/// Returns the runtime associated with this frame.
/// </summary>
public abstract ClrRuntime Runtime { get; }
/// <summary>
/// Returns the arguments for this stack frame.
/// </summary>
public abstract IList<ClrValue> Arguments { get; }
/// <summary>
/// Returns the locals for this stack frame.
/// </summary>
public abstract IList<ClrValue> Locals { get; }
/// <summary>
/// Returns the thread this stack frame came from.
/// </summary>
public abstract ClrThread Thread { get; }
/// <summary>
/// The instruction pointer of this frame.
/// </summary>
public abstract Address InstructionPointer { get; }
/// <summary>
/// The stack pointer of this frame.
/// </summary>
public abstract Address StackPointer { get; }
/// <summary>
/// The type of frame (managed or internal).
/// </summary>
public abstract ClrStackFrameType Kind { get; }
/// <summary>
/// The string to display in a stack trace. Similar to !clrstack output.
/// </summary>
public abstract string DisplayString { get; }
/// <summary>
/// Returns the ClrMethod which corresponds to the current stack frame. This may be null if the
/// current frame is actually a CLR "Internal Frame" representing a marker on the stack, and that
/// stack marker does not have a managed method associated with it.
/// </summary>
public abstract ClrMethod Method { get; }
/// <summary>
/// Returns the module this frame is associated with.
/// </summary>
public virtual ClrModule Module { get { return Method?.Type?.Module; } }
/// <summary>
/// Returns the module name to use for building the stack trace.
/// </summary>
public virtual string ModuleName
{
get
{
if (Method == null || Method.Type == null || Method.Type.Module == null)
return UnknownModuleName;
string result = Method.Type.Module.Name;
try
{
return Path.GetFileNameWithoutExtension(result);
}
catch
{
return result;
}
}
}
/// <summary>
/// The default name used when a module name cannot be calculated.
/// </summary>
public static string UnknownModuleName = "UNKNOWN";
}
/// <summary>
/// Represents a managed thread in the target process. Note this does not wrap purely native threads
/// in the target process (that is, threads which have never run managed code before).
/// </summary>
public abstract class ClrThread
{
/// <summary>
/// Gets the runtime associated with this thread.
/// </summary>
public abstract ClrRuntime Runtime { get; }
/// <summary>
/// The suspension state of the thread according to the runtime.
/// </summary>
public abstract GcMode GcMode { get; }
/// <summary>
/// Returns true if this is the finalizer thread.
/// </summary>
public abstract bool IsFinalizer { get; }
/// <summary>
/// The address of the underlying datastructure which makes up the Thread object. This
/// serves as a unique identifier.
/// </summary>
public abstract Address Address { get; }
/// <summary>
/// Returns true if the thread is alive in the process, false if this thread was recently terminated.
/// </summary>
public abstract bool IsAlive { get; }
/// <summary>
/// The OS thread id for the thread.
/// </summary>
public abstract uint OSThreadId { get; }
/// <summary>
/// The managed thread ID (this is equivalent to System.Threading.Thread.ManagedThreadId
/// in the target process).
/// </summary>
public abstract int ManagedThreadId { get; }
/// <summary>
/// The AppDomain the thread is running in.
/// </summary>
public abstract Address AppDomain { get; }
/// <summary>
/// The number of managed locks (Monitors) the thread has currently entered but not left.
/// This will be highly inconsistent unless the process is stopped.
/// </summary>
public abstract uint LockCount { get; }
/// <summary>
/// The TEB (thread execution block) address in the process.
/// </summary>
public abstract Address Teb { get; }
/// <summary>
/// The base of the stack for this thread, or 0 if the value could not be obtained.
/// </summary>
public abstract Address StackBase { get; }
/// <summary>
/// The limit of the stack for this thread, or 0 if the value could not be obtained.
/// </summary>
public abstract Address StackLimit { get; }
/// <summary>
/// Enumerates the GC references (objects) on the stack. This is equivalent to
/// EnumerateStackObjects(true).
/// </summary>
/// <returns>An enumeration of GC references on the stack as the GC sees them.</returns>
public abstract IEnumerable<ClrRoot> EnumerateStackObjects();
/// <summary>
/// Enumerates the GC references (objects) on the stack.
/// </summary>
/// <param name="includePossiblyDead">Include all objects found on the stack. Passing
/// false attempts to replicate the behavior of the GC, reporting only live objects.</param>
/// <returns>An enumeration of GC references on the stack as the GC sees them.</returns>
public abstract IEnumerable<ClrRoot> EnumerateStackObjects(bool includePossiblyDead);
/// <summary>
/// Returns the managed stack trace of the thread. Note that this property may return incomplete
/// data in the case of a bad stack unwind or if there is a very large number of methods on the stack.
/// (This is usually caused by a stack overflow on the target thread, stack corruption which leads to
/// a bad stack unwind, or other inconsistent state in the target debuggee.)
///
/// Note: This property uses a heuristic to attempt to detect bad unwinds to stop enumerating
/// frames by inspecting the stack pointer and instruction pointer of each frame to ensure the stack
/// walk is "making progress". Additionally we cap the number of frames returned by this method
/// as another safegaurd. This means we may not have all frames even if the stack walk was making
/// progress.
///
/// If you want to ensure that you receive an un-clipped stack trace, you should use EnumerateStackTrace
/// instead of this property, and be sure to handle the case of repeating stack frames.
/// </summary>
public abstract IList<ClrStackFrame> StackTrace { get; }
/// <summary>
/// Enumerates a stack trace for a given thread. Note this method may loop infinitely in the case of
/// stack corruption or other stack unwind issues which can happen in practice. When enumerating frames
/// out of this method you should be careful to either set a maximum loop count, or to ensure the stack
/// unwind is making progress by ensuring that ClrStackFrame.StackPointer is making progress (though it
/// is expected that sometimes two frames may return the same StackPointer in some corner cases).
/// </summary>
/// <returns>An enumeration of stack frames.</returns>
public abstract IEnumerable<ClrStackFrame> EnumerateStackTrace();
/// <summary>
/// Returns the exception currently on the thread. Note that this field may be null. Also note
/// that this is basically the "last thrown exception", and may be stale...meaning the thread could
/// be done processing the exception but a crash dump was taken before the current exception was
/// cleared off the field.
/// </summary>
public abstract ClrException CurrentException { get; }
/// <summary>
/// Returns if this thread is a GC thread. If the runtime is using a server GC, then there will be
/// dedicated GC threads, which this will indicate. For a runtime using the workstation GC, this flag
/// will only be true for a thread which is currently running a GC (and the background GC thread).
/// </summary>
public abstract bool IsGC { get; }
/// <summary>
/// Returns if this thread is the debugger helper thread.
/// </summary>
public abstract bool IsDebuggerHelper { get; }
/// <summary>
/// Returns true if this thread is a threadpool timer thread.
/// </summary>
public abstract bool IsThreadpoolTimer { get; }
/// <summary>
/// Returns true if this thread is a threadpool IO completion port.
/// </summary>
public abstract bool IsThreadpoolCompletionPort { get; }
/// <summary>
/// Returns true if this is a threadpool worker thread.
/// </summary>
public abstract bool IsThreadpoolWorker { get; }
/// <summary>
/// Returns true if this is a threadpool wait thread.
/// </summary>
public abstract bool IsThreadpoolWait { get; }
/// <summary>
/// Returns true if this is the threadpool gate thread.
/// </summary>
public abstract bool IsThreadpoolGate { get; }
/// <summary>
/// Returns if this thread currently suspending the runtime.
/// </summary>
public abstract bool IsSuspendingEE { get; }
/// <summary>
/// Returns true if this thread is currently the thread shutting down the runtime.
/// </summary>
public abstract bool IsShutdownHelper { get; }
/// <summary>
/// Returns true if an abort was requested for this thread (such as Thread.Abort, or AppDomain unload).
/// </summary>
public abstract bool IsAbortRequested { get; }
/// <summary>
/// Returns true if this thread was aborted.
/// </summary>
public abstract bool IsAborted { get; }
/// <summary>
/// Returns true if the GC is attempting to suspend this thread.
/// </summary>
public abstract bool IsGCSuspendPending { get; }
/// <summary>
/// Returns true if the user has suspended the thread (using Thread.Suspend).
/// </summary>
public abstract bool IsUserSuspended { get; }
/// <summary>
/// Returns true if the debugger has suspended the thread.
/// </summary>
public abstract bool IsDebugSuspended { get; }
/// <summary>
/// Returns true if this thread is a background thread. (That is, if the thread does not keep the
/// managed execution environment alive and running.)
/// </summary>
public abstract bool IsBackground { get; }
/// <summary>
/// Returns true if this thread was created, but not started.
/// </summary>
public abstract bool IsUnstarted { get; }
/// <summary>
/// Returns true if the Clr runtime called CoIntialize for this thread.
/// </summary>
public abstract bool IsCoInitialized { get; }
/// <summary>
/// Returns true if this thread is in a COM single threaded apartment.
/// </summary>
public abstract bool IsSTA { get; }
/// <summary>
/// Returns true if the thread is a COM multithreaded apartment.
/// </summary>
public abstract bool IsMTA { get; }
/// <summary>
/// Returns the object this thread is blocked waiting on, or null if the thread is not blocked.
/// </summary>
public abstract IList<BlockingObject> BlockingObjects { get; }
}
internal abstract class ThreadBase : ClrThread
{
public override Address Address
{
get { return _address; }
}
public override bool IsFinalizer
{
get { return _finalizer; }
}
public override bool IsGC
{
get { return (ThreadType & (int)TlsThreadType.ThreadType_GC) == (int)TlsThreadType.ThreadType_GC; }
}
public override bool IsDebuggerHelper
{
get { return (ThreadType & (int)TlsThreadType.ThreadType_DbgHelper) == (int)TlsThreadType.ThreadType_DbgHelper; }
}
public override bool IsThreadpoolTimer
{
get { return (ThreadType & (int)TlsThreadType.ThreadType_Timer) == (int)TlsThreadType.ThreadType_Timer; }
}
public override bool IsThreadpoolCompletionPort
{
get
{
return (ThreadType & (int)TlsThreadType.ThreadType_Threadpool_IOCompletion) == (int)TlsThreadType.ThreadType_Threadpool_IOCompletion
|| (_threadState & (int)ThreadState.TS_CompletionPortThread) == (int)ThreadState.TS_CompletionPortThread;
}
}
public override bool IsThreadpoolWorker
{
get
{
return (ThreadType & (int)TlsThreadType.ThreadType_Threadpool_Worker) == (int)TlsThreadType.ThreadType_Threadpool_Worker
|| (_threadState & (int)ThreadState.TS_TPWorkerThread) == (int)ThreadState.TS_TPWorkerThread;
}
}
public override bool IsThreadpoolWait
{
get { return (ThreadType & (int)TlsThreadType.ThreadType_Wait) == (int)TlsThreadType.ThreadType_Wait; }
}
public override bool IsThreadpoolGate
{
get { return (ThreadType & (int)TlsThreadType.ThreadType_Gate) == (int)TlsThreadType.ThreadType_Gate; }
}
public override bool IsSuspendingEE
{
get { return (ThreadType & (int)TlsThreadType.ThreadType_DynamicSuspendEE) == (int)TlsThreadType.ThreadType_DynamicSuspendEE; }
}
public override bool IsShutdownHelper
{
get { return (ThreadType & (int)TlsThreadType.ThreadType_ShutdownHelper) == (int)TlsThreadType.ThreadType_ShutdownHelper; }
}
public override bool IsAborted
{
get { return (_threadState & (int)ThreadState.TS_Aborted) == (int)ThreadState.TS_Aborted; }
}
public override bool IsGCSuspendPending
{
get { return (_threadState & (int)ThreadState.TS_GCSuspendPending) == (int)ThreadState.TS_GCSuspendPending; }
}
public override bool IsUserSuspended
{
get { return (_threadState & (int)ThreadState.TS_UserSuspendPending) == (int)ThreadState.TS_UserSuspendPending; }
}
public override bool IsDebugSuspended
{
get { return (_threadState & (int)ThreadState.TS_DebugSuspendPending) == (int)ThreadState.TS_DebugSuspendPending; }
}
public override bool IsBackground
{
get { return (_threadState & (int)ThreadState.TS_Background) == (int)ThreadState.TS_Background; }
}
public override bool IsUnstarted
{
get { return (_threadState & (int)ThreadState.TS_Unstarted) == (int)ThreadState.TS_Unstarted; }
}
public override bool IsCoInitialized
{
get { return (_threadState & (int)ThreadState.TS_CoInitialized) == (int)ThreadState.TS_CoInitialized; }
}
public override GcMode GcMode
{
get { return _preemptive ? GcMode.Preemptive : GcMode.Cooperative; }
}
public override bool IsSTA
{
get { return (_threadState & (int)ThreadState.TS_InSTA) == (int)ThreadState.TS_InSTA; }
}
public override bool IsMTA
{
get { return (_threadState & (int)ThreadState.TS_InMTA) == (int)ThreadState.TS_InMTA; }
}
public override bool IsAbortRequested
{
get
{
return (_threadState & (int)ThreadState.TS_AbortRequested) == (int)ThreadState.TS_AbortRequested
|| (_threadState & (int)ThreadState.TS_AbortInitiated) == (int)ThreadState.TS_AbortInitiated;
}
}
public override bool IsAlive { get { return _osThreadId != 0 && (_threadState & ((int)ThreadState.TS_Unstarted | (int)ThreadState.TS_Dead)) == 0; } }
public override uint OSThreadId { get { return _osThreadId; } }
public override int ManagedThreadId { get { return (int)_managedThreadId; } }
public override ulong AppDomain { get { return _appDomain; } }
public override uint LockCount { get { return _lockCount; } }
public override ulong Teb { get { return _teb; } }
internal void SetBlockingObjects(BlockingObject[] blobjs)
{
_blockingObjs = blobjs;
}
#region Helper Enums
internal enum TlsThreadType
{
ThreadType_GC = 0x00000001,
ThreadType_Timer = 0x00000002,
ThreadType_Gate = 0x00000004,
ThreadType_DbgHelper = 0x00000008,
//ThreadType_Shutdown = 0x00000010,
ThreadType_DynamicSuspendEE = 0x00000020,
//ThreadType_Finalizer = 0x00000040,
//ThreadType_ADUnloadHelper = 0x00000200,
ThreadType_ShutdownHelper = 0x00000400,
ThreadType_Threadpool_IOCompletion = 0x00000800,
ThreadType_Threadpool_Worker = 0x00001000,
ThreadType_Wait = 0x00002000,
}
private enum ThreadState
{
//TS_Unknown = 0x00000000, // threads are initialized this way
TS_AbortRequested = 0x00000001, // Abort the thread
TS_GCSuspendPending = 0x00000002, // waiting to get to safe spot for GC
TS_UserSuspendPending = 0x00000004, // user suspension at next opportunity
TS_DebugSuspendPending = 0x00000008, // Is the debugger suspending threads?
//TS_GCOnTransitions = 0x00000010, // Force a GC on stub transitions (GCStress only)
//TS_LegalToJoin = 0x00000020, // Is it now legal to attempt a Join()
//TS_YieldRequested = 0x00000040, // The task should yield
//TS_Hijacked = 0x00000080, // Return address has been hijacked
//TS_BlockGCForSO = 0x00000100, // If a thread does not have enough stack, WaitUntilGCComplete may fail.
// Either GC suspension will wait until the thread has cleared this bit,
// Or the current thread is going to spin if GC has suspended all threads.
TS_Background = 0x00000200, // Thread is a background thread
TS_Unstarted = 0x00000400, // Thread has never been started
TS_Dead = 0x00000800, // Thread is dead
//TS_WeOwn = 0x00001000, // Exposed object initiated this thread
TS_CoInitialized = 0x00002000, // CoInitialize has been called for this thread
TS_InSTA = 0x00004000, // Thread hosts an STA
TS_InMTA = 0x00008000, // Thread is part of the MTA
// Some bits that only have meaning for reporting the state to clients.
//TS_ReportDead = 0x00010000, // in WaitForOtherThreads()
//TS_TaskReset = 0x00040000, // The task is reset
//TS_SyncSuspended = 0x00080000, // Suspended via WaitSuspendEvent
//TS_DebugWillSync = 0x00100000, // Debugger will wait for this thread to sync
//TS_StackCrawlNeeded = 0x00200000, // A stackcrawl is needed on this thread, such as for thread abort
// See comment for s_pWaitForStackCrawlEvent for reason.
//TS_SuspendUnstarted = 0x00400000, // latch a user suspension on an unstarted thread
TS_Aborted = 0x00800000, // is the thread aborted?
TS_TPWorkerThread = 0x01000000, // is this a threadpool worker thread?
//TS_Interruptible = 0x02000000, // sitting in a Sleep(), Wait(), Join()
//TS_Interrupted = 0x04000000, // was awakened by an interrupt APC. !!! This can be moved to TSNC
TS_CompletionPortThread = 0x08000000, // Completion port thread
TS_AbortInitiated = 0x10000000, // set when abort is begun
//TS_Finalized = 0x20000000, // The associated managed Thread object has been finalized.
// We can clean up the unmanaged part now.
//TS_FailStarted = 0x40000000, // The thread fails during startup.
//TS_Detached = 0x80000000, // Thread was detached by DllMain
}
#endregion
#region Internal Methods
private void InitTls()
{
if (_tlsInit)
return;
_tlsInit = true;
_threadType = GetTlsSlotForThread((RuntimeBase)Runtime, Teb);
}
internal static int GetTlsSlotForThread(RuntimeBase runtime, ulong teb)
{
const int maxTlsSlot = 64;
const int tlsSlotOffset = 0x1480; // Same on x86 and amd64
const int tlsExpansionSlotsOffset = 0x1780;
uint ptrSize = (uint)runtime.PointerSize;
ulong lowerTlsSlots = teb + tlsSlotOffset;
uint clrTlsSlot = runtime.GetTlsSlot();
if (clrTlsSlot == uint.MaxValue)
return 0;
ulong tlsSlot = 0;
if (clrTlsSlot < maxTlsSlot)
{
tlsSlot = lowerTlsSlots + ptrSize * clrTlsSlot;
}
else
{
if (!runtime.ReadPointer(teb + tlsExpansionSlotsOffset, out tlsSlot) || tlsSlot == 0)
return 0;
tlsSlot += ptrSize * (clrTlsSlot - maxTlsSlot);
}
ulong clrTls = 0;
if (!runtime.ReadPointer(tlsSlot, out clrTls))
return 0;
// Get thread data;
uint tlsThreadTypeIndex = runtime.GetThreadTypeIndex();
if (tlsThreadTypeIndex == uint.MaxValue)
return 0;
ulong threadType = 0;
if (!runtime.ReadPointer(clrTls + ptrSize * tlsThreadTypeIndex, out threadType))
return 0;
return (int)threadType;
}
internal ThreadBase(Desktop.IThreadData thread, ulong address, bool finalizer)
{
_address = address;
_finalizer = finalizer;
Debug.Assert(thread != null);
if (thread != null)
{
_osThreadId = thread.OSThreadID;
_managedThreadId = thread.ManagedThreadID;
_appDomain = thread.AppDomain;
_lockCount = thread.LockCount;
_teb = thread.Teb;
_threadState = thread.State;
_exception = thread.ExceptionPtr;
_preemptive = thread.Preemptive;
}
}
protected uint _osThreadId;
protected IList<ClrStackFrame> _stackTrace;
protected bool _finalizer;
protected bool _tlsInit;
protected int _threadType;
protected int _threadState;
protected uint _managedThreadId;
protected uint _lockCount;
protected ulong _address;
protected ulong _appDomain;
protected ulong _teb;
protected ulong _exception;
protected BlockingObject[] _blockingObjs;
protected bool _preemptive;
protected int ThreadType { get { InitTls(); return _threadType; } }
#endregion
}
}

1164
ClrMemDiag/ClrType.cs Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

1077
ClrMemDiag/ClrValue.cs Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

349
ClrMemDiag/DacInterfaces.cs Normal file
Просмотреть файл

@ -0,0 +1,349 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Diagnostics.Runtime.Interop;
using System;
using System.Runtime.InteropServices;
#pragma warning disable 649
namespace Microsoft.Diagnostics.Runtime
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("5c552ab6-fc09-4cb3-8e36-22fa03c798b7")]
internal interface IXCLRDataProcess
{
void Flush();
void StartEnumTasks_do_not_use();
void EnumTask_do_not_use();
void EndEnumTasks_do_not_use();
[PreserveSig]
int GetTaskByOSThreadID(uint id, [Out, MarshalAs(UnmanagedType.IUnknown)] out object task);
void GetTaskByUniqueID_do_not_use(/*[in] ULONG64 taskID, [out] IXCLRDataTask** task*/);
void GetFlags_do_not_use(/*[out] ULONG32* flags*/);
void IsSameObject_do_not_use(/*[in] IXCLRDataProcess* process*/);
void GetManagedObject_do_not_use(/*[out] IXCLRDataValue** value*/);
void GetDesiredExecutionState_do_not_use(/*[out] ULONG32* state*/);
void SetDesiredExecutionState_do_not_use(/*[in] ULONG32 state*/);
void GetAddressType_do_not_use(/*[in] CLRDATA_ADDRESS address, [out] CLRDataAddressType* type*/);
void GetRuntimeNameByAddress_do_not_use(/*[in] CLRDATA_ADDRESS address, [in] ULONG32 flags, [in] ULONG32 bufLen, [out] ULONG32 *nameLen, [out, size_is(bufLen)] WCHAR nameBuf[], [out] CLRDATA_ADDRESS* displacement*/);
void StartEnumAppDomains_do_not_use(/*[out] CLRDATA_ENUM* handle*/);
void EnumAppDomain_do_not_use(/*[in, out] CLRDATA_ENUM* handle, [out] IXCLRDataAppDomain** appDomain*/);
void EndEnumAppDomains_do_not_use(/*[in] CLRDATA_ENUM handle*/);
void GetAppDomainByUniqueID_do_not_use(/*[in] ULONG64 id, [out] IXCLRDataAppDomain** appDomain*/);
void StartEnumAssemblie_do_not_uses(/*[out] CLRDATA_ENUM* handle*/);
void EnumAssembly_do_not_use(/*[in, out] CLRDATA_ENUM* handle, [out] IXCLRDataAssembly **assembly*/);
void EndEnumAssemblies_do_not_use(/*[in] CLRDATA_ENUM handle*/);
void StartEnumModules_do_not_use(/*[out] CLRDATA_ENUM* handle*/);
void EnumModule_do_not_use(/*[in, out] CLRDATA_ENUM* handle, [out] IXCLRDataModule **mod*/);
void EndEnumModules_do_not_use(/*[in] CLRDATA_ENUM handle*/);
void GetModuleByAddress_do_not_use(/*[in] CLRDATA_ADDRESS address, [out] IXCLRDataModule** mod*/);
[PreserveSig]
int StartEnumMethodInstancesByAddress(ulong address, [In, MarshalAs(UnmanagedType.Interface)] object appDomain, out ulong handle);
[PreserveSig]
int EnumMethodInstanceByAddress(ref ulong handle, [Out, MarshalAs(UnmanagedType.Interface)] out object method);
[PreserveSig]
int EndEnumMethodInstancesByAddress(ulong handle);
void GetDataByAddress_do_not_use(/*[in] CLRDATA_ADDRESS address, [in] ULONG32 flags, [in] IXCLRDataAppDomain* appDomain, [in] IXCLRDataTask* tlsTask, [in] ULONG32 bufLen, [out] ULONG32 *nameLen, [out, size_is(bufLen)] WCHAR nameBuf[], [out] IXCLRDataValue** value, [out] CLRDATA_ADDRESS* displacement*/);
void GetExceptionStateByExceptionRecord_do_not_use(/*[in] EXCEPTION_RECORD64* record, [out] IXCLRDataExceptionState **exState*/);
void TranslateExceptionRecordToNotification_do_not_use();
[PreserveSig]
int Request(uint reqCode, uint inBufferSize,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] inBuffer, uint outBufferSize,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] outBuffer);
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("ECD73800-22CA-4b0d-AB55-E9BA7E6318A5")]
internal interface IXCLRDataMethodInstance
{
void GetTypeInstance_do_not_use(/*[out] IXCLRDataTypeInstance **typeInstance*/);
void GetDefinition_do_not_use(/*[out] IXCLRDataMethodDefinition **methodDefinition*/);
/*
* Get the metadata token and scope.
*/
void GetTokenAndScope(out uint mdToken, [Out, MarshalAs(UnmanagedType.Interface)] out object module);
void GetName_do_not_use(/*[in] ULONG32 flags,
[in] ULONG32 bufLen,
[out] ULONG32 *nameLen,
[out, size_is(bufLen)] WCHAR nameBuf[]*/);
void GetFlags_do_not_use(/*[out] ULONG32* flags*/);
void IsSameObject_do_not_use(/*[in] IXCLRDataMethodInstance* method*/);
void GetEnCVersion_do_not_use(/*[out] ULONG32* version*/);
void GetNumTypeArguments_do_not_use(/*[out] ULONG32* numTypeArgs*/);
void GetTypeArgumentByIndex_do_not_use(/*[in] ULONG32 index,
[out] IXCLRDataTypeInstance** typeArg*/);
/*
* Access the IL <-> address mapping information.
*/
void GetILOffsetsByAddress(ulong address, uint offsetsLen, out uint offsetsNeeded, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] uint[] ilOffsets);
void GetAddressRangesByILOffset(uint ilOffset, uint rangesLen, out uint rangesNeeded, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] uint[] addressRanges);
[PreserveSig]
int GetILAddressMap(uint mapLen, out uint mapNeeded, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] ILToNativeMap[] map);
void StartEnumExtents_do_not_use(/*[out] CLRDATA_ENUM* handle*/);
void EnumExtent_do_not_use(/*[in, out] CLRDATA_ENUM* handle,
[out] CLRDATA_ADDRESS_RANGE* extent*/);
void EndEnumExtents_do_not_use(/*[in] CLRDATA_ENUM handle*/);
void Request_do_not_use(/*[in] ULONG32 reqCode,
[in] ULONG32 inBufferSize,
[in, size_is(inBufferSize)] BYTE* inBuffer,
[in] ULONG32 outBufferSize,
[out, size_is(outBufferSize)] BYTE* outBuffer*/);
void GetRepresentativeEntryAddress_do_not_use(/*[out] CLRDATA_ADDRESS* addr*/);
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("A5B0BEEA-EC62-4618-8012-A24FFC23934C")]
internal interface IXCLRDataTask
{
void GetProcess_do_not_use();
void GetCurrentAppDomain_do_not_use();
void GetUniqueID_do_not_use();
void GetFlags_do_not_use();
void IsSameObject_do_not_use();
void GetManagedObject_do_not_use();
void GetDesiredExecutionState_do_not_use();
void SetDesiredExecutionState_do_not_use();
/*
* Create a stack walker to walk this task's stack. The
* flags parameter takes a bitfield of values from the
* CLRDataSimpleFrameType enum.
*/
[PreserveSig]
int CreateStackWalk(uint flags, [Out, MarshalAs(UnmanagedType.IUnknown)] out object stackwalk);
void GetOSThreadID_do_not_use();
void GetContext_do_not_use();
void SetContext_do_not_use();
void GetCurrentExceptionState_do_not_use();
void Request_do_not_use();
void GetName_do_not_use();
void GetLastExceptionState_do_not_use();
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("E59D8D22-ADA7-49a2-89B5-A415AFCFC95F")]
internal interface IXCLRDataStackWalk
{
[PreserveSig]
int GetContext(uint contextFlags, uint contextBufSize, out uint contextSize, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] buffer);
void SetContext_do_not_use();
[PreserveSig]
int Next();
/*
* Return the number of bytes skipped by the last call to Next().
* If Next() moved to the very next frame, outputs 0.
*
* Note that calling GetStackSizeSkipped() after any function other
* than Next() has no meaning.
*/
void GetStackSizeSkipped_do_not_use();
/*
* Return information about the type of the current frame
*/
void GetFrameType_do_not_use();
[PreserveSig]
int GetFrame([Out, MarshalAs(UnmanagedType.IUnknown)] out object frame);
[PreserveSig]
int Request(uint reqCode, uint inBufferSize, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] inBuffer,
uint outBufferSize, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] outBuffer);
void SetContext2_do_not_use();
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("88E32849-0A0A-4cb0-9022-7CD2E9E139E2")]
internal interface IXCLRDataModule
{
/*
* Enumerate assemblies this module is part of.
* Module-to-assembly is an enumeration as a
* shared module might be part of more than one assembly.
*/
void StartEnumAssemblies_do_not_use(/*[out] CLRDATA_ENUM* handle*/);
void EnumAssembly_do_not_use(/*[in, out] CLRDATA_ENUM* handle, [out] IXCLRDataAssembly **assembly*/);
void EndEnumAssemblies_do_not_use(/*[in] CLRDATA_ENUM handle*/);
/*
* Enumerate types in this module.
*/
void StartEnumTypeDefinitions_do_not_use(/*[out] CLRDATA_ENUM* handle*/);
void EnumTypeDefinition_do_not_use(/*[in, out] CLRDATA_ENUM* handle, [out] IXCLRDataTypeDefinition **typeDefinition*/);
void EndEnumTypeDefinitions_do_not_use(/*[in] CLRDATA_ENUM handle*/);
void StartEnumTypeInstances_do_not_use(/*[in] IXCLRDataAppDomain* appDomain, [out] CLRDATA_ENUM* handle*/);
void EnumTypeInstance_do_not_use(/*[in, out] CLRDATA_ENUM* handle, [out] IXCLRDataTypeInstance **typeInstance*/);
void EndEnumTypeInstances_do_not_use(/*[in] CLRDATA_ENUM handle*/);
/*
* Look up types by name.
*/
void StartEnumTypeDefinitionsByName_do_not_use(/*[in] LPCWSTR name, [in] ULONG32 flags, [out] CLRDATA_ENUM* handle*/);
void EnumTypeDefinitionByName_do_not_use(/*[in,out] CLRDATA_ENUM* handle, [out] IXCLRDataTypeDefinition** type*/);
void EndEnumTypeDefinitionsByName_do_not_use(/*[in] CLRDATA_ENUM handle*/);
void StartEnumTypeInstancesByName_do_not_use(/*[in] LPCWSTR name, [in] ULONG32 flags, [in] IXCLRDataAppDomain* appDomain, [out] CLRDATA_ENUM* handle*/);
void EnumTypeInstanceByName_do_not_use(/*[in,out] CLRDATA_ENUM* handle, [out] IXCLRDataTypeInstance** type*/);
void EndEnumTypeInstancesByName_do_not_use(/*[in] CLRDATA_ENUM handle*/);
/*
* Get a type definition by metadata token.
*/
void GetTypeDefinitionByToken_do_not_use(/*[in] mdTypeDef token, [out] IXCLRDataTypeDefinition** typeDefinition*/);
/*
* Look up methods by name.
*/
void StartEnumMethodDefinitionsByName_do_not_use(/*[in] LPCWSTR name, [in] ULONG32 flags, [out] CLRDATA_ENUM* handle*/);
void EnumMethodDefinitionByName_do_not_use(/*[in,out] CLRDATA_ENUM* handle, [out] IXCLRDataMethodDefinition** method*/);
void EndEnumMethodDefinitionsByName_do_not_use(/*[in] CLRDATA_ENUM handle*/);
void StartEnumMethodInstancesByName_do_not_use(/*[in] LPCWSTR name, [in] ULONG32 flags, [in] IXCLRDataAppDomain* appDomain, [out] CLRDATA_ENUM* handle*/);
void EnumMethodInstanceByName_do_not_use(/*[in,out] CLRDATA_ENUM* handle, [out] IXCLRDataMethodInstance** method*/);
void EndEnumMethodInstancesByName_do_not_use(/*[in] CLRDATA_ENUM handle*/);
/*
* Get a method definition by metadata token.
*/
void GetMethodDefinitionByToken_do_not_use(/*[in] mdMethodDef token, [out] IXCLRDataMethodDefinition** methodDefinition*/);
/*
* Look up pieces of data by name.
*/
void StartEnumDataByName_do_not_use(/*[in] LPCWSTR name, [in] ULONG32 flags, [in] IXCLRDataAppDomain* appDomain, [in] IXCLRDataTask* tlsTask, [out] CLRDATA_ENUM* handle*/);
void EnumDataByName_do_not_use(/*[in,out] CLRDATA_ENUM* handle, [out] IXCLRDataValue** value*/);
void EndEnumDataByName_do_not_use(/*[in] CLRDATA_ENUM handle*/);
/*
* Get the module's base name.
*/
void GetName_do_not_use(/*[in] ULONG32 bufLen, [out] ULONG32 *nameLen, [out, size_is(bufLen)] WCHAR name[]*/);
/*
* Get the full path and filename for the module,
* if there is one.
*/
void GetFileName_do_not_use(/*[in] ULONG32 bufLen, [out] ULONG32 *nameLen, [out, size_is(bufLen)] WCHAR name[]*/);
/*
* Get state flags, defined in CLRDataModuleFlag.
*/
void GetFlags_do_not_use(/*[out] ULONG32* flags*/);
/*
* Determine whether the given interface represents
* the same target state.
*/
void IsSameObject_do_not_use(/*[in] IXCLRDataModule* mod*/);
/*
* Get the memory regions associated with this module.
*/
void StartEnumExtents(out ulong handle);
void EnumExtent(ref ulong handle, out CLRDATA_MODULE_EXTENT extent);
void EndEnumExtents(ulong handle);
void Request_do_not_use(/*[in] ULONG32 reqCode, [in] ULONG32 inBufferSize, [in, size_is(inBufferSize)] BYTE* inBuffer, [in] ULONG32 outBufferSize, [out, size_is(outBufferSize)] BYTE* outBuffer*/);
/*
* Enumerate the app domains using this module.
*/
void StartEnumAppDomains_do_not_use(/*[out] CLRDATA_ENUM* handle*/);
void EnumAppDomain_do_not_use(/*[in, out] CLRDATA_ENUM* handle, [out] IXCLRDataAppDomain** appDomain*/);
void EndEnumAppDomains_do_not_use(/*[in] CLRDATA_ENUM handle*/);
/*
* Get the module's version ID.
* Requires revision 3.
*/
void GetVersionId_do_not_use(/*[out] GUID* vid*/);
}
internal enum ModuleExtentType
{
CLRDATA_MODULE_PE_FILE,
CLRDATA_MODULE_PREJIT_FILE,
CLRDATA_MODULE_MEMORY_STREAM,
CLRDATA_MODULE_OTHER
}
internal struct CLRDATA_MODULE_EXTENT
{
public ulong baseAddress;
public uint length;
public ModuleExtentType type;
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("aa8fa804-bc05-4642-b2c5-c353ed22fc63")]
internal interface IMetadataLocator
{
[PreserveSig]
int GetMetadata([In, MarshalAs(UnmanagedType.LPWStr)] string imagePath,
uint imageTimestamp,
uint imageSize,
IntPtr mvid, // (guid, unused)
uint mdRva,
uint flags, // unused
uint bufferSize,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 6)]
byte[] buffer,
IntPtr ptr);
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("3E11CCEE-D08B-43e5-AF01-32717A64DA03")]
internal interface IDacDataTarget
{
void GetMachineType(out IMAGE_FILE_MACHINE machineType);
void GetPointerSize(out uint pointerSize);
void GetImageBase([In, MarshalAs(UnmanagedType.LPWStr)] string imagePath, out ulong baseAddress);
[PreserveSig]
int ReadVirtual(ulong address,
IntPtr buffer,
int bytesRequested,
out int bytesRead);
void WriteVirtual(ulong address,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
uint bytesRequested,
out uint bytesWritten);
void GetTLSValue(uint threadID,
uint index,
out ulong value);
void SetTLSValue(uint threadID,
uint index,
ulong value);
void GetCurrentThreadID(out uint threadID);
void GetThreadContext(uint threadID,
uint contextFlags,
uint contextSize,
IntPtr context);
void SetThreadContext(uint threadID,
uint contextSize,
IntPtr context);
void Request(uint reqCode,
uint inBufferSize,
IntPtr inBuffer,
IntPtr outBufferSize,
out IntPtr outBuffer);
}
}

1542
ClrMemDiag/Debugger/Enums.cs Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,25 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("f2df5f53-071f-47bd-9de6-5734c3fed689")]
public interface IDebugAdvanced
{
[PreserveSig]
int GetThreadContext(
[In] IntPtr Context,
[In] UInt32 ContextSize);
[PreserveSig]
int SetThreadContext(
[In] IntPtr Context,
[In] UInt32 ContextSize);
}
}

Просмотреть файл

@ -0,0 +1,82 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("716d14c9-119b-4ba5-af1f-0890e672416a")]
public interface IDebugAdvanced2 : IDebugAdvanced
{
/* IDebugAdvanced */
[PreserveSig]
new int GetThreadContext(
[In] IntPtr Context,
[In] UInt32 ContextSize);
[PreserveSig]
new int SetThreadContext(
[In] IntPtr Context,
[In] UInt32 ContextSize);
/* IDebugAdvanced2 */
[PreserveSig]
int Request(
[In] DEBUG_REQUEST Request,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] inBuffer,
[In] Int32 InBufferSize,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] outBuffer,
[In] Int32 OutBufferSize,
[Out] out Int32 OutSize);
[PreserveSig]
int GetSourceFileInformation(
[In] DEBUG_SRCFILE Which,
[In, MarshalAs(UnmanagedType.LPStr)] string SourceFile,
[In] UInt64 Arg64,
[In] UInt32 Arg32,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out Int32 InfoSize);
[PreserveSig]
int FindSourceFileAndToken(
[In] UInt32 StartElement,
[In] UInt64 ModAddr,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[In] DEBUG_FIND_SOURCE Flags,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] Int32 FileTokenSize,
[Out] out Int32 FoundElement,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out Int32 FoundSize);
[PreserveSig]
int GetSymbolInformation(
[In] DEBUG_SYMINFO Which,
[In] UInt64 Arg64,
[In] UInt32 Arg32,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out Int32 InfoSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder StringBuffer,
[In] Int32 StringBufferSize,
[Out] out Int32 StringSize);
[PreserveSig]
int GetSystemObjectInformation(
[In] DEBUG_SYSOBJINFO Which,
[In] UInt64 Arg64,
[In] UInt32 Arg32,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out Int32 InfoSize);
}
}

Просмотреть файл

@ -0,0 +1,119 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("cba4abb4-84c4-444d-87ca-a04e13286739")]
public interface IDebugAdvanced3 : IDebugAdvanced2
{
/* IDebugAdvanced */
[PreserveSig]
new int GetThreadContext(
[In] IntPtr Context,
[In] UInt32 ContextSize);
[PreserveSig]
new int SetThreadContext(
[In] IntPtr Context,
[In] UInt32 ContextSize);
/* IDebugAdvanced2 */
[PreserveSig]
new int Request(
[In] DEBUG_REQUEST Request,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] inBuffer,
[In] Int32 InBufferSize,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] outBuffer,
[In] Int32 OutBufferSize,
[Out] out Int32 OutSize);
[PreserveSig]
new int GetSourceFileInformation(
[In] DEBUG_SRCFILE Which,
[In, MarshalAs(UnmanagedType.LPStr)] string SourceFile,
[In] UInt64 Arg64,
[In] UInt32 Arg32,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out Int32 InfoSize);
[PreserveSig]
new int FindSourceFileAndToken(
[In] UInt32 StartElement,
[In] UInt64 ModAddr,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[In] DEBUG_FIND_SOURCE Flags,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] Int32 FileTokenSize,
[Out] out Int32 FoundElement,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out Int32 FoundSize);
[PreserveSig]
new int GetSymbolInformation(
[In] DEBUG_SYMINFO Which,
[In] UInt64 Arg64,
[In] UInt32 Arg32,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out Int32 InfoSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder StringBuffer,
[In] Int32 StringBufferSize,
[Out] out Int32 StringSize);
[PreserveSig]
new int GetSystemObjectInformation(
[In] DEBUG_SYSOBJINFO Which,
[In] UInt64 Arg64,
[In] UInt32 Arg32,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out Int32 InfoSize);
/* IDebugAdvanced3 */
[PreserveSig]
int GetSourceFileInformationWide(
[In] DEBUG_SRCFILE Which,
[In, MarshalAs(UnmanagedType.LPWStr)] string SourceFile,
[In] UInt64 Arg64,
[In] UInt32 Arg32,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out Int32 InfoSize);
[PreserveSig]
int FindSourceFileAndTokenWide(
[In] UInt32 StartElement,
[In] UInt64 ModAddr,
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[In] DEBUG_FIND_SOURCE Flags,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] Int32 FileTokenSize,
[Out] out Int32 FoundElement,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out Int32 FoundSize);
[PreserveSig]
int GetSymbolInformationWide(
[In] DEBUG_SYMINFO Which,
[In] UInt64 Arg64,
[In] UInt32 Arg32,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out Int32 InfoSize,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder StringBuffer,
[In] Int32 StringBufferSize,
[Out] out Int32 StringSize);
}
}

Просмотреть файл

@ -0,0 +1,109 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("5bd9d474-5975-423a-b88b-65a8e7110e65")]
public interface IDebugBreakpoint
{
/* IDebugBreakpoint */
[PreserveSig]
int GetId(
[Out] out UInt32 Id);
[PreserveSig]
int GetType(
[Out] out DEBUG_BREAKPOINT_TYPE BreakType,
[Out] out UInt32 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] out DEBUG_BREAKPOINT_FLAG Flags);
[PreserveSig]
int AddFlags(
[In] DEBUG_BREAKPOINT_FLAG Flags);
[PreserveSig]
int RemoveFlags(
[In] DEBUG_BREAKPOINT_FLAG Flags);
[PreserveSig]
int SetFlags(
[In] DEBUG_BREAKPOINT_FLAG Flags);
[PreserveSig]
int GetOffset(
[Out] out UInt64 Offset);
[PreserveSig]
int SetOffset(
[In] UInt64 Offset);
[PreserveSig]
int GetDataParameters(
[Out] out UInt32 Size,
[Out] out DEBUG_BREAKPOINT_ACCESS_TYPE AccessType);
[PreserveSig]
int SetDataParameters(
[In] UInt32 Size,
[In] DEBUG_BREAKPOINT_ACCESS_TYPE AccessType);
[PreserveSig]
int GetPassCount(
[Out] out UInt32 Count);
[PreserveSig]
int SetPassCount(
[In] UInt32 Count);
[PreserveSig]
int GetCurrentPassCount(
[Out] out UInt32 Count);
[PreserveSig]
int GetMatchThreadId(
[Out] out UInt32 Id);
[PreserveSig]
int SetMatchThreadId(
[In] UInt32 Thread);
[PreserveSig]
int GetCommand(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
int SetCommand(
[In, MarshalAs(UnmanagedType.LPStr)] string Command);
[PreserveSig]
int GetOffsetExpression(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ExpressionSize);
[PreserveSig]
int SetOffsetExpression(
[In, MarshalAs(UnmanagedType.LPStr)] string Expression);
[PreserveSig]
int GetParameters(
[Out] out DEBUG_BREAKPOINT_PARAMETERS Params);
}
}

Просмотреть файл

@ -0,0 +1,131 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("1b278d20-79f2-426e-a3f9-c1ddf375d48e")]
public interface IDebugBreakpoint2 : IDebugBreakpoint
{
/* IDebugBreakpoint */
[PreserveSig]
new int GetId(
[Out] out UInt32 Id);
[PreserveSig]
new int GetType(
[Out] out DEBUG_BREAKPOINT_TYPE BreakType,
[Out] out UInt32 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] out DEBUG_BREAKPOINT_FLAG Flags);
[PreserveSig]
new int AddFlags(
[In] DEBUG_BREAKPOINT_FLAG Flags);
[PreserveSig]
new int RemoveFlags(
[In] DEBUG_BREAKPOINT_FLAG Flags);
[PreserveSig]
new int SetFlags(
[In] DEBUG_BREAKPOINT_FLAG Flags);
[PreserveSig]
new int GetOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int SetOffset(
[In] UInt64 Offset);
[PreserveSig]
new int GetDataParameters(
[Out] out UInt32 Size,
[Out] out DEBUG_BREAKPOINT_ACCESS_TYPE AccessType);
[PreserveSig]
new int SetDataParameters(
[In] UInt32 Size,
[In] DEBUG_BREAKPOINT_ACCESS_TYPE AccessType);
[PreserveSig]
new int GetPassCount(
[Out] out UInt32 Count);
[PreserveSig]
new int SetPassCount(
[In] UInt32 Count);
[PreserveSig]
new int GetCurrentPassCount(
[Out] out UInt32 Count);
[PreserveSig]
new int GetMatchThreadId(
[Out] out UInt32 Id);
[PreserveSig]
new int SetMatchThreadId(
[In] UInt32 Thread);
[PreserveSig]
new int GetCommand(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
new int SetCommand(
[In, MarshalAs(UnmanagedType.LPStr)] string Command);
[PreserveSig]
new int GetOffsetExpression(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ExpressionSize);
[PreserveSig]
new int SetOffsetExpression(
[In, MarshalAs(UnmanagedType.LPStr)] string Expression);
[PreserveSig]
new int GetParameters(
[Out] out DEBUG_BREAKPOINT_PARAMETERS Params);
/* IDebugBreakpoint2 */
[PreserveSig]
int GetCommandWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
int SetCommandWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Command);
[PreserveSig]
int GetOffsetExpressionWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ExpressionSize);
[PreserveSig]
int SetOffsetExpressionWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Command);
}
}

Просмотреть файл

@ -0,0 +1,136 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("38f5c249-b448-43bb-9835-579d4ec02249")]
public interface IDebugBreakpoint3 : IDebugBreakpoint2
{
/* IDebugBreakpoint */
[PreserveSig]
new int GetId(
[Out] out UInt32 Id);
[PreserveSig]
new int GetType(
[Out] out DEBUG_BREAKPOINT_TYPE BreakType,
[Out] out UInt32 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] out DEBUG_BREAKPOINT_FLAG Flags);
[PreserveSig]
new int AddFlags(
[In] DEBUG_BREAKPOINT_FLAG Flags);
[PreserveSig]
new int RemoveFlags(
[In] DEBUG_BREAKPOINT_FLAG Flags);
[PreserveSig]
new int SetFlags(
[In] DEBUG_BREAKPOINT_FLAG Flags);
[PreserveSig]
new int GetOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int SetOffset(
[In] UInt64 Offset);
[PreserveSig]
new int GetDataParameters(
[Out] out UInt32 Size,
[Out] out DEBUG_BREAKPOINT_ACCESS_TYPE AccessType);
[PreserveSig]
new int SetDataParameters(
[In] UInt32 Size,
[In] DEBUG_BREAKPOINT_ACCESS_TYPE AccessType);
[PreserveSig]
new int GetPassCount(
[Out] out UInt32 Count);
[PreserveSig]
new int SetPassCount(
[In] UInt32 Count);
[PreserveSig]
new int GetCurrentPassCount(
[Out] out UInt32 Count);
[PreserveSig]
new int GetMatchThreadId(
[Out] out UInt32 Id);
[PreserveSig]
new int SetMatchThreadId(
[In] UInt32 Thread);
[PreserveSig]
new int GetCommand(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
new int SetCommand(
[In, MarshalAs(UnmanagedType.LPStr)] string Command);
[PreserveSig]
new int GetOffsetExpression(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ExpressionSize);
[PreserveSig]
new int SetOffsetExpression(
[In, MarshalAs(UnmanagedType.LPStr)] string Expression);
[PreserveSig]
new int GetParameters(
[Out] out DEBUG_BREAKPOINT_PARAMETERS Params);
/* IDebugBreakpoint2 */
[PreserveSig]
new int GetCommandWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
new int SetCommandWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Command);
[PreserveSig]
new int GetOffsetExpressionWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ExpressionSize);
[PreserveSig]
new int SetOffsetExpressionWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Command);
/* IDebugBreakpoint3 */
[PreserveSig]
int GetGuid([Out] out Guid Guid);
}
}

Просмотреть файл

@ -0,0 +1,243 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Security;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("27fe5639-8407-4f47-8364-ee118fb08ac8")]
public interface IDebugClient
{
/* IDebugClient */
[PreserveSig]
int AttachKernel(
[In] DEBUG_ATTACH Flags,
[In, MarshalAs(UnmanagedType.LPStr)] string ConnectOptions);
[PreserveSig]
int GetKernelConnectionOptions(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 OptionsSize);
[PreserveSig]
int SetKernelConnectionOptions(
[In, MarshalAs(UnmanagedType.LPStr)] string Options);
[PreserveSig]
int StartProcessServer(
[In] DEBUG_CLASS Flags,
[In, MarshalAs(UnmanagedType.LPStr)] string Options,
[In] IntPtr Reserved);
[PreserveSig]
int ConnectProcessServer(
[In, MarshalAs(UnmanagedType.LPStr)] string RemoteOptions,
[Out] out UInt64 Server);
[PreserveSig]
int DisconnectProcessServer(
[In] UInt64 Server);
[PreserveSig]
int GetRunningProcessSystemIds(
[In] UInt64 Server,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[In] UInt32 Count,
[Out] out UInt32 ActualCount);
[PreserveSig]
int GetRunningProcessSystemIdByExecutableName(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string ExeName,
[In] DEBUG_GET_PROC Flags,
[Out] out UInt32 Id);
[PreserveSig]
int GetRunningProcessDescription(
[In] UInt64 Server,
[In] UInt32 SystemId,
[In] DEBUG_PROC_DESC Flags,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ExeName,
[In] Int32 ExeNameSize,
[Out] out UInt32 ActualExeNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 ActualDescriptionSize);
[PreserveSig]
int AttachProcess(
[In] UInt64 Server,
[In] UInt32 ProcessID,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
int CreateProcess(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS Flags);
[PreserveSig]
int CreateProcessAndAttach(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS Flags,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
int GetProcessOptions(
[Out] out DEBUG_PROCESS Options);
[PreserveSig]
int AddProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
int RemoveProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
int SetProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
int OpenDumpFile(
[In, MarshalAs(UnmanagedType.LPStr)] string DumpFile);
[PreserveSig]
int WriteDumpFile(
[In, MarshalAs(UnmanagedType.LPStr)] string DumpFile,
[In] DEBUG_DUMP Qualifier);
[PreserveSig]
int ConnectSession(
[In] DEBUG_CONNECT_SESSION Flags,
[In] UInt32 HistoryLimit);
[PreserveSig]
int StartServer(
[In, MarshalAs(UnmanagedType.LPStr)] string Options);
[PreserveSig]
int OutputServer(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Machine,
[In] DEBUG_SERVERS Flags);
[PreserveSig]
int TerminateProcesses();
[PreserveSig]
int DetachProcesses();
[PreserveSig]
int EndSession(
[In] DEBUG_END Flags);
[PreserveSig]
int GetExitCode(
[Out] out UInt32 Code);
[PreserveSig]
int DispatchCallbacks(
[In] UInt32 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] 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] out DEBUG_OUTPUT Mask);
[PreserveSig]
int SetOutputMask(
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
int GetOtherOutputMask(
[In, MarshalAs(UnmanagedType.Interface)] IDebugClient Client,
[Out] out DEBUG_OUTPUT Mask);
[PreserveSig]
int SetOtherOutputMask(
[In, MarshalAs(UnmanagedType.Interface)] IDebugClient Client,
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
int GetOutputWidth(
[Out] out UInt32 Columns);
[PreserveSig]
int SetOutputWidth(
[In] UInt32 Columns);
[PreserveSig]
int GetOutputLinePrefix(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 PrefixSize);
[PreserveSig]
int SetOutputLinePrefix(
[In, MarshalAs(UnmanagedType.LPStr)] string Prefix);
[PreserveSig]
int GetIdentity(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 IdentitySize);
[PreserveSig]
int OutputIdentity(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt32 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] 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();
}
}

Просмотреть файл

@ -0,0 +1,276 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("edbed635-372e-4dab-bbfe-ed0d2f63be81")]
public interface IDebugClient2 : IDebugClient
{
/* IDebugClient */
[PreserveSig]
new int AttachKernel(
[In] DEBUG_ATTACH Flags,
[In, MarshalAs(UnmanagedType.LPStr)] string ConnectOptions);
[PreserveSig]
new int GetKernelConnectionOptions(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 OptionsSize);
[PreserveSig]
new int SetKernelConnectionOptions(
[In, MarshalAs(UnmanagedType.LPStr)] string Options);
[PreserveSig]
new int StartProcessServer(
[In] DEBUG_CLASS Flags,
[In, MarshalAs(UnmanagedType.LPStr)] string Options,
[In] IntPtr Reserved);
[PreserveSig]
new int ConnectProcessServer(
[In, MarshalAs(UnmanagedType.LPStr)] string RemoteOptions,
[Out] out UInt64 Server);
[PreserveSig]
new int DisconnectProcessServer(
[In] UInt64 Server);
[PreserveSig]
new int GetRunningProcessSystemIds(
[In] UInt64 Server,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[In] UInt32 Count,
[Out] out UInt32 ActualCount);
[PreserveSig]
new int GetRunningProcessSystemIdByExecutableName(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string ExeName,
[In] DEBUG_GET_PROC Flags,
[Out] out UInt32 Id);
[PreserveSig]
new int GetRunningProcessDescription(
[In] UInt64 Server,
[In] UInt32 SystemId,
[In] DEBUG_PROC_DESC Flags,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ExeName,
[In] Int32 ExeNameSize,
[Out] out UInt32 ActualExeNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 ActualDescriptionSize);
[PreserveSig]
new int AttachProcess(
[In] UInt64 Server,
[In] UInt32 ProcessID,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
new int CreateProcess(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS Flags);
[PreserveSig]
new int CreateProcessAndAttach(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS Flags,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
new int GetProcessOptions(
[Out] out DEBUG_PROCESS Options);
[PreserveSig]
new int AddProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int RemoveProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int SetProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int OpenDumpFile(
[In, MarshalAs(UnmanagedType.LPStr)] string DumpFile);
[PreserveSig]
new int WriteDumpFile(
[In, MarshalAs(UnmanagedType.LPStr)] string DumpFile,
[In] DEBUG_DUMP Qualifier);
[PreserveSig]
new int ConnectSession(
[In] DEBUG_CONNECT_SESSION Flags,
[In] UInt32 HistoryLimit);
[PreserveSig]
new int StartServer(
[In, MarshalAs(UnmanagedType.LPStr)] string Options);
[PreserveSig]
new int OutputServer(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Machine,
[In] DEBUG_SERVERS Flags);
[PreserveSig]
new int TerminateProcesses();
[PreserveSig]
new int DetachProcesses();
[PreserveSig]
new int EndSession(
[In] DEBUG_END Flags);
[PreserveSig]
new int GetExitCode(
[Out] out UInt32 Code);
[PreserveSig]
new int DispatchCallbacks(
[In] UInt32 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] 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] out DEBUG_OUTPUT Mask);
[PreserveSig]
new int SetOutputMask(
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
new int GetOtherOutputMask(
[In, MarshalAs(UnmanagedType.Interface)] IDebugClient Client,
[Out] out DEBUG_OUTPUT Mask);
[PreserveSig]
new int SetOtherOutputMask(
[In, MarshalAs(UnmanagedType.Interface)] IDebugClient Client,
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
new int GetOutputWidth(
[Out] out UInt32 Columns);
[PreserveSig]
new int SetOutputWidth(
[In] UInt32 Columns);
[PreserveSig]
new int GetOutputLinePrefix(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 PrefixSize);
[PreserveSig]
new int SetOutputLinePrefix(
[In, MarshalAs(UnmanagedType.LPStr)] string Prefix);
[PreserveSig]
new int GetIdentity(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 IdentitySize);
[PreserveSig]
new int OutputIdentity(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt32 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] 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,
[In] DEBUG_DUMP Qualifier,
[In] DEBUG_FORMAT FormatFlags,
[In, MarshalAs(UnmanagedType.LPStr)] string Comment);
[PreserveSig]
int AddDumpInformationFile(
[In, MarshalAs(UnmanagedType.LPStr)] string InfoFile,
[In] DEBUG_DUMP_FILE Type);
[PreserveSig]
int EndProcessServer(
[In] UInt64 Server);
[PreserveSig]
int WaitForProcessServerEnd(
[In] UInt32 Timeout);
[PreserveSig]
int IsKernelDebuggerEnabled();
[PreserveSig]
int TerminateCurrentProcess();
[PreserveSig]
int DetachCurrentProcess();
[PreserveSig]
int AbandonCurrentProcess();
}
}

Просмотреть файл

@ -0,0 +1,311 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("dd492d7f-71b8-4ad6-a8dc-1c887479ff91")]
public interface IDebugClient3 : IDebugClient2
{
/* IDebugClient */
[PreserveSig]
new int AttachKernel(
[In] DEBUG_ATTACH Flags,
[In, MarshalAs(UnmanagedType.LPStr)] string ConnectOptions);
[PreserveSig]
new int GetKernelConnectionOptions(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 OptionsSize);
[PreserveSig]
new int SetKernelConnectionOptions(
[In, MarshalAs(UnmanagedType.LPStr)] string Options);
[PreserveSig]
new int StartProcessServer(
[In] DEBUG_CLASS Flags,
[In, MarshalAs(UnmanagedType.LPStr)] string Options,
[In] IntPtr Reserved);
[PreserveSig]
new int ConnectProcessServer(
[In, MarshalAs(UnmanagedType.LPStr)] string RemoteOptions,
[Out] out UInt64 Server);
[PreserveSig]
new int DisconnectProcessServer(
[In] UInt64 Server);
[PreserveSig]
new int GetRunningProcessSystemIds(
[In] UInt64 Server,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[In] UInt32 Count,
[Out] out UInt32 ActualCount);
[PreserveSig]
new int GetRunningProcessSystemIdByExecutableName(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string ExeName,
[In] DEBUG_GET_PROC Flags,
[Out] out UInt32 Id);
[PreserveSig]
new int GetRunningProcessDescription(
[In] UInt64 Server,
[In] UInt32 SystemId,
[In] DEBUG_PROC_DESC Flags,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ExeName,
[In] Int32 ExeNameSize,
[Out] out UInt32 ActualExeNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 ActualDescriptionSize);
[PreserveSig]
new int AttachProcess(
[In] UInt64 Server,
[In] UInt32 ProcessID,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
new int CreateProcess(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS Flags);
[PreserveSig]
new int CreateProcessAndAttach(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS Flags,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
new int GetProcessOptions(
[Out] out DEBUG_PROCESS Options);
[PreserveSig]
new int AddProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int RemoveProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int SetProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int OpenDumpFile(
[In, MarshalAs(UnmanagedType.LPStr)] string DumpFile);
[PreserveSig]
new int WriteDumpFile(
[In, MarshalAs(UnmanagedType.LPStr)] string DumpFile,
[In] DEBUG_DUMP Qualifier);
[PreserveSig]
new int ConnectSession(
[In] DEBUG_CONNECT_SESSION Flags,
[In] UInt32 HistoryLimit);
[PreserveSig]
new int StartServer(
[In, MarshalAs(UnmanagedType.LPStr)] string Options);
[PreserveSig]
new int OutputServer(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Machine,
[In] DEBUG_SERVERS Flags);
[PreserveSig]
new int TerminateProcesses();
[PreserveSig]
new int DetachProcesses();
[PreserveSig]
new int EndSession(
[In] DEBUG_END Flags);
[PreserveSig]
new int GetExitCode(
[Out] out UInt32 Code);
[PreserveSig]
new int DispatchCallbacks(
[In] UInt32 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] 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] out DEBUG_OUTPUT Mask);
[PreserveSig]
new int SetOutputMask(
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
new int GetOtherOutputMask(
[In, MarshalAs(UnmanagedType.Interface)] IDebugClient Client,
[Out] out DEBUG_OUTPUT Mask);
[PreserveSig]
new int SetOtherOutputMask(
[In, MarshalAs(UnmanagedType.Interface)] IDebugClient Client,
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
new int GetOutputWidth(
[Out] out UInt32 Columns);
[PreserveSig]
new int SetOutputWidth(
[In] UInt32 Columns);
[PreserveSig]
new int GetOutputLinePrefix(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 PrefixSize);
[PreserveSig]
new int SetOutputLinePrefix(
[In, MarshalAs(UnmanagedType.LPStr)] string Prefix);
[PreserveSig]
new int GetIdentity(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 IdentitySize);
[PreserveSig]
new int OutputIdentity(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt32 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] 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,
[In] DEBUG_DUMP Qualifier,
[In] DEBUG_FORMAT FormatFlags,
[In, MarshalAs(UnmanagedType.LPStr)] string Comment);
[PreserveSig]
new int AddDumpInformationFile(
[In, MarshalAs(UnmanagedType.LPStr)] string InfoFile,
[In] DEBUG_DUMP_FILE Type);
[PreserveSig]
new int EndProcessServer(
[In] UInt64 Server);
[PreserveSig]
new int WaitForProcessServerEnd(
[In] UInt32 Timeout);
[PreserveSig]
new int IsKernelDebuggerEnabled();
[PreserveSig]
new int TerminateCurrentProcess();
[PreserveSig]
new int DetachCurrentProcess();
[PreserveSig]
new int AbandonCurrentProcess();
/* IDebugClient3 */
[PreserveSig]
int GetRunningProcessSystemIdByExecutableNameWide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string ExeName,
[In] DEBUG_GET_PROC Flags,
[Out] out UInt32 Id);
[PreserveSig]
int GetRunningProcessDescriptionWide(
[In] UInt64 Server,
[In] UInt32 SystemId,
[In] DEBUG_PROC_DESC Flags,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder ExeName,
[In] Int32 ExeNameSize,
[Out] out UInt32 ActualExeNameSize,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 ActualDescriptionSize);
[PreserveSig]
int CreateProcessWide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS CreateFlags);
[PreserveSig]
int CreateProcessAndAttachWide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS CreateFlags,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
}
}

Просмотреть файл

@ -0,0 +1,354 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("ca83c3de-5089-4cf8-93c8-d892387f2a5e")]
public interface IDebugClient4 : IDebugClient3
{
/* IDebugClient */
[PreserveSig]
new int AttachKernel(
[In] DEBUG_ATTACH Flags,
[In, MarshalAs(UnmanagedType.LPStr)] string ConnectOptions);
[PreserveSig]
new int GetKernelConnectionOptions(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 OptionsSize);
[PreserveSig]
new int SetKernelConnectionOptions(
[In, MarshalAs(UnmanagedType.LPStr)] string Options);
[PreserveSig]
new int StartProcessServer(
[In] DEBUG_CLASS Flags,
[In, MarshalAs(UnmanagedType.LPStr)] string Options,
[In] IntPtr Reserved);
[PreserveSig]
new int ConnectProcessServer(
[In, MarshalAs(UnmanagedType.LPStr)] string RemoteOptions,
[Out] out UInt64 Server);
[PreserveSig]
new int DisconnectProcessServer(
[In] UInt64 Server);
[PreserveSig]
new int GetRunningProcessSystemIds(
[In] UInt64 Server,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[In] UInt32 Count,
[Out] out UInt32 ActualCount);
[PreserveSig]
new int GetRunningProcessSystemIdByExecutableName(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string ExeName,
[In] DEBUG_GET_PROC Flags,
[Out] out UInt32 Id);
[PreserveSig]
new int GetRunningProcessDescription(
[In] UInt64 Server,
[In] UInt32 SystemId,
[In] DEBUG_PROC_DESC Flags,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ExeName,
[In] Int32 ExeNameSize,
[Out] out UInt32 ActualExeNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 ActualDescriptionSize);
[PreserveSig]
new int AttachProcess(
[In] UInt64 Server,
[In] UInt32 ProcessID,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
new int CreateProcess(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS Flags);
[PreserveSig]
new int CreateProcessAndAttach(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS Flags,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
new int GetProcessOptions(
[Out] out DEBUG_PROCESS Options);
[PreserveSig]
new int AddProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int RemoveProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int SetProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int OpenDumpFile(
[In, MarshalAs(UnmanagedType.LPStr)] string DumpFile);
[PreserveSig]
new int WriteDumpFile(
[In, MarshalAs(UnmanagedType.LPStr)] string DumpFile,
[In] DEBUG_DUMP Qualifier);
[PreserveSig]
new int ConnectSession(
[In] DEBUG_CONNECT_SESSION Flags,
[In] UInt32 HistoryLimit);
[PreserveSig]
new int StartServer(
[In, MarshalAs(UnmanagedType.LPStr)] string Options);
[PreserveSig]
new int OutputServer(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Machine,
[In] DEBUG_SERVERS Flags);
[PreserveSig]
new int TerminateProcesses();
[PreserveSig]
new int DetachProcesses();
[PreserveSig]
new int EndSession(
[In] DEBUG_END Flags);
[PreserveSig]
new int GetExitCode(
[Out] out UInt32 Code);
[PreserveSig]
new int DispatchCallbacks(
[In] UInt32 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] 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] out DEBUG_OUTPUT Mask);
[PreserveSig]
new int SetOutputMask(
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
new int GetOtherOutputMask(
[In, MarshalAs(UnmanagedType.Interface)] IDebugClient Client,
[Out] out DEBUG_OUTPUT Mask);
[PreserveSig]
new int SetOtherOutputMask(
[In, MarshalAs(UnmanagedType.Interface)] IDebugClient Client,
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
new int GetOutputWidth(
[Out] out UInt32 Columns);
[PreserveSig]
new int SetOutputWidth(
[In] UInt32 Columns);
[PreserveSig]
new int GetOutputLinePrefix(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 PrefixSize);
[PreserveSig]
new int SetOutputLinePrefix(
[In, MarshalAs(UnmanagedType.LPStr)] string Prefix);
[PreserveSig]
new int GetIdentity(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 IdentitySize);
[PreserveSig]
new int OutputIdentity(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt32 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] 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,
[In] DEBUG_DUMP Qualifier,
[In] DEBUG_FORMAT FormatFlags,
[In, MarshalAs(UnmanagedType.LPStr)] string Comment);
[PreserveSig]
new int AddDumpInformationFile(
[In, MarshalAs(UnmanagedType.LPStr)] string InfoFile,
[In] DEBUG_DUMP_FILE Type);
[PreserveSig]
new int EndProcessServer(
[In] UInt64 Server);
[PreserveSig]
new int WaitForProcessServerEnd(
[In] UInt32 Timeout);
[PreserveSig]
new int IsKernelDebuggerEnabled();
[PreserveSig]
new int TerminateCurrentProcess();
[PreserveSig]
new int DetachCurrentProcess();
[PreserveSig]
new int AbandonCurrentProcess();
/* IDebugClient3 */
[PreserveSig]
new int GetRunningProcessSystemIdByExecutableNameWide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string ExeName,
[In] DEBUG_GET_PROC Flags,
[Out] out UInt32 Id);
[PreserveSig]
new int GetRunningProcessDescriptionWide(
[In] UInt64 Server,
[In] UInt32 SystemId,
[In] DEBUG_PROC_DESC Flags,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder ExeName,
[In] Int32 ExeNameSize,
[Out] out UInt32 ActualExeNameSize,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 ActualDescriptionSize);
[PreserveSig]
new int CreateProcessWide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS CreateFlags);
[PreserveSig]
new int CreateProcessAndAttachWide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS CreateFlags,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
/* IDebugClient4 */
[PreserveSig]
int OpenDumpFileWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string FileName,
[In] UInt64 FileHandle);
[PreserveSig]
int WriteDumpFileWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string DumpFile,
[In] UInt64 FileHandle,
[In] DEBUG_DUMP Qualifier,
[In] DEBUG_FORMAT FormatFlags,
[In, MarshalAs(UnmanagedType.LPWStr)] string Comment);
[PreserveSig]
int AddDumpInformationFileWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string FileName,
[In] UInt64 FileHandle,
[In] DEBUG_DUMP_FILE Type);
[PreserveSig]
int GetNumberDumpFiles(
[Out] out UInt32 Number);
[PreserveSig]
int GetDumpFile(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Handle,
[Out] out UInt32 Type);
[PreserveSig]
int GetDumpFileWide(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Handle,
[Out] out UInt32 Type);
}
}

Просмотреть файл

@ -0,0 +1,525 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("e3acb9d7-7ec2-4f0c-a0da-e81e0cbbe628")]
public interface IDebugClient5 : IDebugClient4
{
/* IDebugClient */
[PreserveSig]
new int AttachKernel(
[In] DEBUG_ATTACH Flags,
[In, MarshalAs(UnmanagedType.LPStr)] string ConnectOptions);
[PreserveSig]
new int GetKernelConnectionOptions(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 OptionsSize);
[PreserveSig]
new int SetKernelConnectionOptions(
[In, MarshalAs(UnmanagedType.LPStr)] string Options);
[PreserveSig]
new int StartProcessServer(
[In] DEBUG_CLASS Flags,
[In, MarshalAs(UnmanagedType.LPStr)] string Options,
[In] IntPtr Reserved);
[PreserveSig]
new int ConnectProcessServer(
[In, MarshalAs(UnmanagedType.LPStr)] string RemoteOptions,
[Out] out UInt64 Server);
[PreserveSig]
new int DisconnectProcessServer(
[In] UInt64 Server);
[PreserveSig]
new int GetRunningProcessSystemIds(
[In] UInt64 Server,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[In] UInt32 Count,
[Out] out UInt32 ActualCount);
[PreserveSig]
new int GetRunningProcessSystemIdByExecutableName(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string ExeName,
[In] DEBUG_GET_PROC Flags,
[Out] out UInt32 Id);
[PreserveSig]
new int GetRunningProcessDescription(
[In] UInt64 Server,
[In] UInt32 SystemId,
[In] DEBUG_PROC_DESC Flags,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ExeName,
[In] Int32 ExeNameSize,
[Out] out UInt32 ActualExeNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 ActualDescriptionSize);
[PreserveSig]
new int AttachProcess(
[In] UInt64 Server,
[In] UInt32 ProcessID,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
new int CreateProcess(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS Flags);
[PreserveSig]
new int CreateProcessAndAttach(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS Flags,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
new int GetProcessOptions(
[Out] out DEBUG_PROCESS Options);
[PreserveSig]
new int AddProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int RemoveProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int SetProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int OpenDumpFile(
[In, MarshalAs(UnmanagedType.LPStr)] string DumpFile);
[PreserveSig]
new int WriteDumpFile(
[In, MarshalAs(UnmanagedType.LPStr)] string DumpFile,
[In] DEBUG_DUMP Qualifier);
[PreserveSig]
new int ConnectSession(
[In] DEBUG_CONNECT_SESSION Flags,
[In] UInt32 HistoryLimit);
[PreserveSig]
new int StartServer(
[In, MarshalAs(UnmanagedType.LPStr)] string Options);
[PreserveSig]
new int OutputServer(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Machine,
[In] DEBUG_SERVERS Flags);
[PreserveSig]
new int TerminateProcesses();
[PreserveSig]
new int DetachProcesses();
[PreserveSig]
new int EndSession(
[In] DEBUG_END Flags);
[PreserveSig]
new int GetExitCode(
[Out] out UInt32 Code);
[PreserveSig]
new int DispatchCallbacks(
[In] UInt32 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] 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] out DEBUG_OUTPUT Mask);
[PreserveSig]
new int SetOutputMask(
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
new int GetOtherOutputMask(
[In, MarshalAs(UnmanagedType.Interface)] IDebugClient Client,
[Out] out DEBUG_OUTPUT Mask);
[PreserveSig]
new int SetOtherOutputMask(
[In, MarshalAs(UnmanagedType.Interface)] IDebugClient Client,
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
new int GetOutputWidth(
[Out] out UInt32 Columns);
[PreserveSig]
new int SetOutputWidth(
[In] UInt32 Columns);
[PreserveSig]
new int GetOutputLinePrefix(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 PrefixSize);
[PreserveSig]
new int SetOutputLinePrefix(
[In, MarshalAs(UnmanagedType.LPStr)] string Prefix);
[PreserveSig]
new int GetIdentity(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 IdentitySize);
[PreserveSig]
new int OutputIdentity(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt32 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] 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,
[In] DEBUG_DUMP Qualifier,
[In] DEBUG_FORMAT FormatFlags,
[In, MarshalAs(UnmanagedType.LPStr)] string Comment);
[PreserveSig]
new int AddDumpInformationFile(
[In, MarshalAs(UnmanagedType.LPStr)] string InfoFile,
[In] DEBUG_DUMP_FILE Type);
[PreserveSig]
new int EndProcessServer(
[In] UInt64 Server);
[PreserveSig]
new int WaitForProcessServerEnd(
[In] UInt32 Timeout);
[PreserveSig]
new int IsKernelDebuggerEnabled();
[PreserveSig]
new int TerminateCurrentProcess();
[PreserveSig]
new int DetachCurrentProcess();
[PreserveSig]
new int AbandonCurrentProcess();
/* IDebugClient3 */
[PreserveSig]
new int GetRunningProcessSystemIdByExecutableNameWide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string ExeName,
[In] DEBUG_GET_PROC Flags,
[Out] out UInt32 Id);
[PreserveSig]
new int GetRunningProcessDescriptionWide(
[In] UInt64 Server,
[In] UInt32 SystemId,
[In] DEBUG_PROC_DESC Flags,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder ExeName,
[In] Int32 ExeNameSize,
[Out] out UInt32 ActualExeNameSize,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 ActualDescriptionSize);
[PreserveSig]
new int CreateProcessWide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS CreateFlags);
[PreserveSig]
new int CreateProcessAndAttachWide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS CreateFlags,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
/* IDebugClient4 */
[PreserveSig]
new int OpenDumpFileWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string FileName,
[In] UInt64 FileHandle);
[PreserveSig]
new int WriteDumpFileWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string DumpFile,
[In] UInt64 FileHandle,
[In] DEBUG_DUMP Qualifier,
[In] DEBUG_FORMAT FormatFlags,
[In, MarshalAs(UnmanagedType.LPWStr)] string Comment);
[PreserveSig]
new int AddDumpInformationFileWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string FileName,
[In] UInt64 FileHandle,
[In] DEBUG_DUMP_FILE Type);
[PreserveSig]
new int GetNumberDumpFiles(
[Out] out UInt32 Number);
[PreserveSig]
new int GetDumpFile(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Handle,
[Out] out UInt32 Type);
[PreserveSig]
new int GetDumpFileWide(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Handle,
[Out] out UInt32 Type);
/* IDebugClient5 */
[PreserveSig]
int AttachKernelWide(
[In] DEBUG_ATTACH Flags,
[In, MarshalAs(UnmanagedType.LPWStr)] string ConnectOptions);
[PreserveSig]
int GetKernelConnectionOptionsWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 OptionsSize);
[PreserveSig]
int SetKernelConnectionOptionsWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Options);
[PreserveSig]
int StartProcessServerWide(
[In] DEBUG_CLASS Flags,
[In, MarshalAs(UnmanagedType.LPWStr)] string Options,
[In] IntPtr Reserved);
[PreserveSig]
int ConnectProcessServerWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string RemoteOptions,
[Out] out UInt64 Server);
[PreserveSig]
int StartServerWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Options);
[PreserveSig]
int OutputServersWide(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPWStr)] string Machine,
[In] DEBUG_SERVERS Flags);
/* GetOutputCallbacks could a conversion thunk from the debugger engine so we can't specify a specific interface */
[PreserveSig]
int GetOutputCallbacksWide(
[Out] 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] IDebugOutputCallbacks2 Callbacks);
[PreserveSig]
int GetOutputLinePrefixWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 PrefixSize);
[PreserveSig]
int SetOutputLinePrefixWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Prefix);
[PreserveSig]
int GetIdentityWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 IdentitySize);
[PreserveSig]
int OutputIdentityWide(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt32 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] 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(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] ref DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer,
[In] UInt32 OptionsBufferSize,
[In, MarshalAs(UnmanagedType.LPStr)] string InitialDirectory,
[In, MarshalAs(UnmanagedType.LPStr)] string Environment);
[PreserveSig]
int CreateProcess2Wide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string CommandLine,
[In] ref DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer,
[In] UInt32 OptionsBufferSize,
[In, MarshalAs(UnmanagedType.LPWStr)] string InitialDirectory,
[In, MarshalAs(UnmanagedType.LPWStr)] string Environment);
[PreserveSig]
int CreateProcessAndAttach2(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] ref DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer,
[In] UInt32 OptionsBufferSize,
[In, MarshalAs(UnmanagedType.LPStr)] string InitialDirectory,
[In, MarshalAs(UnmanagedType.LPStr)] string Environment,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
int CreateProcessAndAttach2Wide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string CommandLine,
[In] ref DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer,
[In] UInt32 OptionsBufferSize,
[In, MarshalAs(UnmanagedType.LPWStr)] string InitialDirectory,
[In, MarshalAs(UnmanagedType.LPWStr)] string Environment,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
int PushOutputLinePrefix(
[In, MarshalAs(UnmanagedType.LPStr)] string NewPrefix,
[Out] out UInt64 Handle);
[PreserveSig]
int PushOutputLinePrefixWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string NewPrefix,
[Out] out UInt64 Handle);
[PreserveSig]
int PopOutputLinePrefix(
[In] UInt64 Handle);
[PreserveSig]
int GetNumberInputCallbacks(
[Out] out UInt32 Count);
[PreserveSig]
int GetNumberOutputCallbacks(
[Out] out UInt32 Count);
[PreserveSig]
int GetNumberEventCallbacks(
[In] DEBUG_EVENT Flags,
[Out] out UInt32 Count);
[PreserveSig]
int GetQuitLockString(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize);
[PreserveSig]
int SetQuitLockString(
[In, MarshalAs(UnmanagedType.LPStr)] string LockString);
[PreserveSig]
int GetQuitLockStringWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize);
[PreserveSig]
int SetQuitLockStringWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string LockString);
}
}

Просмотреть файл

@ -0,0 +1,531 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("e3acb9d7-7ec2-4f0c-a0da-e81e0cbbe628")]
public interface IDebugClient6 : IDebugClient5
{
/* IDebugClient */
[PreserveSig]
new int AttachKernel(
[In] DEBUG_ATTACH Flags,
[In, MarshalAs(UnmanagedType.LPStr)] string ConnectOptions);
[PreserveSig]
new int GetKernelConnectionOptions(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 OptionsSize);
[PreserveSig]
new int SetKernelConnectionOptions(
[In, MarshalAs(UnmanagedType.LPStr)] string Options);
[PreserveSig]
new int StartProcessServer(
[In] DEBUG_CLASS Flags,
[In, MarshalAs(UnmanagedType.LPStr)] string Options,
[In] IntPtr Reserved);
[PreserveSig]
new int ConnectProcessServer(
[In, MarshalAs(UnmanagedType.LPStr)] string RemoteOptions,
[Out] out UInt64 Server);
[PreserveSig]
new int DisconnectProcessServer(
[In] UInt64 Server);
[PreserveSig]
new int GetRunningProcessSystemIds(
[In] UInt64 Server,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[In] UInt32 Count,
[Out] out UInt32 ActualCount);
[PreserveSig]
new int GetRunningProcessSystemIdByExecutableName(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string ExeName,
[In] DEBUG_GET_PROC Flags,
[Out] out UInt32 Id);
[PreserveSig]
new int GetRunningProcessDescription(
[In] UInt64 Server,
[In] UInt32 SystemId,
[In] DEBUG_PROC_DESC Flags,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ExeName,
[In] Int32 ExeNameSize,
[Out] out UInt32 ActualExeNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 ActualDescriptionSize);
[PreserveSig]
new int AttachProcess(
[In] UInt64 Server,
[In] UInt32 ProcessID,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
new int CreateProcess(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS Flags);
[PreserveSig]
new int CreateProcessAndAttach(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS Flags,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
new int GetProcessOptions(
[Out] out DEBUG_PROCESS Options);
[PreserveSig]
new int AddProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int RemoveProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int SetProcessOptions(
[In] DEBUG_PROCESS Options);
[PreserveSig]
new int OpenDumpFile(
[In, MarshalAs(UnmanagedType.LPStr)] string DumpFile);
[PreserveSig]
new int WriteDumpFile(
[In, MarshalAs(UnmanagedType.LPStr)] string DumpFile,
[In] DEBUG_DUMP Qualifier);
[PreserveSig]
new int ConnectSession(
[In] DEBUG_CONNECT_SESSION Flags,
[In] UInt32 HistoryLimit);
[PreserveSig]
new int StartServer(
[In, MarshalAs(UnmanagedType.LPStr)] string Options);
[PreserveSig]
new int OutputServer(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Machine,
[In] DEBUG_SERVERS Flags);
[PreserveSig]
new int TerminateProcesses();
[PreserveSig]
new int DetachProcesses();
[PreserveSig]
new int EndSession(
[In] DEBUG_END Flags);
[PreserveSig]
new int GetExitCode(
[Out] out UInt32 Code);
[PreserveSig]
new int DispatchCallbacks(
[In] UInt32 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] 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] out DEBUG_OUTPUT Mask);
[PreserveSig]
new int SetOutputMask(
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
new int GetOtherOutputMask(
[In, MarshalAs(UnmanagedType.Interface)] IDebugClient Client,
[Out] out DEBUG_OUTPUT Mask);
[PreserveSig]
new int SetOtherOutputMask(
[In, MarshalAs(UnmanagedType.Interface)] IDebugClient Client,
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
new int GetOutputWidth(
[Out] out UInt32 Columns);
[PreserveSig]
new int SetOutputWidth(
[In] UInt32 Columns);
[PreserveSig]
new int GetOutputLinePrefix(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 PrefixSize);
[PreserveSig]
new int SetOutputLinePrefix(
[In, MarshalAs(UnmanagedType.LPStr)] string Prefix);
[PreserveSig]
new int GetIdentity(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 IdentitySize);
[PreserveSig]
new int OutputIdentity(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt32 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] 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,
[In] DEBUG_DUMP Qualifier,
[In] DEBUG_FORMAT FormatFlags,
[In, MarshalAs(UnmanagedType.LPStr)] string Comment);
[PreserveSig]
new int AddDumpInformationFile(
[In, MarshalAs(UnmanagedType.LPStr)] string InfoFile,
[In] DEBUG_DUMP_FILE Type);
[PreserveSig]
new int EndProcessServer(
[In] UInt64 Server);
[PreserveSig]
new int WaitForProcessServerEnd(
[In] UInt32 Timeout);
[PreserveSig]
new int IsKernelDebuggerEnabled();
[PreserveSig]
new int TerminateCurrentProcess();
[PreserveSig]
new int DetachCurrentProcess();
[PreserveSig]
new int AbandonCurrentProcess();
/* IDebugClient3 */
[PreserveSig]
new int GetRunningProcessSystemIdByExecutableNameWide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string ExeName,
[In] DEBUG_GET_PROC Flags,
[Out] out UInt32 Id);
[PreserveSig]
new int GetRunningProcessDescriptionWide(
[In] UInt64 Server,
[In] UInt32 SystemId,
[In] DEBUG_PROC_DESC Flags,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder ExeName,
[In] Int32 ExeNameSize,
[Out] out UInt32 ActualExeNameSize,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 ActualDescriptionSize);
[PreserveSig]
new int CreateProcessWide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS CreateFlags);
[PreserveSig]
new int CreateProcessAndAttachWide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string CommandLine,
[In] DEBUG_CREATE_PROCESS CreateFlags,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
/* IDebugClient4 */
[PreserveSig]
new int OpenDumpFileWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string FileName,
[In] UInt64 FileHandle);
[PreserveSig]
new int WriteDumpFileWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string DumpFile,
[In] UInt64 FileHandle,
[In] DEBUG_DUMP Qualifier,
[In] DEBUG_FORMAT FormatFlags,
[In, MarshalAs(UnmanagedType.LPWStr)] string Comment);
[PreserveSig]
new int AddDumpInformationFileWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string FileName,
[In] UInt64 FileHandle,
[In] DEBUG_DUMP_FILE Type);
[PreserveSig]
new int GetNumberDumpFiles(
[Out] out UInt32 Number);
[PreserveSig]
new int GetDumpFile(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Handle,
[Out] out UInt32 Type);
[PreserveSig]
new int GetDumpFileWide(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Handle,
[Out] out UInt32 Type);
/* IDebugClient5 */
[PreserveSig]
new int AttachKernelWide(
[In] DEBUG_ATTACH Flags,
[In, MarshalAs(UnmanagedType.LPWStr)] string ConnectOptions);
[PreserveSig]
new int GetKernelConnectionOptionsWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 OptionsSize);
[PreserveSig]
new int SetKernelConnectionOptionsWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Options);
[PreserveSig]
new int StartProcessServerWide(
[In] DEBUG_CLASS Flags,
[In, MarshalAs(UnmanagedType.LPWStr)] string Options,
[In] IntPtr Reserved);
[PreserveSig]
new int ConnectProcessServerWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string RemoteOptions,
[Out] out UInt64 Server);
[PreserveSig]
new int StartServerWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Options);
[PreserveSig]
new int OutputServersWide(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPWStr)] string Machine,
[In] 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] 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] IDebugOutputCallbacks2 Callbacks);
[PreserveSig]
new int GetOutputLinePrefixWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 PrefixSize);
[PreserveSig]
new int SetOutputLinePrefixWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Prefix);
[PreserveSig]
new int GetIdentityWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 IdentitySize);
[PreserveSig]
new int OutputIdentityWide(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt32 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] 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(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] ref DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer,
[In] UInt32 OptionsBufferSize,
[In, MarshalAs(UnmanagedType.LPStr)] string InitialDirectory,
[In, MarshalAs(UnmanagedType.LPStr)] string Environment);
[PreserveSig]
new int CreateProcess2Wide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string CommandLine,
[In] ref DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer,
[In] UInt32 OptionsBufferSize,
[In, MarshalAs(UnmanagedType.LPWStr)] string InitialDirectory,
[In, MarshalAs(UnmanagedType.LPWStr)] string Environment);
[PreserveSig]
new int CreateProcessAndAttach2(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandLine,
[In] ref DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer,
[In] UInt32 OptionsBufferSize,
[In, MarshalAs(UnmanagedType.LPStr)] string InitialDirectory,
[In, MarshalAs(UnmanagedType.LPStr)] string Environment,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
new int CreateProcessAndAttach2Wide(
[In] UInt64 Server,
[In, MarshalAs(UnmanagedType.LPWStr)] string CommandLine,
[In] ref DEBUG_CREATE_PROCESS_OPTIONS OptionsBuffer,
[In] UInt32 OptionsBufferSize,
[In, MarshalAs(UnmanagedType.LPWStr)] string InitialDirectory,
[In, MarshalAs(UnmanagedType.LPWStr)] string Environment,
[In] UInt32 ProcessId,
[In] DEBUG_ATTACH AttachFlags);
[PreserveSig]
new int PushOutputLinePrefix(
[In, MarshalAs(UnmanagedType.LPStr)] string NewPrefix,
[Out] out UInt64 Handle);
[PreserveSig]
new int PushOutputLinePrefixWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string NewPrefix,
[Out] out UInt64 Handle);
[PreserveSig]
new int PopOutputLinePrefix(
[In] UInt64 Handle);
[PreserveSig]
new int GetNumberInputCallbacks(
[Out] out UInt32 Count);
[PreserveSig]
new int GetNumberOutputCallbacks(
[Out] out UInt32 Count);
[PreserveSig]
new int GetNumberEventCallbacks(
[In] DEBUG_EVENT Flags,
[Out] out UInt32 Count);
[PreserveSig]
new int GetQuitLockString(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize);
[PreserveSig]
new int SetQuitLockString(
[In, MarshalAs(UnmanagedType.LPStr)] string LockString);
[PreserveSig]
new int GetQuitLockStringWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize);
[PreserveSig]
new int SetQuitLockStringWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string LockString);
/* IDebugClient6 */
[PreserveSig]
int SetEventContextCallbacks(
[In] IDebugEventContextCallbacks Callbacks);
}
}

Просмотреть файл

@ -0,0 +1,524 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("5182e668-105e-416e-ad92-24ef800424ba")]
public interface IDebugControl
{
/* IDebugControl */
[PreserveSig]
int GetInterrupt();
[PreserveSig]
int SetInterrupt(
[In] DEBUG_INTERRUPT Flags);
[PreserveSig]
int GetInterruptTimeout(
[Out] out UInt32 Seconds);
[PreserveSig]
int SetInterruptTimeout(
[In] UInt32 Seconds);
[PreserveSig]
int GetLogFile(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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] out DEBUG_OUTPUT Mask);
[PreserveSig]
int SetLogMask(
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
int Input(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 InputSize);
[PreserveSig]
int ReturnInput(
[In, MarshalAs(UnmanagedType.LPStr)] string Buffer);
[PreserveSig]
int Output(
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format);
[PreserveSig]
int OutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
int ControlledOutput(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format);
[PreserveSig]
int ControlledOutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
int OutputPrompt(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Format);
[PreserveSig]
int OutputPromptVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
int GetPromptText(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 TextSize);
[PreserveSig]
int OutputCurrentState(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_CURRENT Flags);
[PreserveSig]
int OutputVersionInformation(
[In] DEBUG_OUTCTL OutputControl);
[PreserveSig]
int GetNotifyEventHandle(
[Out] out UInt64 Handle);
[PreserveSig]
int SetNotifyEventHandle(
[In] UInt64 Handle);
[PreserveSig]
int Assemble(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPStr)] string Instr,
[Out] out UInt64 EndOffset);
[PreserveSig]
int Disassemble(
[In] UInt64 Offset,
[In] DEBUG_DISASM Flags,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 DisassemblySize,
[Out] out UInt64 EndOffset);
[PreserveSig]
int GetDisassembleEffectiveOffset(
[Out] out UInt64 Offset);
[PreserveSig]
int OutputDisassembly(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] DEBUG_DISASM Flags,
[Out] out UInt64 EndOffset);
[PreserveSig]
int OutputDisassemblyLines(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt32 PreviousLines,
[In] UInt32 TotalLines,
[In] UInt64 Offset,
[In] DEBUG_DISASM Flags,
[Out] out UInt32 OffsetLine,
[Out] out UInt64 StartOffset,
[Out] out UInt64 EndOffset,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] LineOffsets);
[PreserveSig]
int GetNearInstruction(
[In] UInt64 Offset,
[In] int Delta,
[Out] out UInt64 NearOffset);
[PreserveSig]
int GetStackTrace(
[In] UInt64 FrameOffset,
[In] UInt64 StackOffset,
[In] UInt64 InstructionOffset,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames,
[In] Int32 FrameSize,
[Out] out UInt32 FramesFilled);
[PreserveSig]
int GetReturnOffset(
[Out] out UInt64 Offset);
[PreserveSig]
int OutputStackTrace(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames,
[In] Int32 FramesSize,
[In] DEBUG_STACK Flags);
[PreserveSig]
int GetDebuggeeType(
[Out] out DEBUG_CLASS Class,
[Out] out DEBUG_CLASS_QUALIFIER Qualifier);
[PreserveSig]
int GetActualProcessorType(
[Out] out IMAGE_FILE_MACHINE Type);
[PreserveSig]
int GetExecutingProcessorType(
[Out] out IMAGE_FILE_MACHINE Type);
[PreserveSig]
int GetNumberPossibleExecutingProcessorTypes(
[Out] out UInt32 Number);
[PreserveSig]
int GetPossibleExecutingProcessorTypes(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] IMAGE_FILE_MACHINE[] Types);
[PreserveSig]
int GetNumberProcessors(
[Out] out UInt32 Number);
[PreserveSig]
int GetSystemVersion(
[Out] out UInt32 PlatformId,
[Out] out UInt32 Major,
[Out] out UInt32 Minor,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ServicePackString,
[In] Int32 ServicePackStringSize,
[Out] out UInt32 ServicePackStringUsed,
[Out] out UInt32 ServicePackNumber,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder BuildString,
[In] Int32 BuildStringSize,
[Out] out UInt32 BuildStringUsed);
[PreserveSig]
int GetPageSize(
[Out] out UInt32 Size);
[PreserveSig]
int IsPointer64Bit();
[PreserveSig]
int ReadBugCheckData(
[Out] out UInt32 Code,
[Out] out UInt64 Arg1,
[Out] out UInt64 Arg2,
[Out] out UInt64 Arg3,
[Out] out UInt64 Arg4);
[PreserveSig]
int GetNumberSupportedProcessorTypes(
[Out] out UInt32 Number);
[PreserveSig]
int GetSupportedProcessorTypes(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] IMAGE_FILE_MACHINE[] Types);
[PreserveSig]
int GetProcessorTypeNames(
[In] IMAGE_FILE_MACHINE Type,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer,
[In] Int32 FullNameBufferSize,
[Out] out UInt32 FullNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer,
[In] Int32 AbbrevNameBufferSize,
[Out] out UInt32 AbbrevNameSize);
[PreserveSig]
int GetEffectiveProcessorType(
[Out] out IMAGE_FILE_MACHINE Type);
[PreserveSig]
int SetEffectiveProcessorType(
[In] IMAGE_FILE_MACHINE Type);
[PreserveSig]
int GetExecutionStatus(
[Out] out DEBUG_STATUS Status);
[PreserveSig]
int SetExecutionStatus(
[In] DEBUG_STATUS Status);
[PreserveSig]
int GetCodeLevel(
[Out] out DEBUG_LEVEL Level);
[PreserveSig]
int SetCodeLevel(
[In] DEBUG_LEVEL Level);
[PreserveSig]
int GetEngineOptions(
[Out] out DEBUG_ENGOPT Options);
[PreserveSig]
int AddEngineOptions(
[In] DEBUG_ENGOPT Options);
[PreserveSig]
int RemoveEngineOptions(
[In] DEBUG_ENGOPT Options);
[PreserveSig]
int SetEngineOptions(
[In] DEBUG_ENGOPT Options);
[PreserveSig]
int GetSystemErrorControl(
[Out] out ERROR_LEVEL OutputLevel,
[Out] out ERROR_LEVEL BreakLevel);
[PreserveSig]
int SetSystemErrorControl(
[In] ERROR_LEVEL OutputLevel,
[In] ERROR_LEVEL BreakLevel);
[PreserveSig]
int GetTextMacro(
[In] UInt32 Slot,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 MacroSize);
[PreserveSig]
int SetTextMacro(
[In] UInt32 Slot,
[In, MarshalAs(UnmanagedType.LPStr)] string Macro);
[PreserveSig]
int GetRadix(
[Out] out UInt32 Radix);
[PreserveSig]
int SetRadix(
[In] UInt32 Radix);
[PreserveSig]
int Evaluate(
[In, MarshalAs(UnmanagedType.LPStr)] string Expression,
[In] DEBUG_VALUE_TYPE DesiredType,
[Out] out DEBUG_VALUE Value,
[Out] out UInt32 RemainderIndex);
[PreserveSig]
int CoerceValue(
[In] DEBUG_VALUE In,
[In] DEBUG_VALUE_TYPE OutType,
[Out] out DEBUG_VALUE Out);
[PreserveSig]
int CoerceValues(
[In] UInt32 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(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Command,
[In] DEBUG_EXECUTE Flags);
[PreserveSig]
int ExecuteCommandFile(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandFile,
[In] DEBUG_EXECUTE Flags);
[PreserveSig]
int GetNumberBreakpoints(
[Out] out UInt32 Number);
[PreserveSig]
int GetBreakpointByIndex(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.Interface)] out IDebugBreakpoint bp);
[PreserveSig]
int GetBreakpointById(
[In] UInt32 Id,
[Out, MarshalAs(UnmanagedType.Interface)] out IDebugBreakpoint bp);
[PreserveSig]
int GetBreakpointParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_BREAKPOINT_PARAMETERS[] Params);
[PreserveSig]
int AddBreakpoint(
[In] DEBUG_BREAKPOINT_TYPE Type,
[In] UInt32 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,
[In] UInt32 Flags,
[Out] out UInt64 Handle);
[PreserveSig]
int RemoveExtension(
[In] UInt64 Handle);
[PreserveSig]
int GetExtensionByPath(
[In, MarshalAs(UnmanagedType.LPStr)] string Path,
[Out] out UInt64 Handle);
[PreserveSig]
int CallExtension(
[In] UInt64 Handle,
[In, MarshalAs(UnmanagedType.LPStr)] string Function,
[In, MarshalAs(UnmanagedType.LPStr)] string Arguments);
[PreserveSig]
int GetExtensionFunction(
[In] UInt64 Handle,
[In, MarshalAs(UnmanagedType.LPStr)] string FuncName,
[Out] out IntPtr Function);
[PreserveSig]
int GetWindbgExtensionApis32(
[In, Out] ref WINDBG_EXTENSION_APIS Api);
/* Must be In and Out as the nSize member has to be initialized */
[PreserveSig]
int GetWindbgExtensionApis64(
[In, Out] ref WINDBG_EXTENSION_APIS Api);
/* Must be In and Out as the nSize member has to be initialized */
[PreserveSig]
int GetNumberEventFilters(
[Out] out UInt32 SpecificEvents,
[Out] out UInt32 SpecificExceptions,
[Out] out UInt32 ArbitraryExceptions);
[PreserveSig]
int GetEventFilterText(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 TextSize);
[PreserveSig]
int GetEventFilterCommand(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
int SetEventFilterCommand(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Command);
[PreserveSig]
int GetSpecificFilterParameters(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params);
[PreserveSig]
int SetSpecificFilterParameters(
[In] UInt32 Start,
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params);
[PreserveSig]
int GetSpecificEventFilterArgument(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ArgumentSize);
[PreserveSig]
int SetSpecificEventFilterArgument(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Argument);
[PreserveSig]
int GetExceptionFilterParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Codes,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params);
[PreserveSig]
int SetExceptionFilterParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params);
[PreserveSig]
int GetExceptionFilterSecondCommand(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
int SetExceptionFilterSecondCommand(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Command);
[PreserveSig]
int WaitForEvent(
[In] DEBUG_WAIT Flags,
[In] UInt32 Timeout);
[PreserveSig]
int GetLastEventInformation(
[Out] out DEBUG_EVENT Type,
[Out] out UInt32 ProcessId,
[Out] out UInt32 ThreadId,
[In] IntPtr ExtraInformation,
[In] UInt32 ExtraInformationSize,
[Out] out UInt32 ExtraInformationUsed,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 DescriptionUsed);
}
}

Просмотреть файл

@ -0,0 +1,566 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("d4366723-44df-4bed-8c7e-4c05424f4588")]
public interface IDebugControl2 : IDebugControl
{
/* IDebugControl */
[PreserveSig]
new int GetInterrupt();
[PreserveSig]
new int SetInterrupt(
[In] DEBUG_INTERRUPT Flags);
[PreserveSig]
new int GetInterruptTimeout(
[Out] out UInt32 Seconds);
[PreserveSig]
new int SetInterruptTimeout(
[In] UInt32 Seconds);
[PreserveSig]
new int GetLogFile(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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] out DEBUG_OUTPUT Mask);
[PreserveSig]
new int SetLogMask(
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
new int Input(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 InputSize);
[PreserveSig]
new int ReturnInput(
[In, MarshalAs(UnmanagedType.LPStr)] string Buffer);
[PreserveSig]
new int Output(
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format);
[PreserveSig]
new int OutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
new int ControlledOutput(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format);
[PreserveSig]
new int ControlledOutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
new int OutputPrompt(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Format);
[PreserveSig]
new int OutputPromptVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
new int GetPromptText(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 TextSize);
[PreserveSig]
new int OutputCurrentState(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_CURRENT Flags);
[PreserveSig]
new int OutputVersionInformation(
[In] DEBUG_OUTCTL OutputControl);
[PreserveSig]
new int GetNotifyEventHandle(
[Out] out UInt64 Handle);
[PreserveSig]
new int SetNotifyEventHandle(
[In] UInt64 Handle);
[PreserveSig]
new int Assemble(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPStr)] string Instr,
[Out] out UInt64 EndOffset);
[PreserveSig]
new int Disassemble(
[In] UInt64 Offset,
[In] DEBUG_DISASM Flags,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 DisassemblySize,
[Out] out UInt64 EndOffset);
[PreserveSig]
new int GetDisassembleEffectiveOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int OutputDisassembly(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] DEBUG_DISASM Flags,
[Out] out UInt64 EndOffset);
[PreserveSig]
new int OutputDisassemblyLines(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt32 PreviousLines,
[In] UInt32 TotalLines,
[In] UInt64 Offset,
[In] DEBUG_DISASM Flags,
[Out] out UInt32 OffsetLine,
[Out] out UInt64 StartOffset,
[Out] out UInt64 EndOffset,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] LineOffsets);
[PreserveSig]
new int GetNearInstruction(
[In] UInt64 Offset,
[In] int Delta,
[Out] out UInt64 NearOffset);
[PreserveSig]
new int GetStackTrace(
[In] UInt64 FrameOffset,
[In] UInt64 StackOffset,
[In] UInt64 InstructionOffset,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames,
[In] Int32 FrameSize,
[Out] out UInt32 FramesFilled);
[PreserveSig]
new int GetReturnOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int OutputStackTrace(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames,
[In] Int32 FramesSize,
[In] DEBUG_STACK Flags);
[PreserveSig]
new int GetDebuggeeType(
[Out] out DEBUG_CLASS Class,
[Out] out DEBUG_CLASS_QUALIFIER Qualifier);
[PreserveSig]
new int GetActualProcessorType(
[Out] out IMAGE_FILE_MACHINE Type);
[PreserveSig]
new int GetExecutingProcessorType(
[Out] out IMAGE_FILE_MACHINE Type);
[PreserveSig]
new int GetNumberPossibleExecutingProcessorTypes(
[Out] out UInt32 Number);
[PreserveSig]
new int GetPossibleExecutingProcessorTypes(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] IMAGE_FILE_MACHINE[] Types);
[PreserveSig]
new int GetNumberProcessors(
[Out] out UInt32 Number);
[PreserveSig]
new int GetSystemVersion(
[Out] out UInt32 PlatformId,
[Out] out UInt32 Major,
[Out] out UInt32 Minor,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ServicePackString,
[In] Int32 ServicePackStringSize,
[Out] out UInt32 ServicePackStringUsed,
[Out] out UInt32 ServicePackNumber,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder BuildString,
[In] Int32 BuildStringSize,
[Out] out UInt32 BuildStringUsed);
[PreserveSig]
new int GetPageSize(
[Out] out UInt32 Size);
[PreserveSig]
new int IsPointer64Bit();
[PreserveSig]
new int ReadBugCheckData(
[Out] out UInt32 Code,
[Out] out UInt64 Arg1,
[Out] out UInt64 Arg2,
[Out] out UInt64 Arg3,
[Out] out UInt64 Arg4);
[PreserveSig]
new int GetNumberSupportedProcessorTypes(
[Out] out UInt32 Number);
[PreserveSig]
new int GetSupportedProcessorTypes(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] IMAGE_FILE_MACHINE[] Types);
[PreserveSig]
new int GetProcessorTypeNames(
[In] IMAGE_FILE_MACHINE Type,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer,
[In] Int32 FullNameBufferSize,
[Out] out UInt32 FullNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer,
[In] Int32 AbbrevNameBufferSize,
[Out] out UInt32 AbbrevNameSize);
[PreserveSig]
new int GetEffectiveProcessorType(
[Out] out IMAGE_FILE_MACHINE Type);
[PreserveSig]
new int SetEffectiveProcessorType(
[In] IMAGE_FILE_MACHINE Type);
[PreserveSig]
new int GetExecutionStatus(
[Out] out DEBUG_STATUS Status);
[PreserveSig]
new int SetExecutionStatus(
[In] DEBUG_STATUS Status);
[PreserveSig]
new int GetCodeLevel(
[Out] out DEBUG_LEVEL Level);
[PreserveSig]
new int SetCodeLevel(
[In] DEBUG_LEVEL Level);
[PreserveSig]
new int GetEngineOptions(
[Out] out DEBUG_ENGOPT Options);
[PreserveSig]
new int AddEngineOptions(
[In] DEBUG_ENGOPT Options);
[PreserveSig]
new int RemoveEngineOptions(
[In] DEBUG_ENGOPT Options);
[PreserveSig]
new int SetEngineOptions(
[In] DEBUG_ENGOPT Options);
[PreserveSig]
new int GetSystemErrorControl(
[Out] out ERROR_LEVEL OutputLevel,
[Out] out ERROR_LEVEL BreakLevel);
[PreserveSig]
new int SetSystemErrorControl(
[In] ERROR_LEVEL OutputLevel,
[In] ERROR_LEVEL BreakLevel);
[PreserveSig]
new int GetTextMacro(
[In] UInt32 Slot,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 MacroSize);
[PreserveSig]
new int SetTextMacro(
[In] UInt32 Slot,
[In, MarshalAs(UnmanagedType.LPStr)] string Macro);
[PreserveSig]
new int GetRadix(
[Out] out UInt32 Radix);
[PreserveSig]
new int SetRadix(
[In] UInt32 Radix);
[PreserveSig]
new int Evaluate(
[In, MarshalAs(UnmanagedType.LPStr)] string Expression,
[In] DEBUG_VALUE_TYPE DesiredType,
[Out] out DEBUG_VALUE Value,
[Out] out UInt32 RemainderIndex);
[PreserveSig]
new int CoerceValue(
[In] DEBUG_VALUE In,
[In] DEBUG_VALUE_TYPE OutType,
[Out] out DEBUG_VALUE Out);
[PreserveSig]
new int CoerceValues(
[In] UInt32 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(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Command,
[In] DEBUG_EXECUTE Flags);
[PreserveSig]
new int ExecuteCommandFile(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandFile,
[In] DEBUG_EXECUTE Flags);
[PreserveSig]
new int GetNumberBreakpoints(
[Out] out UInt32 Number);
[PreserveSig]
new int GetBreakpointByIndex(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.Interface)] out IDebugBreakpoint bp);
[PreserveSig]
new int GetBreakpointById(
[In] UInt32 Id,
[Out, MarshalAs(UnmanagedType.Interface)] out IDebugBreakpoint bp);
[PreserveSig]
new int GetBreakpointParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_BREAKPOINT_PARAMETERS[] Params);
[PreserveSig]
new int AddBreakpoint(
[In] DEBUG_BREAKPOINT_TYPE Type,
[In] UInt32 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,
[In] UInt32 Flags,
[Out] out UInt64 Handle);
[PreserveSig]
new int RemoveExtension(
[In] UInt64 Handle);
[PreserveSig]
new int GetExtensionByPath(
[In, MarshalAs(UnmanagedType.LPStr)] string Path,
[Out] out UInt64 Handle);
[PreserveSig]
new int CallExtension(
[In] UInt64 Handle,
[In, MarshalAs(UnmanagedType.LPStr)] string Function,
[In, MarshalAs(UnmanagedType.LPStr)] string Arguments);
[PreserveSig]
new int GetExtensionFunction(
[In] UInt64 Handle,
[In, MarshalAs(UnmanagedType.LPStr)] string FuncName,
[Out] out IntPtr Function);
[PreserveSig]
new int GetWindbgExtensionApis32(
[In, Out] ref WINDBG_EXTENSION_APIS Api);
/* Must be In and Out as the nSize member has to be initialized */
[PreserveSig]
new int GetWindbgExtensionApis64(
[In, Out] ref WINDBG_EXTENSION_APIS Api);
/* Must be In and Out as the nSize member has to be initialized */
[PreserveSig]
new int GetNumberEventFilters(
[Out] out UInt32 SpecificEvents,
[Out] out UInt32 SpecificExceptions,
[Out] out UInt32 ArbitraryExceptions);
[PreserveSig]
new int GetEventFilterText(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 TextSize);
[PreserveSig]
new int GetEventFilterCommand(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
new int SetEventFilterCommand(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Command);
[PreserveSig]
new int GetSpecificFilterParameters(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params);
[PreserveSig]
new int SetSpecificFilterParameters(
[In] UInt32 Start,
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params);
[PreserveSig]
new int GetSpecificEventFilterArgument(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ArgumentSize);
[PreserveSig]
new int SetSpecificEventFilterArgument(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Argument);
[PreserveSig]
new int GetExceptionFilterParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Codes,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params);
[PreserveSig]
new int SetExceptionFilterParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params);
[PreserveSig]
new int GetExceptionFilterSecondCommand(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
new int SetExceptionFilterSecondCommand(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Command);
[PreserveSig]
new int WaitForEvent(
[In] DEBUG_WAIT Flags,
[In] UInt32 Timeout);
[PreserveSig]
new int GetLastEventInformation(
[Out] out DEBUG_EVENT Type,
[Out] out UInt32 ProcessId,
[Out] out UInt32 ThreadId,
[In] IntPtr ExtraInformation,
[In] UInt32 ExtraInformationSize,
[Out] out UInt32 ExtraInformationUsed,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 DescriptionUsed);
/* IDebugControl2 */
[PreserveSig]
int GetCurrentTimeDate(
[Out] out UInt32 TimeDate);
[PreserveSig]
int GetCurrentSystemUpTime(
[Out] out UInt32 UpTime);
[PreserveSig]
int GetDumpFormatFlags(
[Out] out DEBUG_FORMAT FormatFlags);
[PreserveSig]
int GetNumberTextReplacements(
[Out] out UInt32 NumRepl);
[PreserveSig]
int GetTextReplacement(
[In, MarshalAs(UnmanagedType.LPStr)] string SrcText,
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder SrcBuffer,
[In] Int32 SrcBufferSize,
[Out] out UInt32 SrcSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder DstBuffer,
[In] Int32 DstBufferSize,
[Out] out UInt32 DstSize);
[PreserveSig]
int SetTextReplacement(
[In, MarshalAs(UnmanagedType.LPStr)] string SrcText,
[In, MarshalAs(UnmanagedType.LPStr)] string DstText);
[PreserveSig]
int RemoveTextReplacements();
[PreserveSig]
int OutputTextReplacements(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUT_TEXT_REPL Flags);
}
}

Просмотреть файл

@ -0,0 +1,590 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("7df74a86-b03f-407f-90ab-a20dadcead08")]
public interface IDebugControl3 : IDebugControl2
{
/* IDebugControl */
[PreserveSig]
new int GetInterrupt();
[PreserveSig]
new int SetInterrupt(
[In] DEBUG_INTERRUPT Flags);
[PreserveSig]
new int GetInterruptTimeout(
[Out] out UInt32 Seconds);
[PreserveSig]
new int SetInterruptTimeout(
[In] UInt32 Seconds);
[PreserveSig]
new int GetLogFile(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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] out DEBUG_OUTPUT Mask);
[PreserveSig]
new int SetLogMask(
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
new int Input(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 InputSize);
[PreserveSig]
new int ReturnInput(
[In, MarshalAs(UnmanagedType.LPStr)] string Buffer);
[PreserveSig]
new int Output(
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format);
[PreserveSig]
new int OutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
new int ControlledOutput(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format);
[PreserveSig]
new int ControlledOutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
new int OutputPrompt(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Format);
[PreserveSig]
new int OutputPromptVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
new int GetPromptText(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 TextSize);
[PreserveSig]
new int OutputCurrentState(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_CURRENT Flags);
[PreserveSig]
new int OutputVersionInformation(
[In] DEBUG_OUTCTL OutputControl);
[PreserveSig]
new int GetNotifyEventHandle(
[Out] out UInt64 Handle);
[PreserveSig]
new int SetNotifyEventHandle(
[In] UInt64 Handle);
[PreserveSig]
new int Assemble(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPStr)] string Instr,
[Out] out UInt64 EndOffset);
[PreserveSig]
new int Disassemble(
[In] UInt64 Offset,
[In] DEBUG_DISASM Flags,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 DisassemblySize,
[Out] out UInt64 EndOffset);
[PreserveSig]
new int GetDisassembleEffectiveOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int OutputDisassembly(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] DEBUG_DISASM Flags,
[Out] out UInt64 EndOffset);
[PreserveSig]
new int OutputDisassemblyLines(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt32 PreviousLines,
[In] UInt32 TotalLines,
[In] UInt64 Offset,
[In] DEBUG_DISASM Flags,
[Out] out UInt32 OffsetLine,
[Out] out UInt64 StartOffset,
[Out] out UInt64 EndOffset,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] LineOffsets);
[PreserveSig]
new int GetNearInstruction(
[In] UInt64 Offset,
[In] int Delta,
[Out] out UInt64 NearOffset);
[PreserveSig]
new int GetStackTrace(
[In] UInt64 FrameOffset,
[In] UInt64 StackOffset,
[In] UInt64 InstructionOffset,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames,
[In] Int32 FrameSize,
[Out] out UInt32 FramesFilled);
[PreserveSig]
new int GetReturnOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int OutputStackTrace(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames,
[In] Int32 FramesSize,
[In] DEBUG_STACK Flags);
[PreserveSig]
new int GetDebuggeeType(
[Out] out DEBUG_CLASS Class,
[Out] out DEBUG_CLASS_QUALIFIER Qualifier);
[PreserveSig]
new int GetActualProcessorType(
[Out] out IMAGE_FILE_MACHINE Type);
[PreserveSig]
new int GetExecutingProcessorType(
[Out] out IMAGE_FILE_MACHINE Type);
[PreserveSig]
new int GetNumberPossibleExecutingProcessorTypes(
[Out] out UInt32 Number);
[PreserveSig]
new int GetPossibleExecutingProcessorTypes(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] IMAGE_FILE_MACHINE[] Types);
[PreserveSig]
new int GetNumberProcessors(
[Out] out UInt32 Number);
[PreserveSig]
new int GetSystemVersion(
[Out] out UInt32 PlatformId,
[Out] out UInt32 Major,
[Out] out UInt32 Minor,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ServicePackString,
[In] Int32 ServicePackStringSize,
[Out] out UInt32 ServicePackStringUsed,
[Out] out UInt32 ServicePackNumber,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder BuildString,
[In] Int32 BuildStringSize,
[Out] out UInt32 BuildStringUsed);
[PreserveSig]
new int GetPageSize(
[Out] out UInt32 Size);
[PreserveSig]
new int IsPointer64Bit();
[PreserveSig]
new int ReadBugCheckData(
[Out] out UInt32 Code,
[Out] out UInt64 Arg1,
[Out] out UInt64 Arg2,
[Out] out UInt64 Arg3,
[Out] out UInt64 Arg4);
[PreserveSig]
new int GetNumberSupportedProcessorTypes(
[Out] out UInt32 Number);
[PreserveSig]
new int GetSupportedProcessorTypes(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] IMAGE_FILE_MACHINE[] Types);
[PreserveSig]
new int GetProcessorTypeNames(
[In] IMAGE_FILE_MACHINE Type,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer,
[In] Int32 FullNameBufferSize,
[Out] out UInt32 FullNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer,
[In] Int32 AbbrevNameBufferSize,
[Out] out UInt32 AbbrevNameSize);
[PreserveSig]
new int GetEffectiveProcessorType(
[Out] out IMAGE_FILE_MACHINE Type);
[PreserveSig]
new int SetEffectiveProcessorType(
[In] IMAGE_FILE_MACHINE Type);
[PreserveSig]
new int GetExecutionStatus(
[Out] out DEBUG_STATUS Status);
[PreserveSig]
new int SetExecutionStatus(
[In] DEBUG_STATUS Status);
[PreserveSig]
new int GetCodeLevel(
[Out] out DEBUG_LEVEL Level);
[PreserveSig]
new int SetCodeLevel(
[In] DEBUG_LEVEL Level);
[PreserveSig]
new int GetEngineOptions(
[Out] out DEBUG_ENGOPT Options);
[PreserveSig]
new int AddEngineOptions(
[In] DEBUG_ENGOPT Options);
[PreserveSig]
new int RemoveEngineOptions(
[In] DEBUG_ENGOPT Options);
[PreserveSig]
new int SetEngineOptions(
[In] DEBUG_ENGOPT Options);
[PreserveSig]
new int GetSystemErrorControl(
[Out] out ERROR_LEVEL OutputLevel,
[Out] out ERROR_LEVEL BreakLevel);
[PreserveSig]
new int SetSystemErrorControl(
[In] ERROR_LEVEL OutputLevel,
[In] ERROR_LEVEL BreakLevel);
[PreserveSig]
new int GetTextMacro(
[In] UInt32 Slot,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 MacroSize);
[PreserveSig]
new int SetTextMacro(
[In] UInt32 Slot,
[In, MarshalAs(UnmanagedType.LPStr)] string Macro);
[PreserveSig]
new int GetRadix(
[Out] out UInt32 Radix);
[PreserveSig]
new int SetRadix(
[In] UInt32 Radix);
[PreserveSig]
new int Evaluate(
[In, MarshalAs(UnmanagedType.LPStr)] string Expression,
[In] DEBUG_VALUE_TYPE DesiredType,
[Out] out DEBUG_VALUE Value,
[Out] out UInt32 RemainderIndex);
[PreserveSig]
new int CoerceValue(
[In] DEBUG_VALUE In,
[In] DEBUG_VALUE_TYPE OutType,
[Out] out DEBUG_VALUE Out);
[PreserveSig]
new int CoerceValues(
[In] UInt32 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(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Command,
[In] DEBUG_EXECUTE Flags);
[PreserveSig]
new int ExecuteCommandFile(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandFile,
[In] DEBUG_EXECUTE Flags);
[PreserveSig]
new int GetNumberBreakpoints(
[Out] out UInt32 Number);
[PreserveSig]
new int GetBreakpointByIndex(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.Interface)] out IDebugBreakpoint bp);
[PreserveSig]
new int GetBreakpointById(
[In] UInt32 Id,
[Out, MarshalAs(UnmanagedType.Interface)] out IDebugBreakpoint bp);
[PreserveSig]
new int GetBreakpointParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_BREAKPOINT_PARAMETERS[] Params);
[PreserveSig]
new int AddBreakpoint(
[In] DEBUG_BREAKPOINT_TYPE Type,
[In] UInt32 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,
[In] UInt32 Flags,
[Out] out UInt64 Handle);
[PreserveSig]
new int RemoveExtension(
[In] UInt64 Handle);
[PreserveSig]
new int GetExtensionByPath(
[In, MarshalAs(UnmanagedType.LPStr)] string Path,
[Out] out UInt64 Handle);
[PreserveSig]
new int CallExtension(
[In] UInt64 Handle,
[In, MarshalAs(UnmanagedType.LPStr)] string Function,
[In, MarshalAs(UnmanagedType.LPStr)] string Arguments);
[PreserveSig]
new int GetExtensionFunction(
[In] UInt64 Handle,
[In, MarshalAs(UnmanagedType.LPStr)] string FuncName,
[Out] out IntPtr Function);
[PreserveSig]
new int GetWindbgExtensionApis32(
[In, Out] ref WINDBG_EXTENSION_APIS Api);
/* Must be In and Out as the nSize member has to be initialized */
[PreserveSig]
new int GetWindbgExtensionApis64(
[In, Out] ref WINDBG_EXTENSION_APIS Api);
/* Must be In and Out as the nSize member has to be initialized */
[PreserveSig]
new int GetNumberEventFilters(
[Out] out UInt32 SpecificEvents,
[Out] out UInt32 SpecificExceptions,
[Out] out UInt32 ArbitraryExceptions);
[PreserveSig]
new int GetEventFilterText(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 TextSize);
[PreserveSig]
new int GetEventFilterCommand(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
new int SetEventFilterCommand(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Command);
[PreserveSig]
new int GetSpecificFilterParameters(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params);
[PreserveSig]
new int SetSpecificFilterParameters(
[In] UInt32 Start,
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params);
[PreserveSig]
new int GetSpecificEventFilterArgument(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ArgumentSize);
[PreserveSig]
new int SetSpecificEventFilterArgument(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Argument);
[PreserveSig]
new int GetExceptionFilterParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Codes,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params);
[PreserveSig]
new int SetExceptionFilterParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params);
[PreserveSig]
new int GetExceptionFilterSecondCommand(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
new int SetExceptionFilterSecondCommand(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Command);
[PreserveSig]
new int WaitForEvent(
[In] DEBUG_WAIT Flags,
[In] UInt32 Timeout);
[PreserveSig]
new int GetLastEventInformation(
[Out] out DEBUG_EVENT Type,
[Out] out UInt32 ProcessId,
[Out] out UInt32 ThreadId,
[In] IntPtr ExtraInformation,
[In] UInt32 ExtraInformationSize,
[Out] out UInt32 ExtraInformationUsed,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 DescriptionUsed);
/* IDebugControl3 */
[PreserveSig]
int GetAssemblyOptions(
[Out] out DEBUG_ASMOPT Options);
[PreserveSig]
int AddAssemblyOptions(
[In] DEBUG_ASMOPT Options);
[PreserveSig]
int RemoveAssemblyOptions(
[In] DEBUG_ASMOPT Options);
[PreserveSig]
int SetAssemblyOptions(
[In] DEBUG_ASMOPT Options);
[PreserveSig]
int GetExpressionSyntax(
[Out] out DEBUG_EXPR Flags);
[PreserveSig]
int SetExpressionSyntax(
[In] DEBUG_EXPR Flags);
[PreserveSig]
int SetExpressionSyntaxByName(
[In, MarshalAs(UnmanagedType.LPStr)] string AbbrevName);
[PreserveSig]
int GetNumberExpressionSyntaxes(
[Out] out UInt32 Number);
[PreserveSig]
int GetExpressionSyntaxNames(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer,
[In] Int32 FullNameBufferSize,
[Out] out UInt32 FullNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer,
[In] Int32 AbbrevNameBufferSize,
[Out] out UInt32 AbbrevNameSize);
[PreserveSig]
int GetNumberEvents(
[Out] out UInt32 Events);
[PreserveSig]
int GetEventIndexDescription(
[In] UInt32 Index,
[In] DEBUG_EINDEX Which,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 DescSize);
[PreserveSig]
int GetCurrentEventIndex(
[Out] out UInt32 Index);
[PreserveSig]
int SetNextEventIndex(
[In] DEBUG_EINDEX Relation,
[In] UInt32 Value,
[Out] out UInt32 NextIndex);
}
}

Просмотреть файл

@ -0,0 +1,988 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("94e60ce9-9b41-4b19-9fc0-6d9eb35272b3")]
public interface IDebugControl4 : IDebugControl3
{
/* IDebugControl */
[PreserveSig]
new int GetInterrupt();
[PreserveSig]
new int SetInterrupt(
[In] DEBUG_INTERRUPT Flags);
[PreserveSig]
new int GetInterruptTimeout(
[Out] out UInt32 Seconds);
[PreserveSig]
new int SetInterruptTimeout(
[In] UInt32 Seconds);
[PreserveSig]
new int GetLogFile(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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] out DEBUG_OUTPUT Mask);
[PreserveSig]
new int SetLogMask(
[In] DEBUG_OUTPUT Mask);
[PreserveSig]
new int Input(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 InputSize);
[PreserveSig]
new int ReturnInput(
[In, MarshalAs(UnmanagedType.LPStr)] string Buffer);
[PreserveSig]
new int Output(
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format);
[PreserveSig]
new int OutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
new int ControlledOutput(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format);
[PreserveSig]
new int ControlledOutputVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
new int OutputPrompt(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Format);
[PreserveSig]
new int OutputPromptVaList( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
new int GetPromptText(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 TextSize);
[PreserveSig]
new int OutputCurrentState(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_CURRENT Flags);
[PreserveSig]
new int OutputVersionInformation(
[In] DEBUG_OUTCTL OutputControl);
[PreserveSig]
new int GetNotifyEventHandle(
[Out] out UInt64 Handle);
[PreserveSig]
new int SetNotifyEventHandle(
[In] UInt64 Handle);
[PreserveSig]
new int Assemble(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPStr)] string Instr,
[Out] out UInt64 EndOffset);
[PreserveSig]
new int Disassemble(
[In] UInt64 Offset,
[In] DEBUG_DISASM Flags,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 DisassemblySize,
[Out] out UInt64 EndOffset);
[PreserveSig]
new int GetDisassembleEffectiveOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int OutputDisassembly(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] DEBUG_DISASM Flags,
[Out] out UInt64 EndOffset);
[PreserveSig]
new int OutputDisassemblyLines(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt32 PreviousLines,
[In] UInt32 TotalLines,
[In] UInt64 Offset,
[In] DEBUG_DISASM Flags,
[Out] out UInt32 OffsetLine,
[Out] out UInt64 StartOffset,
[Out] out UInt64 EndOffset,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] LineOffsets);
[PreserveSig]
new int GetNearInstruction(
[In] UInt64 Offset,
[In] int Delta,
[Out] out UInt64 NearOffset);
[PreserveSig]
new int GetStackTrace(
[In] UInt64 FrameOffset,
[In] UInt64 StackOffset,
[In] UInt64 InstructionOffset,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames,
[In] Int32 FrameSize,
[Out] out UInt32 FramesFilled);
[PreserveSig]
new int GetReturnOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int OutputStackTrace(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames,
[In] Int32 FramesSize,
[In] DEBUG_STACK Flags);
[PreserveSig]
new int GetDebuggeeType(
[Out] out DEBUG_CLASS Class,
[Out] out DEBUG_CLASS_QUALIFIER Qualifier);
[PreserveSig]
new int GetActualProcessorType(
[Out] out IMAGE_FILE_MACHINE Type);
[PreserveSig]
new int GetExecutingProcessorType(
[Out] out IMAGE_FILE_MACHINE Type);
[PreserveSig]
new int GetNumberPossibleExecutingProcessorTypes(
[Out] out UInt32 Number);
[PreserveSig]
new int GetPossibleExecutingProcessorTypes(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] IMAGE_FILE_MACHINE[] Types);
[PreserveSig]
new int GetNumberProcessors(
[Out] out UInt32 Number);
[PreserveSig]
new int GetSystemVersion(
[Out] out UInt32 PlatformId,
[Out] out UInt32 Major,
[Out] out UInt32 Minor,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ServicePackString,
[In] Int32 ServicePackStringSize,
[Out] out UInt32 ServicePackStringUsed,
[Out] out UInt32 ServicePackNumber,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder BuildString,
[In] Int32 BuildStringSize,
[Out] out UInt32 BuildStringUsed);
[PreserveSig]
new int GetPageSize(
[Out] out UInt32 Size);
[PreserveSig]
new int IsPointer64Bit();
[PreserveSig]
new int ReadBugCheckData(
[Out] out UInt32 Code,
[Out] out UInt64 Arg1,
[Out] out UInt64 Arg2,
[Out] out UInt64 Arg3,
[Out] out UInt64 Arg4);
[PreserveSig]
new int GetNumberSupportedProcessorTypes(
[Out] out UInt32 Number);
[PreserveSig]
new int GetSupportedProcessorTypes(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] IMAGE_FILE_MACHINE[] Types);
[PreserveSig]
new int GetProcessorTypeNames(
[In] IMAGE_FILE_MACHINE Type,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer,
[In] Int32 FullNameBufferSize,
[Out] out UInt32 FullNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer,
[In] Int32 AbbrevNameBufferSize,
[Out] out UInt32 AbbrevNameSize);
[PreserveSig]
new int GetEffectiveProcessorType(
[Out] out IMAGE_FILE_MACHINE Type);
[PreserveSig]
new int SetEffectiveProcessorType(
[In] IMAGE_FILE_MACHINE Type);
[PreserveSig]
new int GetExecutionStatus(
[Out] out DEBUG_STATUS Status);
[PreserveSig]
new int SetExecutionStatus(
[In] DEBUG_STATUS Status);
[PreserveSig]
new int GetCodeLevel(
[Out] out DEBUG_LEVEL Level);
[PreserveSig]
new int SetCodeLevel(
[In] DEBUG_LEVEL Level);
[PreserveSig]
new int GetEngineOptions(
[Out] out DEBUG_ENGOPT Options);
[PreserveSig]
new int AddEngineOptions(
[In] DEBUG_ENGOPT Options);
[PreserveSig]
new int RemoveEngineOptions(
[In] DEBUG_ENGOPT Options);
[PreserveSig]
new int SetEngineOptions(
[In] DEBUG_ENGOPT Options);
[PreserveSig]
new int GetSystemErrorControl(
[Out] out ERROR_LEVEL OutputLevel,
[Out] out ERROR_LEVEL BreakLevel);
[PreserveSig]
new int SetSystemErrorControl(
[In] ERROR_LEVEL OutputLevel,
[In] ERROR_LEVEL BreakLevel);
[PreserveSig]
new int GetTextMacro(
[In] UInt32 Slot,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 MacroSize);
[PreserveSig]
new int SetTextMacro(
[In] UInt32 Slot,
[In, MarshalAs(UnmanagedType.LPStr)] string Macro);
[PreserveSig]
new int GetRadix(
[Out] out UInt32 Radix);
[PreserveSig]
new int SetRadix(
[In] UInt32 Radix);
[PreserveSig]
new int Evaluate(
[In, MarshalAs(UnmanagedType.LPStr)] string Expression,
[In] DEBUG_VALUE_TYPE DesiredType,
[Out] out DEBUG_VALUE Value,
[Out] out UInt32 RemainderIndex);
[PreserveSig]
new int CoerceValue(
[In] DEBUG_VALUE In,
[In] DEBUG_VALUE_TYPE OutType,
[Out] out DEBUG_VALUE Out);
[PreserveSig]
new int CoerceValues(
[In] UInt32 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(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string Command,
[In] DEBUG_EXECUTE Flags);
[PreserveSig]
new int ExecuteCommandFile(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPStr)] string CommandFile,
[In] DEBUG_EXECUTE Flags);
[PreserveSig]
new int GetNumberBreakpoints(
[Out] out UInt32 Number);
[PreserveSig]
new int GetBreakpointByIndex(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.Interface)] out IDebugBreakpoint bp);
[PreserveSig]
new int GetBreakpointById(
[In] UInt32 Id,
[Out, MarshalAs(UnmanagedType.Interface)] out IDebugBreakpoint bp);
[PreserveSig]
new int GetBreakpointParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_BREAKPOINT_PARAMETERS[] Params);
[PreserveSig]
new int AddBreakpoint(
[In] DEBUG_BREAKPOINT_TYPE Type,
[In] UInt32 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,
[In] UInt32 Flags,
[Out] out UInt64 Handle);
[PreserveSig]
new int RemoveExtension(
[In] UInt64 Handle);
[PreserveSig]
new int GetExtensionByPath(
[In, MarshalAs(UnmanagedType.LPStr)] string Path,
[Out] out UInt64 Handle);
[PreserveSig]
new int CallExtension(
[In] UInt64 Handle,
[In, MarshalAs(UnmanagedType.LPStr)] string Function,
[In, MarshalAs(UnmanagedType.LPStr)] string Arguments);
[PreserveSig]
new int GetExtensionFunction(
[In] UInt64 Handle,
[In, MarshalAs(UnmanagedType.LPStr)] string FuncName,
[Out] out IntPtr Function);
[PreserveSig]
new int GetWindbgExtensionApis32(
[In, Out] ref WINDBG_EXTENSION_APIS Api);
/* Must be In and Out as the nSize member has to be initialized */
[PreserveSig]
new int GetWindbgExtensionApis64(
[In, Out] ref WINDBG_EXTENSION_APIS Api);
/* Must be In and Out as the nSize member has to be initialized */
[PreserveSig]
new int GetNumberEventFilters(
[Out] out UInt32 SpecificEvents,
[Out] out UInt32 SpecificExceptions,
[Out] out UInt32 ArbitraryExceptions);
[PreserveSig]
new int GetEventFilterText(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 TextSize);
[PreserveSig]
new int GetEventFilterCommand(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
new int SetEventFilterCommand(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Command);
[PreserveSig]
new int GetSpecificFilterParameters(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params);
[PreserveSig]
new int SetSpecificFilterParameters(
[In] UInt32 Start,
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_SPECIFIC_FILTER_PARAMETERS[] Params);
[PreserveSig]
new int GetSpecificEventFilterArgument(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ArgumentSize);
[PreserveSig]
new int SetSpecificEventFilterArgument(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Argument);
[PreserveSig]
new int GetExceptionFilterParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Codes,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params);
[PreserveSig]
new int SetExceptionFilterParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_EXCEPTION_FILTER_PARAMETERS[] Params);
[PreserveSig]
new int GetExceptionFilterSecondCommand(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
new int SetExceptionFilterSecondCommand(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Command);
[PreserveSig]
new int WaitForEvent(
[In] DEBUG_WAIT Flags,
[In] UInt32 Timeout);
[PreserveSig]
new int GetLastEventInformation(
[Out] out DEBUG_EVENT Type,
[Out] out UInt32 ProcessId,
[Out] out UInt32 ThreadId,
[In] IntPtr ExtraInformation,
[In] UInt32 ExtraInformationSize,
[Out] out UInt32 ExtraInformationUsed,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 DescriptionUsed);
/* IDebugControl2 */
[PreserveSig]
new int GetCurrentTimeDate(
[Out] out UInt32 TimeDate);
[PreserveSig]
new int GetCurrentSystemUpTime(
[Out] out UInt32 UpTime);
[PreserveSig]
new int GetDumpFormatFlags(
[Out] out DEBUG_FORMAT FormatFlags);
[PreserveSig]
new int GetNumberTextReplacements(
[Out] out UInt32 NumRepl);
[PreserveSig]
new int GetTextReplacement(
[In, MarshalAs(UnmanagedType.LPStr)] string SrcText,
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder SrcBuffer,
[In] Int32 SrcBufferSize,
[Out] out UInt32 SrcSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder DstBuffer,
[In] Int32 DstBufferSize,
[Out] out UInt32 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(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUT_TEXT_REPL Flags);
/* IDebugControl3 */
[PreserveSig]
new int GetAssemblyOptions(
[Out] out DEBUG_ASMOPT Options);
[PreserveSig]
new int AddAssemblyOptions(
[In] DEBUG_ASMOPT Options);
[PreserveSig]
new int RemoveAssemblyOptions(
[In] DEBUG_ASMOPT Options);
[PreserveSig]
new int SetAssemblyOptions(
[In] DEBUG_ASMOPT Options);
[PreserveSig]
new int GetExpressionSyntax(
[Out] out DEBUG_EXPR Flags);
[PreserveSig]
new int SetExpressionSyntax(
[In] DEBUG_EXPR Flags);
[PreserveSig]
new int SetExpressionSyntaxByName(
[In, MarshalAs(UnmanagedType.LPStr)] string AbbrevName);
[PreserveSig]
new int GetNumberExpressionSyntaxes(
[Out] out UInt32 Number);
[PreserveSig]
new int GetExpressionSyntaxNames(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder FullNameBuffer,
[In] Int32 FullNameBufferSize,
[Out] out UInt32 FullNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder AbbrevNameBuffer,
[In] Int32 AbbrevNameBufferSize,
[Out] out UInt32 AbbrevNameSize);
[PreserveSig]
new int GetNumberEvents(
[Out] out UInt32 Events);
[PreserveSig]
new int GetEventIndexDescription(
[In] UInt32 Index,
[In] DEBUG_EINDEX Which,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 DescSize);
[PreserveSig]
new int GetCurrentEventIndex(
[Out] out UInt32 Index);
[PreserveSig]
new int SetNextEventIndex(
[In] DEBUG_EINDEX Relation,
[In] UInt32 Value,
[Out] out UInt32 NextIndex);
/* IDebugControl4 */
[PreserveSig]
int GetLogFileWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 InputSize);
[PreserveSig]
int ReturnInputWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Buffer);
[PreserveSig]
int OutputWide(
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPWStr)] string Format);
[PreserveSig]
int OutputVaListWide( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPWStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
int ControlledOutputWide(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPWStr)] string Format);
[PreserveSig]
int ControlledOutputVaListWide( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPWStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
int OutputPromptWide(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPWStr)] string Format);
[PreserveSig]
int OutputPromptVaListWide( /* THIS SHOULD NEVER BE CALLED FROM C# */
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPWStr)] string Format,
[In] IntPtr va_list_Args);
[PreserveSig]
int GetPromptTextWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 TextSize);
[PreserveSig]
int AssembleWide(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPWStr)] string Instr,
[Out] out UInt64 EndOffset);
[PreserveSig]
int DisassembleWide(
[In] UInt64 Offset,
[In] DEBUG_DISASM Flags,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 DisassemblySize,
[Out] out UInt64 EndOffset);
[PreserveSig]
int GetProcessorTypeNamesWide(
[In] IMAGE_FILE_MACHINE Type,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder FullNameBuffer,
[In] Int32 FullNameBufferSize,
[Out] out UInt32 FullNameSize,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder AbbrevNameBuffer,
[In] Int32 AbbrevNameBufferSize,
[Out] out UInt32 AbbrevNameSize);
[PreserveSig]
int GetTextMacroWide(
[In] UInt32 Slot,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 MacroSize);
[PreserveSig]
int SetTextMacroWide(
[In] UInt32 Slot,
[In, MarshalAs(UnmanagedType.LPWStr)] string Macro);
[PreserveSig]
int EvaluateWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Expression,
[In] DEBUG_VALUE_TYPE DesiredType,
[Out] out DEBUG_VALUE Value,
[Out] out UInt32 RemainderIndex);
[PreserveSig]
int ExecuteWide(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPWStr)] string Command,
[In] DEBUG_EXECUTE Flags);
[PreserveSig]
int ExecuteCommandFileWide(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPWStr)] string CommandFile,
[In] DEBUG_EXECUTE Flags);
[PreserveSig]
int GetBreakpointByIndex2(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.Interface)] out IDebugBreakpoint2 bp);
[PreserveSig]
int GetBreakpointById2(
[In] UInt32 Id,
[Out, MarshalAs(UnmanagedType.Interface)] out IDebugBreakpoint2 bp);
[PreserveSig]
int AddBreakpoint2(
[In] DEBUG_BREAKPOINT_TYPE Type,
[In] UInt32 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,
[In] UInt32 Flags,
[Out] out UInt64 Handle);
[PreserveSig]
int GetExtensionByPathWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Path,
[Out] out UInt64 Handle);
[PreserveSig]
int CallExtensionWide(
[In] UInt64 Handle,
[In, MarshalAs(UnmanagedType.LPWStr)] string Function,
[In, MarshalAs(UnmanagedType.LPWStr)] string Arguments);
[PreserveSig]
int GetExtensionFunctionWide(
[In] UInt64 Handle,
[In, MarshalAs(UnmanagedType.LPWStr)] string FuncName,
[Out] out IntPtr Function);
[PreserveSig]
int GetEventFilterTextWide(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 TextSize);
[PreserveSig]
int GetEventFilterCommandWide(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
int SetEventFilterCommandWide(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPWStr)] string Command);
[PreserveSig]
int GetSpecificEventFilterArgumentWide(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ArgumentSize);
[PreserveSig]
int SetSpecificEventFilterArgumentWide(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPWStr)] string Argument);
[PreserveSig]
int GetExceptionFilterSecondCommandWide(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 CommandSize);
[PreserveSig]
int SetExceptionFilterSecondCommandWide(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPWStr)] string Command);
[PreserveSig]
int GetLastEventInformationWide(
[Out] out DEBUG_EVENT Type,
[Out] out UInt32 ProcessId,
[Out] out UInt32 ThreadId,
[In] IntPtr ExtraInformation,
[In] Int32 ExtraInformationSize,
[Out] out UInt32 ExtraInformationUsed,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Description,
[In] Int32 DescriptionSize,
[Out] out UInt32 DescriptionUsed);
[PreserveSig]
int GetTextReplacementWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string SrcText,
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder SrcBuffer,
[In] Int32 SrcBufferSize,
[Out] out UInt32 SrcSize,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder DstBuffer,
[In] Int32 DstBufferSize,
[Out] out UInt32 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(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder FullNameBuffer,
[In] Int32 FullNameBufferSize,
[Out] out UInt32 FullNameSize,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder AbbrevNameBuffer,
[In] Int32 AbbrevNameBufferSize,
[Out] out UInt32 AbbrevNameSize);
[PreserveSig]
int GetEventIndexDescriptionWide(
[In] UInt32 Index,
[In] DEBUG_EINDEX Which,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 DescSize);
[PreserveSig]
int GetLogFile2(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 FileSize,
[Out] out DEBUG_LOG Flags);
[PreserveSig]
int OpenLogFile2(
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[Out] out DEBUG_LOG Flags);
[PreserveSig]
int GetLogFile2Wide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 FileSize,
[Out] out DEBUG_LOG Flags);
[PreserveSig]
int OpenLogFile2Wide(
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[Out] out DEBUG_LOG Flags);
[PreserveSig]
int GetSystemVersionValues(
[Out] out UInt32 PlatformId,
[Out] out UInt32 Win32Major,
[Out] out UInt32 Win32Minor,
[Out] out UInt32 KdMajor,
[Out] out UInt32 KdMinor);
[PreserveSig]
int GetSystemVersionString(
[In] DEBUG_SYSVERSTR Which,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize);
[PreserveSig]
int GetSystemVersionStringWide(
[In] DEBUG_SYSVERSTR Which,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize);
[PreserveSig]
int GetContextStackTrace(
[In] IntPtr StartContext,
[In] UInt32 StartContextSize,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames,
[In] Int32 FrameSize,
[In] IntPtr FrameContexts,
[In] UInt32 FrameContextsSize,
[In] UInt32 FrameContextsEntrySize,
[Out] out UInt32 FramesFilled);
[PreserveSig]
int OutputContextStackTrace(
[In] DEBUG_OUTCTL OutputControl,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_STACK_FRAME[] Frames,
[In] Int32 FramesSize,
[In] IntPtr FrameContexts,
[In] UInt32 FrameContextsSize,
[In] UInt32 FrameContextsEntrySize,
[In] DEBUG_STACK Flags);
[PreserveSig]
int GetStoredEventInformation(
[Out] out DEBUG_EVENT Type,
[Out] out UInt32 ProcessId,
[Out] out UInt32 ThreadId,
[In] IntPtr Context,
[In] UInt32 ContextSize,
[Out] out UInt32 ContextUsed,
[In] IntPtr ExtraInformation,
[In] UInt32 ExtraInformationSize,
[Out] out UInt32 ExtraInformationUsed);
[PreserveSig]
int GetManagedStatus(
[Out] out DEBUG_MANAGED Flags,
[In] DEBUG_MANSTR WhichString,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder String,
[In] Int32 StringSize,
[Out] out UInt32 StringNeeded);
[PreserveSig]
int GetManagedStatusWide(
[Out] out DEBUG_MANAGED Flags,
[In] DEBUG_MANSTR WhichString,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder String,
[In] Int32 StringSize,
[Out] out UInt32 StringNeeded);
[PreserveSig]
int ResetManagedStatus(
[In] DEBUG_MANRESET Flags);
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,318 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("88f7dfab-3ea7-4c3a-aefb-c4e8106173aa")]
public interface IDebugDataSpaces
{
/* IDebugDataSpaces */
[PreserveSig]
int ReadVirtual(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WriteVirtual(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int SearchVirtual(
[In] UInt64 Offset,
[In] UInt64 Length,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] pattern,
[In] UInt32 PatternSize,
[In] UInt32 PatternGranularity,
[Out] out UInt64 MatchOffset);
[PreserveSig]
int ReadVirtualUncached(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WriteVirtualUncached(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int ReadPointersVirtual(
[In] UInt32 Count,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] UInt64[] Ptrs);
[PreserveSig]
int WritePointersVirtual(
[In] UInt32 Count,
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray)] UInt64[] Ptrs);
[PreserveSig]
int ReadPhysical(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WritePhysical(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int ReadControl(
[In] UInt32 Processor,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WriteControl(
[In] UInt32 Processor,
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int ReadIo(
[In] INTERFACE_TYPE InterfaceType,
[In] UInt32 BusNumber,
[In] UInt32 AddressSpace,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WriteIo(
[In] INTERFACE_TYPE InterfaceType,
[In] UInt32 BusNumber,
[In] UInt32 AddressSpace,
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int ReadMsr(
[In] UInt32 Msr,
[Out] out UInt64 MsrValue);
[PreserveSig]
int WriteMsr(
[In] UInt32 Msr,
[In] UInt64 MsrValue);
[PreserveSig]
int ReadBusData(
[In] BUS_DATA_TYPE BusDataType,
[In] UInt32 BusNumber,
[In] UInt32 SlotNumber,
[In] UInt32 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WriteBusData(
[In] BUS_DATA_TYPE BusDataType,
[In] UInt32 BusNumber,
[In] UInt32 SlotNumber,
[In] UInt32 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int CheckLowMemory();
[PreserveSig]
int ReadDebuggerData(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 DataSize);
[PreserveSig]
int ReadProcessorSystemData(
[In] UInt32 Processor,
[In] DEBUG_DATA Index,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 DataSize);
}
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("88f7dfab-3ea7-4c3a-aefb-c4e8106173aa")]
public interface IDebugDataSpacesPtr
{
/* IDebugDataSpaces */
[PreserveSig]
int ReadVirtual(
[In] UInt64 Offset,
[In] IntPtr buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WriteVirtual(
[In] UInt64 Offset,
[In] IntPtr buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int SearchVirtual(
[In] UInt64 Offset,
[In] UInt64 Length,
[In] IntPtr pattern,
[In] UInt32 PatternSize,
[In] UInt32 PatternGranularity,
[Out] out UInt64 MatchOffset);
[PreserveSig]
int ReadVirtualUncached(
[In] UInt64 Offset,
[In] IntPtr buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WriteVirtualUncached(
[In] UInt64 Offset,
[In] IntPtr buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int ReadPointersVirtual(
[In] UInt32 Count,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] UInt64[] Ptrs);
[PreserveSig]
int WritePointersVirtual(
[In] UInt32 Count,
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray)] UInt64[] Ptrs);
[PreserveSig]
int ReadPhysical(
[In] UInt64 Offset,
[In] IntPtr buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WritePhysical(
[In] UInt64 Offset,
[In] IntPtr buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int ReadControl(
[In] UInt32 Processor,
[In] UInt64 Offset,
[In] IntPtr buffer,
[In] Int32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WriteControl(
[In] UInt32 Processor,
[In] UInt64 Offset,
[In] IntPtr buffer,
[In] Int32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int ReadIo(
[In] INTERFACE_TYPE InterfaceType,
[In] UInt32 BusNumber,
[In] UInt32 AddressSpace,
[In] UInt64 Offset,
[In] IntPtr buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WriteIo(
[In] INTERFACE_TYPE InterfaceType,
[In] UInt32 BusNumber,
[In] UInt32 AddressSpace,
[In] UInt64 Offset,
[In] IntPtr buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int ReadMsr(
[In] UInt32 Msr,
[Out] out UInt64 MsrValue);
[PreserveSig]
int WriteMsr(
[In] UInt32 Msr,
[In] UInt64 MsrValue);
[PreserveSig]
int ReadBusData(
[In] BUS_DATA_TYPE BusDataType,
[In] UInt32 BusNumber,
[In] UInt32 SlotNumber,
[In] UInt32 Offset,
[In] IntPtr buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WriteBusData(
[In] BUS_DATA_TYPE BusDataType,
[In] UInt32 BusNumber,
[In] UInt32 SlotNumber,
[In] UInt32 Offset,
[In] IntPtr buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int CheckLowMemory();
[PreserveSig]
int ReadDebuggerData(
[In] UInt32 Index,
[In] IntPtr buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 DataSize);
[PreserveSig]
int ReadProcessorSystemData(
[In] UInt32 Processor,
[In] DEBUG_DATA Index,
[In] IntPtr buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 DataSize);
}
}

Просмотреть файл

@ -0,0 +1,207 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("7a5e852f-96e9-468f-ac1b-0b3addc4a049")]
public interface IDebugDataSpaces2 : IDebugDataSpaces
{
/* IDebugDataSpaces */
[PreserveSig]
new int ReadVirtual(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteVirtual(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int SearchVirtual(
[In] UInt64 Offset,
[In] UInt64 Length,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] pattern,
[In] UInt32 PatternSize,
[In] UInt32 PatternGranularity,
[Out] out UInt64 MatchOffset);
[PreserveSig]
new int ReadVirtualUncached(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteVirtualUncached(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int ReadPointersVirtual(
[In] UInt32 Count,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] UInt64[] Ptrs);
[PreserveSig]
new int WritePointersVirtual(
[In] UInt32 Count,
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray)] UInt64[] Ptrs);
[PreserveSig]
new int ReadPhysical(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WritePhysical(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int ReadControl(
[In] UInt32 Processor,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteControl(
[In] UInt32 Processor,
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int ReadIo(
[In] INTERFACE_TYPE InterfaceType,
[In] UInt32 BusNumber,
[In] UInt32 AddressSpace,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteIo(
[In] INTERFACE_TYPE InterfaceType,
[In] UInt32 BusNumber,
[In] UInt32 AddressSpace,
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int ReadMsr(
[In] UInt32 Msr,
[Out] out UInt64 MsrValue);
[PreserveSig]
new int WriteMsr(
[In] UInt32 Msr,
[In] UInt64 MsrValue);
[PreserveSig]
new int ReadBusData(
[In] BUS_DATA_TYPE BusDataType,
[In] UInt32 BusNumber,
[In] UInt32 SlotNumber,
[In] UInt32 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteBusData(
[In] BUS_DATA_TYPE BusDataType,
[In] UInt32 BusNumber,
[In] UInt32 SlotNumber,
[In] UInt32 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int CheckLowMemory();
[PreserveSig]
new int ReadDebuggerData(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 DataSize);
[PreserveSig]
new int ReadProcessorSystemData(
[In] UInt32 Processor,
[In] DEBUG_DATA Index,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 DataSize);
/* IDebugDataSpaces2 */
[PreserveSig]
int VirtualToPhysical(
[In] UInt64 Virtual,
[Out] out UInt64 Physical);
[PreserveSig]
int GetVirtualTranslationPhysicalOffsets(
[In] UInt64 Virtual,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Offsets,
[In] UInt32 OffsetsSize,
[Out] out UInt32 Levels);
[PreserveSig]
int ReadHandleData(
[In] UInt64 Handle,
[In] DEBUG_HANDLE_DATA_TYPE DataType,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 DataSize);
[PreserveSig]
int FillVirtual(
[In] UInt64 Start,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 PatternSize,
[Out] out UInt32 Filled);
[PreserveSig]
int FillPhysical(
[In] UInt64 Start,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 PatternSize,
[Out] out UInt32 Filled);
[PreserveSig]
int QueryVirtual(
[In] UInt64 Offset,
[Out] out MEMORY_BASIC_INFORMATION64 Info);
}
}

Просмотреть файл

@ -0,0 +1,236 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("23f79d6c-8aaf-4f7c-a607-9995f5407e63")]
public interface IDebugDataSpaces3 : IDebugDataSpaces2
{
/* IDebugDataSpaces */
[PreserveSig]
new int ReadVirtual(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteVirtual(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int SearchVirtual(
[In] UInt64 Offset,
[In] UInt64 Length,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] pattern,
[In] UInt32 PatternSize,
[In] UInt32 PatternGranularity,
[Out] out UInt64 MatchOffset);
[PreserveSig]
new int ReadVirtualUncached(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteVirtualUncached(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int ReadPointersVirtual(
[In] UInt32 Count,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] UInt64[] Ptrs);
[PreserveSig]
new int WritePointersVirtual(
[In] UInt32 Count,
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray)] UInt64[] Ptrs);
[PreserveSig]
new int ReadPhysical(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WritePhysical(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int ReadControl(
[In] UInt32 Processor,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteControl(
[In] UInt32 Processor,
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int ReadIo(
[In] INTERFACE_TYPE InterfaceType,
[In] UInt32 BusNumber,
[In] UInt32 AddressSpace,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteIo(
[In] INTERFACE_TYPE InterfaceType,
[In] UInt32 BusNumber,
[In] UInt32 AddressSpace,
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int ReadMsr(
[In] UInt32 Msr,
[Out] out UInt64 MsrValue);
[PreserveSig]
new int WriteMsr(
[In] UInt32 Msr,
[In] UInt64 MsrValue);
[PreserveSig]
new int ReadBusData(
[In] BUS_DATA_TYPE BusDataType,
[In] UInt32 BusNumber,
[In] UInt32 SlotNumber,
[In] UInt32 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteBusData(
[In] BUS_DATA_TYPE BusDataType,
[In] UInt32 BusNumber,
[In] UInt32 SlotNumber,
[In] UInt32 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int CheckLowMemory();
[PreserveSig]
new int ReadDebuggerData(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 DataSize);
[PreserveSig]
new int ReadProcessorSystemData(
[In] UInt32 Processor,
[In] DEBUG_DATA Index,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 DataSize);
/* IDebugDataSpaces2 */
[PreserveSig]
new int VirtualToPhysical(
[In] UInt64 Virtual,
[Out] out UInt64 Physical);
[PreserveSig]
new int GetVirtualTranslationPhysicalOffsets(
[In] UInt64 Virtual,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Offsets,
[In] UInt32 OffsetsSize,
[Out] out UInt32 Levels);
[PreserveSig]
new int ReadHandleData(
[In] UInt64 Handle,
[In] DEBUG_HANDLE_DATA_TYPE DataType,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 DataSize);
[PreserveSig]
new int FillVirtual(
[In] UInt64 Start,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 PatternSize,
[Out] out UInt32 Filled);
[PreserveSig]
new int FillPhysical(
[In] UInt64 Start,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 PatternSize,
[Out] out UInt32 Filled);
[PreserveSig]
new int QueryVirtual(
[In] UInt64 Offset,
[Out] out MEMORY_BASIC_INFORMATION64 Info);
/* IDebugDataSpaces3 */
[PreserveSig]
int ReadImageNtHeaders(
[In] UInt64 ImageBase,
[Out] out IMAGE_NT_HEADERS64 Headers);
[PreserveSig]
int ReadTagged(
[In, MarshalAs(UnmanagedType.LPStruct)] Guid Tag,
[In] UInt32 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 TotalSize);
[PreserveSig]
int StartEnumTagged(
[Out] out UInt64 Handle);
[PreserveSig]
int GetNextTagged(
[In] UInt64 Handle,
[Out] out Guid Tag,
[Out] out UInt32 Size);
[PreserveSig]
int EndEnumTagged(
[In] UInt64 Handle);
}
}

Просмотреть файл

@ -0,0 +1,319 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("d98ada1f-29e9-4ef5-a6c0-e53349883212")]
public interface IDebugDataSpaces4 : IDebugDataSpaces3
{
/* IDebugDataSpaces */
[PreserveSig]
new int ReadVirtual(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteVirtual(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int SearchVirtual(
[In] UInt64 Offset,
[In] UInt64 Length,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] pattern,
[In] UInt32 PatternSize,
[In] UInt32 PatternGranularity,
[Out] out UInt64 MatchOffset);
[PreserveSig]
new int ReadVirtualUncached(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteVirtualUncached(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int ReadPointersVirtual(
[In] UInt32 Count,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] UInt64[] Ptrs);
[PreserveSig]
new int WritePointersVirtual(
[In] UInt32 Count,
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray)] UInt64[] Ptrs);
[PreserveSig]
new int ReadPhysical(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WritePhysical(
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int ReadControl(
[In] UInt32 Processor,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteControl(
[In] UInt32 Processor,
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] Int32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int ReadIo(
[In] INTERFACE_TYPE InterfaceType,
[In] UInt32 BusNumber,
[In] UInt32 AddressSpace,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteIo(
[In] INTERFACE_TYPE InterfaceType,
[In] UInt32 BusNumber,
[In] UInt32 AddressSpace,
[In] UInt64 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int ReadMsr(
[In] UInt32 Msr,
[Out] out UInt64 MsrValue);
[PreserveSig]
new int WriteMsr(
[In] UInt32 Msr,
[In] UInt64 MsrValue);
[PreserveSig]
new int ReadBusData(
[In] BUS_DATA_TYPE BusDataType,
[In] UInt32 BusNumber,
[In] UInt32 SlotNumber,
[In] UInt32 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteBusData(
[In] BUS_DATA_TYPE BusDataType,
[In] UInt32 BusNumber,
[In] UInt32 SlotNumber,
[In] UInt32 Offset,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int CheckLowMemory();
[PreserveSig]
new int ReadDebuggerData(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 DataSize);
[PreserveSig]
new int ReadProcessorSystemData(
[In] UInt32 Processor,
[In] DEBUG_DATA Index,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 DataSize);
/* IDebugDataSpaces2 */
[PreserveSig]
new int VirtualToPhysical(
[In] UInt64 Virtual,
[Out] out UInt64 Physical);
[PreserveSig]
new int GetVirtualTranslationPhysicalOffsets(
[In] UInt64 Virtual,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Offsets,
[In] UInt32 OffsetsSize,
[Out] out UInt32 Levels);
[PreserveSig]
new int ReadHandleData(
[In] UInt64 Handle,
[In] DEBUG_HANDLE_DATA_TYPE DataType,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 DataSize);
[PreserveSig]
new int FillVirtual(
[In] UInt64 Start,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 PatternSize,
[Out] out UInt32 Filled);
[PreserveSig]
new int FillPhysical(
[In] UInt64 Start,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 PatternSize,
[Out] out UInt32 Filled);
[PreserveSig]
new int QueryVirtual(
[In] UInt64 Offset,
[Out] out MEMORY_BASIC_INFORMATION64 Info);
/* IDebugDataSpaces3 */
[PreserveSig]
new int ReadImageNtHeaders(
[In] UInt64 ImageBase,
[Out] out IMAGE_NT_HEADERS64 Headers);
[PreserveSig]
new int ReadTagged(
[In, MarshalAs(UnmanagedType.LPStruct)] Guid Tag,
[In] UInt32 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 TotalSize);
[PreserveSig]
new int StartEnumTagged(
[Out] out UInt64 Handle);
[PreserveSig]
new int GetNextTagged(
[In] UInt64 Handle,
[Out] out Guid Tag,
[Out] out UInt32 Size);
[PreserveSig]
new int EndEnumTagged(
[In] UInt64 Handle);
/* IDebugDataSpaces4 */
[PreserveSig]
int GetOffsetInformation(
[In] DEBUG_DATA_SPACE Space,
[In] DEBUG_OFFSINFO Which,
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 InfoSize);
[PreserveSig]
int GetNextDifferentlyValidOffsetVirtual(
[In] UInt64 Offset,
[Out] out UInt64 NextOffset);
[PreserveSig]
int GetValidRegionVirtual(
[In] UInt64 Base,
[In] UInt32 Size,
[Out] out UInt64 ValidBase,
[Out] out UInt32 ValidSize);
[PreserveSig]
int SearchVirtual2(
[In] UInt64 Offset,
[In] UInt64 Length,
[In] DEBUG_VSEARCH Flags,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] buffer,
[In] UInt32 PatternSize,
[In] UInt32 PatternGranularity,
[Out] out UInt64 MatchOffset);
[PreserveSig]
int ReadMultiByteStringVirtual(
[In] UInt64 Offset,
[In] UInt32 MaxBytes,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 StringBytes);
[PreserveSig]
int ReadMultiByteStringVirtualWide(
[In] UInt64 Offset,
[In] UInt32 MaxBytes,
[In] CODE_PAGE CodePage,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 StringBytes);
[PreserveSig]
int ReadUnicodeStringVirtual(
[In] UInt64 Offset,
[In] UInt32 MaxBytes,
[In] CODE_PAGE CodePage,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 StringBytes);
[PreserveSig]
int ReadUnicodeStringVirtualWide(
[In] UInt64 Offset,
[In] UInt32 MaxBytes,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 StringBytes);
[PreserveSig]
int ReadPhysical2(
[In] UInt64 Offset,
[In] DEBUG_PHYSICAL Flags,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WritePhysical2(
[In] UInt64 Offset,
[In] DEBUG_PHYSICAL Flags,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
}
}

Просмотреть файл

@ -0,0 +1,94 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("337be28b-5036-4d72-b6bf-c45fbb9f2eaa")]
public interface IDebugEventCallbacks
{
[PreserveSig]
int GetInterestMask(
[Out] out DEBUG_EVENT Mask);
[PreserveSig]
int Breakpoint(
[In, MarshalAs(UnmanagedType.Interface)] IDebugBreakpoint Bp);
[PreserveSig]
int Exception(
[In] ref EXCEPTION_RECORD64 Exception,
[In] UInt32 FirstChance);
[PreserveSig]
int CreateThread(
[In] UInt64 Handle,
[In] UInt64 DataOffset,
[In] UInt64 StartOffset);
[PreserveSig]
int ExitThread(
[In] UInt32 ExitCode);
[PreserveSig]
int CreateProcess(
[In] UInt64 ImageFileHandle,
[In] UInt64 Handle,
[In] UInt64 BaseOffset,
[In] UInt32 ModuleSize,
[In, MarshalAs(UnmanagedType.LPStr)] string ModuleName,
[In, MarshalAs(UnmanagedType.LPStr)] string ImageName,
[In] UInt32 CheckSum,
[In] UInt32 TimeDateStamp,
[In] UInt64 InitialThreadHandle,
[In] UInt64 ThreadDataOffset,
[In] UInt64 StartOffset);
[PreserveSig]
int ExitProcess(
[In] UInt32 ExitCode);
[PreserveSig]
int LoadModule(
[In] UInt64 ImageFileHandle,
[In] UInt64 BaseOffset,
[In] UInt32 ModuleSize,
[In, MarshalAs(UnmanagedType.LPStr)] string ModuleName,
[In, MarshalAs(UnmanagedType.LPStr)] string ImageName,
[In] UInt32 CheckSum,
[In] UInt32 TimeDateStamp);
[PreserveSig]
int UnloadModule(
[In, MarshalAs(UnmanagedType.LPStr)] string ImageBaseName,
[In] UInt64 BaseOffset);
[PreserveSig]
int SystemError(
[In] UInt32 Error,
[In] UInt32 Level);
[PreserveSig]
int SessionStatus(
[In] DEBUG_SESSION Status);
[PreserveSig]
int ChangeDebuggeeState(
[In] DEBUG_CDS Flags,
[In] UInt64 Argument);
[PreserveSig]
int ChangeEngineState(
[In] DEBUG_CES Flags,
[In] UInt64 Argument);
[PreserveSig]
int ChangeSymbolState(
[In] DEBUG_CSS Flags,
[In] UInt64 Argument);
}
}

Просмотреть файл

@ -0,0 +1,94 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0690e046-9c23-45ac-a04f-987ac29ad0d3")]
public interface IDebugEventCallbacksWide
{
[PreserveSig]
int GetInterestMask(
[Out] out DEBUG_EVENT Mask);
[PreserveSig]
int Breakpoint(
[In, MarshalAs(UnmanagedType.Interface)] IDebugBreakpoint2 Bp);
[PreserveSig]
int Exception(
[In] ref EXCEPTION_RECORD64 Exception,
[In] UInt32 FirstChance);
[PreserveSig]
int CreateThread(
[In] UInt64 Handle,
[In] UInt64 DataOffset,
[In] UInt64 StartOffset);
[PreserveSig]
int ExitThread(
[In] UInt32 ExitCode);
[PreserveSig]
int CreateProcess(
[In] UInt64 ImageFileHandle,
[In] UInt64 Handle,
[In] UInt64 BaseOffset,
[In] UInt32 ModuleSize,
[In, MarshalAs(UnmanagedType.LPWStr)] string ModuleName,
[In, MarshalAs(UnmanagedType.LPWStr)] string ImageName,
[In] UInt32 CheckSum,
[In] UInt32 TimeDateStamp,
[In] UInt64 InitialThreadHandle,
[In] UInt64 ThreadDataOffset,
[In] UInt64 StartOffset);
[PreserveSig]
int ExitProcess(
[In] UInt32 ExitCode);
[PreserveSig]
int LoadModule(
[In] UInt64 ImageFileHandle,
[In] UInt64 BaseOffset,
[In] UInt32 ModuleSize,
[In, MarshalAs(UnmanagedType.LPWStr)] string ModuleName,
[In, MarshalAs(UnmanagedType.LPWStr)] string ImageName,
[In] UInt32 CheckSum,
[In] UInt32 TimeDateStamp);
[PreserveSig]
int UnloadModule(
[In, MarshalAs(UnmanagedType.LPWStr)] string ImageBaseName,
[In] UInt64 BaseOffset);
[PreserveSig]
int SystemError(
[In] UInt32 Error,
[In] UInt32 Level);
[PreserveSig]
int SessionStatus(
[In] DEBUG_SESSION Status);
[PreserveSig]
int ChangeDebuggeeState(
[In] DEBUG_CDS Flags,
[In] UInt64 Argument);
[PreserveSig]
int ChangeEngineState(
[In] DEBUG_CES Flags,
[In] UInt64 Argument);
[PreserveSig]
int ChangeSymbolState(
[In] DEBUG_CSS Flags,
[In] UInt64 Argument);
}
}

Просмотреть файл

@ -0,0 +1,116 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("61a4905b-23f9-4247-b3c5-53d087529ab7")]
public unsafe interface IDebugEventContextCallbacks
{
[PreserveSig]
int GetInterestMask(
[Out] out DEBUG_EVENT Mask);
[PreserveSig]
int Breakpoint(
[In, MarshalAs(UnmanagedType.Interface)] IDebugBreakpoint2 Bp,
[In] DEBUG_EVENT_CONTEXT* Context,
[In] uint ContextSize);
[PreserveSig]
int Exception(
[In] ref EXCEPTION_RECORD64 Exception,
[In] UInt32 FirstChance,
[In] DEBUG_EVENT_CONTEXT* Context,
[In] uint ContextSize);
[PreserveSig]
int CreateThread(
[In] UInt64 Handle,
[In] UInt64 DataOffset,
[In] UInt64 StartOffset,
[In] DEBUG_EVENT_CONTEXT* Context,
[In] uint ContextSize);
[PreserveSig]
int ExitThread(
[In] UInt32 ExitCode,
[In] DEBUG_EVENT_CONTEXT* Context,
[In] uint ContextSize);
[PreserveSig]
int CreateProcess(
[In] UInt64 ImageFileHandle,
[In] UInt64 Handle,
[In] UInt64 BaseOffset,
[In] UInt32 ModuleSize,
[In, MarshalAs(UnmanagedType.LPWStr)] string ModuleName,
[In, MarshalAs(UnmanagedType.LPWStr)] string ImageName,
[In] UInt32 CheckSum,
[In] UInt32 TimeDateStamp,
[In] UInt64 InitialThreadHandle,
[In] UInt64 ThreadDataOffset,
[In] UInt64 StartOffset,
[In] DEBUG_EVENT_CONTEXT* Context,
[In] uint ContextSize);
[PreserveSig]
int ExitProcess(
[In] UInt32 ExitCode,
[In] DEBUG_EVENT_CONTEXT* Context,
[In] uint ContextSize);
[PreserveSig]
int LoadModule(
[In] UInt64 ImageFileHandle,
[In] UInt64 BaseOffset,
[In] UInt32 ModuleSize,
[In, MarshalAs(UnmanagedType.LPWStr)] string ModuleName,
[In, MarshalAs(UnmanagedType.LPWStr)] string ImageName,
[In] UInt32 CheckSum,
[In] UInt32 TimeDateStamp,
[In] DEBUG_EVENT_CONTEXT* Context,
[In] uint ContextSize);
[PreserveSig]
int UnloadModule(
[In, MarshalAs(UnmanagedType.LPWStr)] string ImageBaseName,
[In] UInt64 BaseOffset,
[In] DEBUG_EVENT_CONTEXT* Context,
[In] uint ContextSize);
[PreserveSig]
int SystemError(
[In] UInt32 Error,
[In] UInt32 Level,
[In] DEBUG_EVENT_CONTEXT* Context,
[In] uint ContextSize);
[PreserveSig]
int SessionStatus(
[In] DEBUG_SESSION Status);
[PreserveSig]
int ChangeDebuggeeState(
[In] DEBUG_CDS Flags,
[In] UInt64 Argument,
[In] DEBUG_EVENT_CONTEXT* Context,
[In] uint ContextSize);
[PreserveSig]
int ChangeEngineState(
[In] DEBUG_CES Flags,
[In] UInt64 Argument,
[In] DEBUG_EVENT_CONTEXT* Context,
[In] uint ContextSize);
[PreserveSig]
int ChangeSymbolState(
[In] DEBUG_CSS Flags,
[In] UInt64 Argument);
}
}

Просмотреть файл

@ -0,0 +1,21 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("9f50e42c-f136-499e-9a97-73036c94ed2d")]
public interface IDebugInputCallbacks
{
[PreserveSig]
int StartInput(
[In] UInt32 BufferSize);
[PreserveSig]
int EndInput();
}
}

Просмотреть файл

@ -0,0 +1,19 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("4bf58045-d654-4c40-b0af-683090f356dc")]
public interface IDebugOutputCallbacks
{
[PreserveSig]
int Output(
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Text);
}
}

Просмотреть файл

@ -0,0 +1,37 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("67721fe9-56d2-4a44-a325-2b65513ce6eb")]
public interface IDebugOutputCallbacks2 : IDebugOutputCallbacks
{
/* IDebugOutputCallbacks */
/// <summary>
/// This method is not used.
/// </summary>
[PreserveSig]
new int Output(
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPStr)] string Text);
/* IDebugOutputCallbacks2 */
[PreserveSig]
int GetInterestMask(
[Out] out DEBUG_OUTCBI Mask);
[PreserveSig]
int Output2(
[In] DEBUG_OUTCB Which,
[In] DEBUG_OUTCBF Flags,
[In] UInt64 Arg,
[In, MarshalAs(UnmanagedType.LPWStr)] string Text);
}
}

Просмотреть файл

@ -0,0 +1,19 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("4c7fd663-c394-4e26-8ef1-34ad5ed3764c")]
public interface IDebugOutputCallbacksWide
{
[PreserveSig]
int Output(
[In] DEBUG_OUTPUT Mask,
[In, MarshalAs(UnmanagedType.LPWStr)] string Text);
}
}

Просмотреть файл

@ -0,0 +1,73 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("ce289126-9e84-45a7-937e-67bb18691493")]
public interface IDebugRegisters
{
[PreserveSig]
int GetNumberRegisters(
[Out] out UInt32 Number);
[PreserveSig]
int GetDescription(
[In] UInt32 Register,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out DEBUG_REGISTER_DESCRIPTION Desc);
[PreserveSig]
int GetIndexByName(
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[Out] out UInt32 Index);
[PreserveSig]
int GetValue(
[In] UInt32 Register,
[Out] out DEBUG_VALUE Value);
[PreserveSig]
int SetValue(
[In] UInt32 Register,
[In] DEBUG_VALUE Value);
[PreserveSig]
int GetValues( //FIX ME!!! This needs to be tested
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Indices,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] Values);
[PreserveSig]
int SetValues(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Indices,
[In] UInt32 Start,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] Values);
[PreserveSig]
int OutputRegisters(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_REGISTERS Flags);
[PreserveSig]
int GetInstructionOffset(
[Out] out UInt64 Offset);
[PreserveSig]
int GetStackOffset(
[Out] out UInt64 Offset);
[PreserveSig]
int GetFrameOffset(
[Out] out UInt64 Offset);
}
}

Просмотреть файл

@ -0,0 +1,186 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("1656afa9-19c6-4e3a-97e7-5dc9160cf9c4")]
public interface IDebugRegisters2 : IDebugRegisters
{
[PreserveSig]
new int GetNumberRegisters(
[Out] out UInt32 Number);
[PreserveSig]
new int GetDescription(
[In] UInt32 Register,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out DEBUG_REGISTER_DESCRIPTION Desc);
[PreserveSig]
new int GetIndexByName(
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[Out] out UInt32 Index);
[PreserveSig]
new int GetValue(
[In] UInt32 Register,
[Out] out DEBUG_VALUE Value);
[PreserveSig]
new int SetValue(
[In] UInt32 Register,
[In] DEBUG_VALUE Value);
[PreserveSig]
new int GetValues( //FIX ME!!! This needs to be tested
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Indices,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] Values);
[PreserveSig]
new int SetValues(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Indices,
[In] UInt32 Start,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] Values);
[PreserveSig]
new int OutputRegisters(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_REGISTERS Flags);
[PreserveSig]
new int GetInstructionOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int GetStackOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int GetFrameOffset(
[Out] out UInt64 Offset);
/* IDebugRegisters2 */
[PreserveSig]
int GetDescriptionWide(
[In] UInt32 Register,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out DEBUG_REGISTER_DESCRIPTION Desc);
[PreserveSig]
int GetIndexByNameWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[Out] out UInt32 Index);
[PreserveSig]
int GetNumberPseudoRegisters(
[Out] out UInt32 Number
);
[PreserveSig]
int GetPseudoDescription(
[In] UInt32 Register,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 TypeModule,
[Out] out UInt32 TypeId
);
[PreserveSig]
int GetPseudoDescriptionWide(
[In] UInt32 Register,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 TypeModule,
[Out] out UInt32 TypeId
);
[PreserveSig]
int GetPseudoIndexByName(
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[Out] out UInt32 Index
);
[PreserveSig]
int GetPseudoIndexByNameWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[Out] out UInt32 Index
);
[PreserveSig]
int GetPseudoValues(
[In] UInt32 Source,
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Indices,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] Values
);
[PreserveSig]
int SetPseudoValues(
[In] UInt32 Source,
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Indices,
[In] UInt32 Start,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] Values
);
[PreserveSig]
int GetValues2(
[In] DEBUG_REGSRC Source,
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Indices,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] Values
);
[PreserveSig]
int SetValues2(
[In] UInt32 Source,
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt32[] Indices,
[In] UInt32 Start,
[In, MarshalAs(UnmanagedType.LPArray)] DEBUG_VALUE[] Values
);
[PreserveSig]
int OutputRegisters2(
[In] UInt32 OutputControl,
[In] UInt32 Source,
[In] UInt32 Flags
);
[PreserveSig]
int GetInstructionOffset2(
[In] UInt32 Source,
[Out] out UInt64 Offset
);
[PreserveSig]
int GetStackOffset2(
[In] UInt32 Source,
[Out] out UInt64 Offset
);
[PreserveSig]
int GetFrameOffset2(
[In] UInt32 Source,
[Out] out UInt64 Offset
);
}
}

Просмотреть файл

@ -0,0 +1,69 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("f2528316-0f1a-4431-aeed-11d096e1e2ab")]
public interface IDebugSymbolGroup
{
/* IDebugSymbolGroup */
[PreserveSig]
int GetNumberSymbols(
[Out] out UInt32 Number);
[PreserveSig]
int AddSymbol(
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[In, Out] ref UInt32 Index);
[PreserveSig]
int RemoveSymbolByName(
[In, MarshalAs(UnmanagedType.LPStr)] string Name);
[PreserveSig]
int RemoveSymbolsByIndex(
[In] UInt32 Index);
[PreserveSig]
int GetSymbolName(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int GetSymbolParameters(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SYMBOL_PARAMETERS[] Params);
[PreserveSig]
int ExpandSymbol(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.Bool)] bool Expand);
[PreserveSig]
int OutputSymbols(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUTPUT_SYMBOLS Flags,
[In] UInt32 Start,
[In] UInt32 Count);
[PreserveSig]
int WriteSymbol(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Value);
[PreserveSig]
int OutputAsType(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Type);
}
}

Просмотреть файл

@ -0,0 +1,145 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("6a7ccc5f-fb5e-4dcc-b41c-6c20307bccc7")]
public interface IDebugSymbolGroup2 : IDebugSymbolGroup
{
/* IDebugSymbolGroup */
[PreserveSig]
new int GetNumberSymbols(
[Out] out UInt32 Number);
[PreserveSig]
new int AddSymbol(
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[In, Out] ref UInt32 Index);
[PreserveSig]
new int RemoveSymbolByName(
[In, MarshalAs(UnmanagedType.LPStr)] string Name);
[PreserveSig]
new int RemoveSymbolsByIndex(
[In] UInt32 Index);
[PreserveSig]
new int GetSymbolName(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetSymbolParameters(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SYMBOL_PARAMETERS[] Params);
[PreserveSig]
new int ExpandSymbol(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.Bool)] bool Expand);
[PreserveSig]
new int OutputSymbols(
[In] DEBUG_OUTCTL OutputControl,
[In] DEBUG_OUTPUT_SYMBOLS Flags,
[In] UInt32 Start,
[In] UInt32 Count);
[PreserveSig]
new int WriteSymbol(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Value);
[PreserveSig]
new int OutputAsType(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPStr)] string Type);
/* IDebugSymbolGroup2 */
[PreserveSig]
int AddSymbolWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[In, Out] ref UInt32 Index);
[PreserveSig]
int RemoveSymbolByNameWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Name);
[PreserveSig]
int GetSymbolNameWide(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int WriteSymbolWide(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPWStr)] string Value);
[PreserveSig]
int OutputAsTypeWide(
[In] UInt32 Index,
[In, MarshalAs(UnmanagedType.LPWStr)] string Type);
[PreserveSig]
int GetSymbolTypeName(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int GetSymbolTypeNameWide(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int GetSymbolSize(
[In] UInt32 Index,
[Out] out UInt32 Size);
[PreserveSig]
int GetSymbolOffset(
[In] UInt32 Index,
[Out] out UInt64 Offset);
[PreserveSig]
int GetSymbolRegister(
[In] UInt32 Index,
[Out] out UInt32 Register);
[PreserveSig]
int GetSymbolValueText(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int GetSymbolValueTextWide(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int GetSymbolEntryInformation(
[In] UInt32 Index,
[Out] out DEBUG_SYMBOL_ENTRY Info);
}
}

Просмотреть файл

@ -0,0 +1,325 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("8c31e98c-983a-48a5-9016-6fe5d667a950")]
public interface IDebugSymbols
{
/* IDebugSymbols */
[PreserveSig]
int GetSymbolOptions(
[Out] out SYMOPT Options);
[PreserveSig]
int AddSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
int RemoveSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
int SetSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
int GetNameByOffset(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
int GetOffsetByName(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt64 Offset);
[PreserveSig]
int GetNearNameByOffset(
[In] UInt64 Offset,
[In] int Delta,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
int GetLineByOffset(
[In] UInt64 Offset,
[Out] out UInt32 Line,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer,
[In] Int32 FileBufferSize,
[Out] out UInt32 FileSize,
[Out] out UInt64 Displacement);
[PreserveSig]
int GetOffsetByLine(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[Out] out UInt64 Offset);
[PreserveSig]
int GetNumberModules(
[Out] out UInt32 Loaded,
[Out] out UInt32 Unloaded);
[PreserveSig]
int GetModuleByIndex(
[In] UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
int GetModuleByModuleName(
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[In] UInt32 StartIndex,
[Out] out UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
int GetModuleByOffset(
[In] UInt64 Offset,
[In] UInt32 StartIndex,
[Out] out UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
int GetModuleNames(
[In] UInt32 Index,
[In] UInt64 Base,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ImageNameBuffer,
[In] Int32 ImageNameBufferSize,
[Out] out UInt32 ImageNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ModuleNameBuffer,
[In] Int32 ModuleNameBufferSize,
[Out] out UInt32 ModuleNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder LoadedImageNameBuffer,
[In] Int32 LoadedImageNameBufferSize,
[Out] out UInt32 LoadedImageNameSize);
[PreserveSig]
int GetModuleParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt64[] Bases,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_PARAMETERS[] Params);
[PreserveSig]
int GetSymbolModule(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt64 Base);
[PreserveSig]
int GetTypeName(
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int GetTypeId(
[In] UInt64 Module,
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[Out] out UInt32 TypeId);
[PreserveSig]
int GetTypeSize(
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out] out UInt32 Size);
[PreserveSig]
int GetFieldOffset(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In, MarshalAs(UnmanagedType.LPStr)] string Field,
[Out] out UInt32 Offset);
[PreserveSig]
int GetSymbolTypeId(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt32 TypeId,
[Out] out UInt64 Module);
[PreserveSig]
int GetOffsetTypeId(
[In] UInt64 Offset,
[Out] out UInt32 TypeId,
[Out] out UInt64 Module);
[PreserveSig]
int ReadTypedDataVirtual(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WriteTypedDataVirtual(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int OutputTypedDataVirtual(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] DEBUG_TYPEOPTS Flags);
[PreserveSig]
int ReadTypedDataPhysical(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
int WriteTypedDataPhysical(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
int OutputTypedDataPhysical(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] DEBUG_TYPEOPTS Flags);
[PreserveSig]
int GetScope(
[Out] out UInt64 InstructionOffset,
[Out] out DEBUG_STACK_FRAME ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize);
[PreserveSig]
int SetScope(
[In] UInt64 InstructionOffset,
[In] DEBUG_STACK_FRAME ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize);
[PreserveSig]
int ResetScope();
[PreserveSig]
int GetScopeSymbolGroup(
[In] 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] out UInt64 Handle);
[PreserveSig]
int GetNextSymbolMatch(
[In] UInt64 Handle,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 MatchSize,
[Out] out UInt64 Offset);
[PreserveSig]
int EndSymbolMatch(
[In] UInt64 Handle);
[PreserveSig]
int Reload(
[In, MarshalAs(UnmanagedType.LPStr)] string Module);
[PreserveSig]
int GetSymbolPath(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 PathSize);
[PreserveSig]
int GetSourcePathElement(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ElementSize);
[PreserveSig]
int SetSourcePath(
[In, MarshalAs(UnmanagedType.LPStr)] string Path);
[PreserveSig]
int AppendSourcePath(
[In, MarshalAs(UnmanagedType.LPStr)] string Addition);
[PreserveSig]
int FindSourceFile(
[In] UInt32 StartElement,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[In] DEBUG_FIND_SOURCE Flags,
[Out] out UInt32 FoundElement,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 FoundSize);
[PreserveSig]
int GetSourceFileLineOffsets(
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Buffer,
[In] Int32 BufferLines,
[Out] out UInt32 FileLines);
}
}

Просмотреть файл

@ -0,0 +1,380 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("3a707211-afdd-4495-ad4f-56fecdf8163f")]
public interface IDebugSymbols2 : IDebugSymbols
{
/* IDebugSymbols */
[PreserveSig]
new int GetSymbolOptions(
[Out] out SYMOPT Options);
[PreserveSig]
new int AddSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
new int RemoveSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
new int SetSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
new int GetNameByOffset(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetOffsetByName(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt64 Offset);
[PreserveSig]
new int GetNearNameByOffset(
[In] UInt64 Offset,
[In] int Delta,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetLineByOffset(
[In] UInt64 Offset,
[Out] out UInt32 Line,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer,
[In] Int32 FileBufferSize,
[Out] out UInt32 FileSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetOffsetByLine(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[Out] out UInt64 Offset);
[PreserveSig]
new int GetNumberModules(
[Out] out UInt32 Loaded,
[Out] out UInt32 Unloaded);
[PreserveSig]
new int GetModuleByIndex(
[In] UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetModuleByModuleName(
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[In] UInt32 StartIndex,
[Out] out UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetModuleByOffset(
[In] UInt64 Offset,
[In] UInt32 StartIndex,
[Out] out UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetModuleNames(
[In] UInt32 Index,
[In] UInt64 Base,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ImageNameBuffer,
[In] Int32 ImageNameBufferSize,
[Out] out UInt32 ImageNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ModuleNameBuffer,
[In] Int32 ModuleNameBufferSize,
[Out] out UInt32 ModuleNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder LoadedImageNameBuffer,
[In] Int32 LoadedImageNameBufferSize,
[Out] out UInt32 LoadedImageNameSize);
[PreserveSig]
new int GetModuleParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt64[] Bases,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_PARAMETERS[] Params);
[PreserveSig]
new int GetSymbolModule(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt64 Base);
[PreserveSig]
new int GetTypeName(
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetTypeId(
[In] UInt64 Module,
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[Out] out UInt32 TypeId);
[PreserveSig]
new int GetTypeSize(
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out] out UInt32 Size);
[PreserveSig]
new int GetFieldOffset(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In, MarshalAs(UnmanagedType.LPStr)] string Field,
[Out] out UInt32 Offset);
[PreserveSig]
new int GetSymbolTypeId(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt32 TypeId,
[Out] out UInt64 Module);
[PreserveSig]
new int GetOffsetTypeId(
[In] UInt64 Offset,
[Out] out UInt32 TypeId,
[Out] out UInt64 Module);
[PreserveSig]
new int ReadTypedDataVirtual(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteTypedDataVirtual(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int OutputTypedDataVirtual(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] DEBUG_TYPEOPTS Flags);
[PreserveSig]
new int ReadTypedDataPhysical(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteTypedDataPhysical(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int OutputTypedDataPhysical(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] DEBUG_TYPEOPTS Flags);
[PreserveSig]
new int GetScope(
[Out] out UInt64 InstructionOffset,
[Out] out DEBUG_STACK_FRAME ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize);
[PreserveSig]
new int SetScope(
[In] UInt64 InstructionOffset,
[In] DEBUG_STACK_FRAME ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize);
[PreserveSig]
new int ResetScope();
[PreserveSig]
new int GetScopeSymbolGroup(
[In] 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] out UInt64 Handle);
[PreserveSig]
new int GetNextSymbolMatch(
[In] UInt64 Handle,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 MatchSize,
[Out] out UInt64 Offset);
[PreserveSig]
new int EndSymbolMatch(
[In] UInt64 Handle);
[PreserveSig]
new int Reload(
[In, MarshalAs(UnmanagedType.LPStr)] string Module);
[PreserveSig]
new int GetSymbolPath(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 PathSize);
[PreserveSig]
new int GetSourcePathElement(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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(
[In] UInt32 StartElement,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[In] DEBUG_FIND_SOURCE Flags,
[Out] out UInt32 FoundElement,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 FoundSize);
[PreserveSig]
new int GetSourceFileLineOffsets(
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Buffer,
[In] Int32 BufferLines,
[Out] out UInt32 FileLines);
/* IDebugSymbols2 */
[PreserveSig]
int GetModuleVersionInformation(
[In] UInt32 Index,
[In] UInt64 Base,
[In, MarshalAs(UnmanagedType.LPStr)] string Item,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 VerInfoSize);
[PreserveSig]
int GetModuleNameString(
[In] DEBUG_MODNAME Which,
[In] UInt32 Index,
[In] UInt64 Base,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int GetConstantName(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt64 Value,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int GetFieldName(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt32 FieldIndex,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int GetTypeOptions(
[Out] out DEBUG_TYPEOPTS Options);
[PreserveSig]
int AddTypeOptions(
[In] DEBUG_TYPEOPTS Options);
[PreserveSig]
int RemoveTypeOptions(
[In] DEBUG_TYPEOPTS Options);
[PreserveSig]
int SetTypeOptions(
[In] DEBUG_TYPEOPTS Options);
}
}

Просмотреть файл

@ -0,0 +1,857 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("f02fbecc-50ac-4f36-9ad9-c975e8f32ff8")]
public interface IDebugSymbols3 : IDebugSymbols2
{
/* IDebugSymbols */
[PreserveSig]
new int GetSymbolOptions(
[Out] out SYMOPT Options);
[PreserveSig]
new int AddSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
new int RemoveSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
new int SetSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
new int GetNameByOffset(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetOffsetByName(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt64 Offset);
[PreserveSig]
new int GetNearNameByOffset(
[In] UInt64 Offset,
[In] int Delta,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetLineByOffset(
[In] UInt64 Offset,
[Out] out UInt32 Line,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer,
[In] Int32 FileBufferSize,
[Out] out UInt32 FileSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetOffsetByLine(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[Out] out UInt64 Offset);
[PreserveSig]
new int GetNumberModules(
[Out] out UInt32 Loaded,
[Out] out UInt32 Unloaded);
[PreserveSig]
new int GetModuleByIndex(
[In] UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetModuleByModuleName(
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[In] UInt32 StartIndex,
[Out] out UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetModuleByOffset(
[In] UInt64 Offset,
[In] UInt32 StartIndex,
[Out] out UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetModuleNames(
[In] UInt32 Index,
[In] UInt64 Base,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ImageNameBuffer,
[In] Int32 ImageNameBufferSize,
[Out] out UInt32 ImageNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ModuleNameBuffer,
[In] Int32 ModuleNameBufferSize,
[Out] out UInt32 ModuleNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder LoadedImageNameBuffer,
[In] Int32 LoadedImageNameBufferSize,
[Out] out UInt32 LoadedImageNameSize);
[PreserveSig]
new int GetModuleParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt64[] Bases,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_PARAMETERS[] Params);
[PreserveSig]
new int GetSymbolModule(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt64 Base);
[PreserveSig]
new int GetTypeName(
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetTypeId(
[In] UInt64 Module,
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[Out] out UInt32 TypeId);
[PreserveSig]
new int GetTypeSize(
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out] out UInt32 Size);
[PreserveSig]
new int GetFieldOffset(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In, MarshalAs(UnmanagedType.LPStr)] string Field,
[Out] out UInt32 Offset);
[PreserveSig]
new int GetSymbolTypeId(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt32 TypeId,
[Out] out UInt64 Module);
[PreserveSig]
new int GetOffsetTypeId(
[In] UInt64 Offset,
[Out] out UInt32 TypeId,
[Out] out UInt64 Module);
[PreserveSig]
new int ReadTypedDataVirtual(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteTypedDataVirtual(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int OutputTypedDataVirtual(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] DEBUG_TYPEOPTS Flags);
[PreserveSig]
new int ReadTypedDataPhysical(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteTypedDataPhysical(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int OutputTypedDataPhysical(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] DEBUG_TYPEOPTS Flags);
[PreserveSig]
new int GetScope(
[Out] out UInt64 InstructionOffset,
[Out] out DEBUG_STACK_FRAME ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize);
[PreserveSig]
new int SetScope(
[In] UInt64 InstructionOffset,
[In] DEBUG_STACK_FRAME ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize);
[PreserveSig]
new int ResetScope();
[PreserveSig]
new int GetScopeSymbolGroup(
[In] 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] out UInt64 Handle);
[PreserveSig]
new int GetNextSymbolMatch(
[In] UInt64 Handle,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 MatchSize,
[Out] out UInt64 Offset);
[PreserveSig]
new int EndSymbolMatch(
[In] UInt64 Handle);
[PreserveSig]
new int Reload(
[In, MarshalAs(UnmanagedType.LPStr)] string Module);
[PreserveSig]
new int GetSymbolPath(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 PathSize);
[PreserveSig]
new int GetSourcePathElement(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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(
[In] UInt32 StartElement,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[In] DEBUG_FIND_SOURCE Flags,
[Out] out UInt32 FoundElement,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 FoundSize);
[PreserveSig]
new int GetSourceFileLineOffsets(
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Buffer,
[In] Int32 BufferLines,
[Out] out UInt32 FileLines);
/* IDebugSymbols2 */
[PreserveSig]
new int GetModuleVersionInformation(
[In] UInt32 Index,
[In] UInt64 Base,
[In, MarshalAs(UnmanagedType.LPStr)] string Item,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 VerInfoSize);
[PreserveSig]
new int GetModuleNameString(
[In] DEBUG_MODNAME Which,
[In] UInt32 Index,
[In] UInt64 Base,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetConstantName(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt64 Value,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetFieldName(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt32 FieldIndex,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetTypeOptions(
[Out] out DEBUG_TYPEOPTS Options);
[PreserveSig]
new int AddTypeOptions(
[In] DEBUG_TYPEOPTS Options);
[PreserveSig]
new int RemoveTypeOptions(
[In] DEBUG_TYPEOPTS Options);
[PreserveSig]
new int SetTypeOptions(
[In] DEBUG_TYPEOPTS Options);
/* IDebugSymbols3 */
[PreserveSig]
int GetNameByOffsetWide(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
int GetOffsetByNameWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Symbol,
[Out] out UInt64 Offset);
[PreserveSig]
int GetNearNameByOffsetWide(
[In] UInt64 Offset,
[In] int Delta,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
int GetLineByOffsetWide(
[In] UInt64 Offset,
[Out] out UInt32 Line,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder FileBuffer,
[In] Int32 FileBufferSize,
[Out] out UInt32 FileSize,
[Out] out UInt64 Displacement);
[PreserveSig]
int GetOffsetByLineWide(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[Out] out UInt64 Offset);
[PreserveSig]
int GetModuleByModuleNameWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[In] UInt32 StartIndex,
[Out] out UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
int GetSymbolModuleWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Symbol,
[Out] out UInt64 Base);
[PreserveSig]
int GetTypeNameWide(
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int GetTypeIdWide(
[In] UInt64 Module,
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[Out] out UInt32 TypeId);
[PreserveSig]
int GetFieldOffsetWide(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In, MarshalAs(UnmanagedType.LPWStr)] string Field,
[Out] out UInt32 Offset);
[PreserveSig]
int GetSymbolTypeIdWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Symbol,
[Out] out UInt32 TypeId,
[Out] out UInt64 Module);
[PreserveSig]
int GetScopeSymbolGroup2(
[In] 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] out UInt64 Handle);
[PreserveSig]
int GetNextSymbolMatchWide(
[In] UInt64 Handle,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 MatchSize,
[Out] out UInt64 Offset);
[PreserveSig]
int ReloadWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Module);
[PreserveSig]
int GetSymbolPathWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 PathSize);
[PreserveSig]
int GetSourcePathElementWide(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ElementSize);
[PreserveSig]
int SetSourcePathWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Path);
[PreserveSig]
int AppendSourcePathWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Addition);
[PreserveSig]
int FindSourceFileWide(
[In] UInt32 StartElement,
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[In] DEBUG_FIND_SOURCE Flags,
[Out] out UInt32 FoundElement,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 FoundSize);
[PreserveSig]
int GetSourceFileLineOffsetsWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Buffer,
[In] Int32 BufferLines,
[Out] out UInt32 FileLines);
[PreserveSig]
int GetModuleVersionInformationWide(
[In] UInt32 Index,
[In] UInt64 Base,
[In, MarshalAs(UnmanagedType.LPWStr)] string Item,
[In] IntPtr Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 VerInfoSize);
[PreserveSig]
int GetModuleNameStringWide(
[In] DEBUG_MODNAME Which,
[In] UInt32 Index,
[In] UInt64 Base,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int GetConstantNameWide(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt64 Value,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int GetFieldNameWide(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt32 FieldIndex,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
int IsManagedModule(
[In] UInt32 Index,
[In] UInt64 Base
);
[PreserveSig]
int GetModuleByModuleName2(
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[In] UInt32 StartIndex,
[In] DEBUG_GETMOD Flags,
[Out] out UInt32 Index,
[Out] out UInt64 Base
);
[PreserveSig]
int GetModuleByModuleName2Wide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[In] UInt32 StartIndex,
[In] DEBUG_GETMOD Flags,
[Out] out UInt32 Index,
[Out] out UInt64 Base
);
[PreserveSig]
int GetModuleByOffset2(
[In] UInt64 Offset,
[In] UInt32 StartIndex,
[In] DEBUG_GETMOD Flags,
[Out] out UInt32 Index,
[Out] out UInt64 Base
);
[PreserveSig]
int AddSyntheticModule(
[In] UInt64 Base,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPStr)] string ImagePath,
[In, MarshalAs(UnmanagedType.LPStr)] string ModuleName,
[In] DEBUG_ADDSYNTHMOD Flags
);
[PreserveSig]
int AddSyntheticModuleWide(
[In] UInt64 Base,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPWStr)] string ImagePath,
[In, MarshalAs(UnmanagedType.LPWStr)] string ModuleName,
[In] DEBUG_ADDSYNTHMOD Flags
);
[PreserveSig]
int RemoveSyntheticModule(
[In] UInt64 Base
);
[PreserveSig]
int GetCurrentScopeFrameIndex(
[Out] out UInt32 Index
);
[PreserveSig]
int SetScopeFrameByIndex(
[In] UInt32 Index
);
[PreserveSig]
int SetScopeFromJitDebugInfo(
[In] UInt32 OutputControl,
[In] UInt64 InfoOffset
);
[PreserveSig]
int SetScopeFromStoredEvent(
);
[PreserveSig]
int OutputSymbolByOffset(
[In] UInt32 OutputControl,
[In] DEBUG_OUTSYM Flags,
[In] UInt64 Offset
);
[PreserveSig]
int GetFunctionEntryByOffset(
[In] UInt64 Offset,
[In] DEBUG_GETFNENT Flags,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BufferNeeded
);
[PreserveSig]
int GetFieldTypeAndOffset(
[In] UInt64 Module,
[In] UInt32 ContainerTypeId,
[In, MarshalAs(UnmanagedType.LPStr)] string Field,
[Out] out UInt32 FieldTypeId,
[Out] out UInt32 Offset
);
[PreserveSig]
int GetFieldTypeAndOffsetWide(
[In] UInt64 Module,
[In] UInt32 ContainerTypeId,
[In, MarshalAs(UnmanagedType.LPWStr)] string Field,
[Out] out UInt32 FieldTypeId,
[Out] out UInt32 Offset
);
[PreserveSig]
int AddSyntheticSymbol(
[In] UInt64 Offset,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[In] DEBUG_ADDSYNTHSYM Flags,
[Out] out DEBUG_MODULE_AND_ID Id
);
[PreserveSig]
int AddSyntheticSymbolWide(
[In] UInt64 Offset,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[In] DEBUG_ADDSYNTHSYM Flags,
[Out] out DEBUG_MODULE_AND_ID Id
);
[PreserveSig]
int RemoveSyntheticSymbol([In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID Id
);
[PreserveSig]
int GetSymbolEntriesByOffset(
[In] UInt64 Offset,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_AND_ID[] Ids,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Displacements,
[In] UInt32 IdsCount,
[Out] out UInt32 Entries
);
[PreserveSig]
int GetSymbolEntriesByName(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_AND_ID[] Ids,
[In] UInt32 IdsCount,
[Out] out UInt32 Entries
);
[PreserveSig]
int GetSymbolEntriesByNameWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Symbol,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_AND_ID[] Ids,
[In] UInt32 IdsCount,
[Out] out UInt32 Entries
);
[PreserveSig]
int GetSymbolEntryByToken(
[In] UInt64 ModuleBase,
[In] UInt32 Token,
[Out] out DEBUG_MODULE_AND_ID Id
);
[PreserveSig]
unsafe int GetSymbolEntryInformation(
[In] DEBUG_MODULE_AND_ID* Id,
[Out] out DEBUG_SYMBOL_ENTRY Info
);
[PreserveSig]
int GetSymbolEntryString(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID Id,
[In] UInt32 Which,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize
);
[PreserveSig]
int GetSymbolEntryStringWide(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID Id,
[In] UInt32 Which,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize
);
[PreserveSig]
int GetSymbolEntryOffsetRegions(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID Id,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_OFFSET_REGION[] Regions,
[In] UInt32 RegionsCount,
[Out] out UInt32 RegionsAvail
);
[Obsolete( "Do not use: no longer implemented.", true )]
[PreserveSig]
int GetSymbolEntryBySymbolEntry(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID FromId,
[In] UInt32 Flags,
[Out] out DEBUG_MODULE_AND_ID ToId
);
[PreserveSig]
int GetSourceEntriesByOffset(
[In] UInt64 Offset,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SYMBOL_SOURCE_ENTRY[] Entries,
[In] UInt32 EntriesCount,
[Out] out UInt32 EntriesAvail
);
[PreserveSig]
int GetSourceEntriesByLine(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SYMBOL_SOURCE_ENTRY[] Entries,
[In] UInt32 EntriesCount,
[Out] out UInt32 EntriesAvail
);
[PreserveSig]
int GetSourceEntriesByLineWide(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SYMBOL_SOURCE_ENTRY[] Entries,
[In] UInt32 EntriesCount,
[Out] out UInt32 EntriesAvail
);
[PreserveSig]
int GetSourceEntryString(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_SYMBOL_SOURCE_ENTRY Entry,
[In] UInt32 Which,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize
);
[PreserveSig]
int GetSourceEntryStringWide(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_SYMBOL_SOURCE_ENTRY Entry,
[In] UInt32 Which,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize
);
[PreserveSig]
int GetSourceEntryOffsetRegions(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_SYMBOL_SOURCE_ENTRY Entry,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_OFFSET_REGION[] Regions,
[In] UInt32 RegionsCount,
[Out] out UInt32 RegionsAvail
);
[PreserveSig]
int GetSourceEntryBySourceEntry(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_SYMBOL_SOURCE_ENTRY FromEntry,
[In] UInt32 Flags,
[Out] out DEBUG_SYMBOL_SOURCE_ENTRY ToEntry
);
}
}

Просмотреть файл

@ -0,0 +1,925 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("e391bbd8-9d8c-4418-840b-c006592a1752")]
public interface IDebugSymbols4 : IDebugSymbols3
{
/* IDebugSymbols */
[PreserveSig]
new int GetSymbolOptions(
[Out] out SYMOPT Options);
[PreserveSig]
new int AddSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
new int RemoveSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
new int SetSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
new int GetNameByOffset(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetOffsetByName(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt64 Offset);
[PreserveSig]
new int GetNearNameByOffset(
[In] UInt64 Offset,
[In] int Delta,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetLineByOffset(
[In] UInt64 Offset,
[Out] out UInt32 Line,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer,
[In] Int32 FileBufferSize,
[Out] out UInt32 FileSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetOffsetByLine(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[Out] out UInt64 Offset);
[PreserveSig]
new int GetNumberModules(
[Out] out UInt32 Loaded,
[Out] out UInt32 Unloaded);
[PreserveSig]
new int GetModuleByIndex(
[In] UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetModuleByModuleName(
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[In] UInt32 StartIndex,
[Out] out UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetModuleByOffset(
[In] UInt64 Offset,
[In] UInt32 StartIndex,
[Out] out UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetModuleNames(
[In] UInt32 Index,
[In] UInt64 Base,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ImageNameBuffer,
[In] Int32 ImageNameBufferSize,
[Out] out UInt32 ImageNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ModuleNameBuffer,
[In] Int32 ModuleNameBufferSize,
[Out] out UInt32 ModuleNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder LoadedImageNameBuffer,
[In] Int32 LoadedImageNameBufferSize,
[Out] out UInt32 LoadedImageNameSize);
[PreserveSig]
new int GetModuleParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt64[] Bases,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_PARAMETERS[] Params);
[PreserveSig]
new int GetSymbolModule(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt64 Base);
[PreserveSig]
new int GetTypeName(
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetTypeId(
[In] UInt64 Module,
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[Out] out UInt32 TypeId);
[PreserveSig]
new int GetTypeSize(
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out] out UInt32 Size);
[PreserveSig]
new int GetFieldOffset(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In, MarshalAs(UnmanagedType.LPStr)] string Field,
[Out] out UInt32 Offset);
[PreserveSig]
new int GetSymbolTypeId(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt32 TypeId,
[Out] out UInt64 Module);
[PreserveSig]
new int GetOffsetTypeId(
[In] UInt64 Offset,
[Out] out UInt32 TypeId,
[Out] out UInt64 Module);
[PreserveSig]
new int ReadTypedDataVirtual(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteTypedDataVirtual(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int OutputTypedDataVirtual(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] DEBUG_TYPEOPTS Flags);
[PreserveSig]
new int ReadTypedDataPhysical(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteTypedDataPhysical(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int OutputTypedDataPhysical(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] DEBUG_TYPEOPTS Flags);
[PreserveSig]
new int GetScope(
[Out] out UInt64 InstructionOffset,
[Out] out DEBUG_STACK_FRAME ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize);
[PreserveSig]
new int SetScope(
[In] UInt64 InstructionOffset,
[In] DEBUG_STACK_FRAME ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize);
[PreserveSig]
new int ResetScope();
[PreserveSig]
new int GetScopeSymbolGroup(
[In] 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] out UInt64 Handle);
[PreserveSig]
new int GetNextSymbolMatch(
[In] UInt64 Handle,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 MatchSize,
[Out] out UInt64 Offset);
[PreserveSig]
new int EndSymbolMatch(
[In] UInt64 Handle);
[PreserveSig]
new int Reload(
[In, MarshalAs(UnmanagedType.LPStr)] string Module);
[PreserveSig]
new int GetSymbolPath(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 PathSize);
[PreserveSig]
new int GetSourcePathElement(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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(
[In] UInt32 StartElement,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[In] DEBUG_FIND_SOURCE Flags,
[Out] out UInt32 FoundElement,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 FoundSize);
[PreserveSig]
new int GetSourceFileLineOffsets(
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Buffer,
[In] Int32 BufferLines,
[Out] out UInt32 FileLines);
/* IDebugSymbols2 */
[PreserveSig]
new int GetModuleVersionInformation(
[In] UInt32 Index,
[In] UInt64 Base,
[In, MarshalAs(UnmanagedType.LPStr)] string Item,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 VerInfoSize);
[PreserveSig]
new int GetModuleNameString(
[In] DEBUG_MODNAME Which,
[In] UInt32 Index,
[In] UInt64 Base,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetConstantName(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt64 Value,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetFieldName(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt32 FieldIndex,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetTypeOptions(
[Out] out DEBUG_TYPEOPTS Options);
[PreserveSig]
new int AddTypeOptions(
[In] DEBUG_TYPEOPTS Options);
[PreserveSig]
new int RemoveTypeOptions(
[In] DEBUG_TYPEOPTS Options);
[PreserveSig]
new int SetTypeOptions(
[In] DEBUG_TYPEOPTS Options);
/* IDebugSymbols3 */
[PreserveSig]
new int GetNameByOffsetWide(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetOffsetByNameWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Symbol,
[Out] out UInt64 Offset);
[PreserveSig]
new int GetNearNameByOffsetWide(
[In] UInt64 Offset,
[In] int Delta,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetLineByOffsetWide(
[In] UInt64 Offset,
[Out] out UInt32 Line,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder FileBuffer,
[In] Int32 FileBufferSize,
[Out] out UInt32 FileSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetOffsetByLineWide(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[Out] out UInt64 Offset);
[PreserveSig]
new int GetModuleByModuleNameWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[In] UInt32 StartIndex,
[Out] out UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetSymbolModuleWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Symbol,
[Out] out UInt64 Base);
[PreserveSig]
new int GetTypeNameWide(
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetTypeIdWide(
[In] UInt64 Module,
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[Out] out UInt32 TypeId);
[PreserveSig]
new int GetFieldOffsetWide(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In, MarshalAs(UnmanagedType.LPWStr)] string Field,
[Out] out UInt32 Offset);
[PreserveSig]
new int GetSymbolTypeIdWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Symbol,
[Out] out UInt32 TypeId,
[Out] out UInt64 Module);
[PreserveSig]
new int GetScopeSymbolGroup2(
[In] 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] out UInt64 Handle);
[PreserveSig]
new int GetNextSymbolMatchWide(
[In] UInt64 Handle,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 MatchSize,
[Out] out UInt64 Offset);
[PreserveSig]
new int ReloadWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Module);
[PreserveSig]
new int GetSymbolPathWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 PathSize);
[PreserveSig]
new int GetSourcePathElementWide(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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(
[In] UInt32 StartElement,
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[In] DEBUG_FIND_SOURCE Flags,
[Out] out UInt32 FoundElement,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 FoundSize);
[PreserveSig]
new int GetSourceFileLineOffsetsWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Buffer,
[In] Int32 BufferLines,
[Out] out UInt32 FileLines);
[PreserveSig]
new int GetModuleVersionInformationWide(
[In] UInt32 Index,
[In] UInt64 Base,
[In, MarshalAs(UnmanagedType.LPWStr)] string Item,
[In] IntPtr Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 VerInfoSize);
[PreserveSig]
new int GetModuleNameStringWide(
[In] DEBUG_MODNAME Which,
[In] UInt32 Index,
[In] UInt64 Base,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetConstantNameWide(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt64 Value,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetFieldNameWide(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt32 FieldIndex,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int IsManagedModule(
[In] UInt32 Index,
[In] UInt64 Base
);
[PreserveSig]
new int GetModuleByModuleName2(
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[In] UInt32 StartIndex,
[In] DEBUG_GETMOD Flags,
[Out] out UInt32 Index,
[Out] out UInt64 Base
);
[PreserveSig]
new int GetModuleByModuleName2Wide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[In] UInt32 StartIndex,
[In] DEBUG_GETMOD Flags,
[Out] out UInt32 Index,
[Out] out UInt64 Base
);
[PreserveSig]
new int GetModuleByOffset2(
[In] UInt64 Offset,
[In] UInt32 StartIndex,
[In] DEBUG_GETMOD Flags,
[Out] out UInt32 Index,
[Out] out UInt64 Base
);
[PreserveSig]
new int AddSyntheticModule(
[In] UInt64 Base,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPStr)] string ImagePath,
[In, MarshalAs(UnmanagedType.LPStr)] string ModuleName,
[In] DEBUG_ADDSYNTHMOD Flags
);
[PreserveSig]
new int AddSyntheticModuleWide(
[In] UInt64 Base,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPWStr)] string ImagePath,
[In, MarshalAs(UnmanagedType.LPWStr)] string ModuleName,
[In] DEBUG_ADDSYNTHMOD Flags
);
[PreserveSig]
new int RemoveSyntheticModule(
[In] UInt64 Base
);
[PreserveSig]
new int GetCurrentScopeFrameIndex(
[Out] out UInt32 Index
);
[PreserveSig]
new int SetScopeFrameByIndex(
[In] UInt32 Index
);
[PreserveSig]
new int SetScopeFromJitDebugInfo(
[In] UInt32 OutputControl,
[In] UInt64 InfoOffset
);
[PreserveSig]
new int SetScopeFromStoredEvent(
);
[PreserveSig]
new int OutputSymbolByOffset(
[In] UInt32 OutputControl,
[In] DEBUG_OUTSYM Flags,
[In] UInt64 Offset
);
[PreserveSig]
new int GetFunctionEntryByOffset(
[In] UInt64 Offset,
[In] DEBUG_GETFNENT Flags,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BufferNeeded
);
[PreserveSig]
new int GetFieldTypeAndOffset(
[In] UInt64 Module,
[In] UInt32 ContainerTypeId,
[In, MarshalAs(UnmanagedType.LPStr)] string Field,
[Out] out UInt32 FieldTypeId,
[Out] out UInt32 Offset
);
[PreserveSig]
new int GetFieldTypeAndOffsetWide(
[In] UInt64 Module,
[In] UInt32 ContainerTypeId,
[In, MarshalAs(UnmanagedType.LPWStr)] string Field,
[Out] out UInt32 FieldTypeId,
[Out] out UInt32 Offset
);
[PreserveSig]
new int AddSyntheticSymbol(
[In] UInt64 Offset,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[In] DEBUG_ADDSYNTHSYM Flags,
[Out] out DEBUG_MODULE_AND_ID Id
);
[PreserveSig]
new int AddSyntheticSymbolWide(
[In] UInt64 Offset,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[In] DEBUG_ADDSYNTHSYM Flags,
[Out] out DEBUG_MODULE_AND_ID Id
);
[PreserveSig]
new int RemoveSyntheticSymbol([In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID Id
);
[PreserveSig]
new int GetSymbolEntriesByOffset(
[In] UInt64 Offset,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_AND_ID[] Ids,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Displacements,
[In] UInt32 IdsCount,
[Out] out UInt32 Entries
);
[PreserveSig]
new int GetSymbolEntriesByName(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_AND_ID[] Ids,
[In] UInt32 IdsCount,
[Out] out UInt32 Entries
);
[PreserveSig]
new int GetSymbolEntriesByNameWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Symbol,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_AND_ID[] Ids,
[In] UInt32 IdsCount,
[Out] out UInt32 Entries
);
[PreserveSig]
new int GetSymbolEntryByToken(
[In] UInt64 ModuleBase,
[In] UInt32 Token,
[Out] out DEBUG_MODULE_AND_ID Id
);
[PreserveSig]
new unsafe int GetSymbolEntryInformation(
[In] DEBUG_MODULE_AND_ID* Id,
[Out] out DEBUG_SYMBOL_ENTRY Info
);
[PreserveSig]
new int GetSymbolEntryString(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID Id,
[In] UInt32 Which,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize
);
[PreserveSig]
new int GetSymbolEntryStringWide(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID Id,
[In] UInt32 Which,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize
);
[PreserveSig]
new int GetSymbolEntryOffsetRegions(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID Id,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_OFFSET_REGION[] Regions,
[In] UInt32 RegionsCount,
[Out] out UInt32 RegionsAvail
);
[Obsolete( "Do not use: no longer implemented.", true )]
[PreserveSig]
new int GetSymbolEntryBySymbolEntry(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID FromId,
[In] UInt32 Flags,
[Out] out DEBUG_MODULE_AND_ID ToId
);
[PreserveSig]
new int GetSourceEntriesByOffset(
[In] UInt64 Offset,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SYMBOL_SOURCE_ENTRY[] Entries,
[In] UInt32 EntriesCount,
[Out] out UInt32 EntriesAvail
);
[PreserveSig]
new int GetSourceEntriesByLine(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SYMBOL_SOURCE_ENTRY[] Entries,
[In] UInt32 EntriesCount,
[Out] out UInt32 EntriesAvail
);
[PreserveSig]
new int GetSourceEntriesByLineWide(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SYMBOL_SOURCE_ENTRY[] Entries,
[In] UInt32 EntriesCount,
[Out] out UInt32 EntriesAvail
);
[PreserveSig]
new int GetSourceEntryString(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_SYMBOL_SOURCE_ENTRY Entry,
[In] UInt32 Which,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize
);
[PreserveSig]
new int GetSourceEntryStringWide(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_SYMBOL_SOURCE_ENTRY Entry,
[In] UInt32 Which,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize
);
[PreserveSig]
new int GetSourceEntryOffsetRegions(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_SYMBOL_SOURCE_ENTRY Entry,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_OFFSET_REGION[] Regions,
[In] UInt32 RegionsCount,
[Out] out UInt32 RegionsAvail
);
[PreserveSig]
new int GetSourceEntryBySourceEntry(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_SYMBOL_SOURCE_ENTRY FromEntry,
[In] UInt32 Flags,
[Out] out DEBUG_SYMBOL_SOURCE_ENTRY ToEntry
);
/* IDebugSymbols4 */
[PreserveSig]
int GetScopeEx(
[Out] out UInt64 InstructionOffset,
[Out] out DEBUG_STACK_FRAME_EX ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize
);
[PreserveSig]
int SetScopeEx(
[In] UInt64 InstructionOffset,
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_STACK_FRAME_EX ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize
);
[PreserveSig]
int GetNameByInlineContext(
[In] UInt64 Offset,
[In] UInt32 InlineContext,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement
);
[PreserveSig]
int GetNameByInlineContextWide(
[In] UInt64 Offset,
[In] UInt32 InlineContext,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement
);
[PreserveSig]
int GetLineByInlineContext(
[In] UInt64 Offset,
[In] UInt32 InlineContext,
[Out] out UInt32 Line,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer,
[In] Int32 FileBufferSize,
[Out] out UInt32 FileSize,
[Out] out UInt64 Displacement
);
[PreserveSig]
int GetLineByInlineContextWide(
[In] UInt64 Offset,
[In] UInt32 InlineContext,
[Out] out UInt32 Line,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder FileBuffer,
[In] Int32 FileBufferSize,
[Out] out UInt32 FileSize,
[Out] out UInt64 Displacement
);
[PreserveSig]
int OutputSymbolByInlineContext(
[In] UInt32 OutputControl,
[In] UInt32 Flags,
[In] UInt64 Offset,
[In] UInt32 InlineContext
);
}
}

Просмотреть файл

@ -0,0 +1,939 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("c65fa83e-1e69-475e-8e0e-b5d79e9cc17e")]
public interface IDebugSymbols5 : IDebugSymbols4
{
/* IDebugSymbols */
[PreserveSig]
new int GetSymbolOptions(
[Out] out SYMOPT Options);
[PreserveSig]
new int AddSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
new int RemoveSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
new int SetSymbolOptions(
[In] SYMOPT Options);
[PreserveSig]
new int GetNameByOffset(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetOffsetByName(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt64 Offset);
[PreserveSig]
new int GetNearNameByOffset(
[In] UInt64 Offset,
[In] int Delta,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetLineByOffset(
[In] UInt64 Offset,
[Out] out UInt32 Line,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer,
[In] Int32 FileBufferSize,
[Out] out UInt32 FileSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetOffsetByLine(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[Out] out UInt64 Offset);
[PreserveSig]
new int GetNumberModules(
[Out] out UInt32 Loaded,
[Out] out UInt32 Unloaded);
[PreserveSig]
new int GetModuleByIndex(
[In] UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetModuleByModuleName(
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[In] UInt32 StartIndex,
[Out] out UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetModuleByOffset(
[In] UInt64 Offset,
[In] UInt32 StartIndex,
[Out] out UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetModuleNames(
[In] UInt32 Index,
[In] UInt64 Base,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ImageNameBuffer,
[In] Int32 ImageNameBufferSize,
[Out] out UInt32 ImageNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder ModuleNameBuffer,
[In] Int32 ModuleNameBufferSize,
[Out] out UInt32 ModuleNameSize,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder LoadedImageNameBuffer,
[In] Int32 LoadedImageNameBufferSize,
[Out] out UInt32 LoadedImageNameSize);
[PreserveSig]
new int GetModuleParameters(
[In] UInt32 Count,
[In, MarshalAs(UnmanagedType.LPArray)] UInt64[] Bases,
[In] UInt32 Start,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_PARAMETERS[] Params);
[PreserveSig]
new int GetSymbolModule(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt64 Base);
[PreserveSig]
new int GetTypeName(
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetTypeId(
[In] UInt64 Module,
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[Out] out UInt32 TypeId);
[PreserveSig]
new int GetTypeSize(
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out] out UInt32 Size);
[PreserveSig]
new int GetFieldOffset(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In, MarshalAs(UnmanagedType.LPStr)] string Field,
[Out] out UInt32 Offset);
[PreserveSig]
new int GetSymbolTypeId(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[Out] out UInt32 TypeId,
[Out] out UInt64 Module);
[PreserveSig]
new int GetOffsetTypeId(
[In] UInt64 Offset,
[Out] out UInt32 TypeId,
[Out] out UInt64 Module);
[PreserveSig]
new int ReadTypedDataVirtual(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteTypedDataVirtual(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int OutputTypedDataVirtual(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] DEBUG_TYPEOPTS Flags);
[PreserveSig]
new int ReadTypedDataPhysical(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesRead);
[PreserveSig]
new int WriteTypedDataPhysical(
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BytesWritten);
[PreserveSig]
new int OutputTypedDataPhysical(
[In] DEBUG_OUTCTL OutputControl,
[In] UInt64 Offset,
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] DEBUG_TYPEOPTS Flags);
[PreserveSig]
new int GetScope(
[Out] out UInt64 InstructionOffset,
[Out] out DEBUG_STACK_FRAME ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize);
[PreserveSig]
new int SetScope(
[In] UInt64 InstructionOffset,
[In] DEBUG_STACK_FRAME ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize);
[PreserveSig]
new int ResetScope();
[PreserveSig]
new int GetScopeSymbolGroup(
[In] 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] out UInt64 Handle);
[PreserveSig]
new int GetNextSymbolMatch(
[In] UInt64 Handle,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 MatchSize,
[Out] out UInt64 Offset);
[PreserveSig]
new int EndSymbolMatch(
[In] UInt64 Handle);
[PreserveSig]
new int Reload(
[In, MarshalAs(UnmanagedType.LPStr)] string Module);
[PreserveSig]
new int GetSymbolPath(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 PathSize);
[PreserveSig]
new int GetSourcePathElement(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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(
[In] UInt32 StartElement,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[In] DEBUG_FIND_SOURCE Flags,
[Out] out UInt32 FoundElement,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 FoundSize);
[PreserveSig]
new int GetSourceFileLineOffsets(
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Buffer,
[In] Int32 BufferLines,
[Out] out UInt32 FileLines);
/* IDebugSymbols2 */
[PreserveSig]
new int GetModuleVersionInformation(
[In] UInt32 Index,
[In] UInt64 Base,
[In, MarshalAs(UnmanagedType.LPStr)] string Item,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 VerInfoSize);
[PreserveSig]
new int GetModuleNameString(
[In] DEBUG_MODNAME Which,
[In] UInt32 Index,
[In] UInt64 Base,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetConstantName(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt64 Value,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetFieldName(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt32 FieldIndex,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetTypeOptions(
[Out] out DEBUG_TYPEOPTS Options);
[PreserveSig]
new int AddTypeOptions(
[In] DEBUG_TYPEOPTS Options);
[PreserveSig]
new int RemoveTypeOptions(
[In] DEBUG_TYPEOPTS Options);
[PreserveSig]
new int SetTypeOptions(
[In] DEBUG_TYPEOPTS Options);
/* IDebugSymbols3 */
[PreserveSig]
new int GetNameByOffsetWide(
[In] UInt64 Offset,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetOffsetByNameWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Symbol,
[Out] out UInt64 Offset);
[PreserveSig]
new int GetNearNameByOffsetWide(
[In] UInt64 Offset,
[In] int Delta,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetLineByOffsetWide(
[In] UInt64 Offset,
[Out] out UInt32 Line,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder FileBuffer,
[In] Int32 FileBufferSize,
[Out] out UInt32 FileSize,
[Out] out UInt64 Displacement);
[PreserveSig]
new int GetOffsetByLineWide(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[Out] out UInt64 Offset);
[PreserveSig]
new int GetModuleByModuleNameWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[In] UInt32 StartIndex,
[Out] out UInt32 Index,
[Out] out UInt64 Base);
[PreserveSig]
new int GetSymbolModuleWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Symbol,
[Out] out UInt64 Base);
[PreserveSig]
new int GetTypeNameWide(
[In] UInt64 Module,
[In] UInt32 TypeId,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetTypeIdWide(
[In] UInt64 Module,
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[Out] out UInt32 TypeId);
[PreserveSig]
new int GetFieldOffsetWide(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In, MarshalAs(UnmanagedType.LPWStr)] string Field,
[Out] out UInt32 Offset);
[PreserveSig]
new int GetSymbolTypeIdWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Symbol,
[Out] out UInt32 TypeId,
[Out] out UInt64 Module);
[PreserveSig]
new int GetScopeSymbolGroup2(
[In] 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] out UInt64 Handle);
[PreserveSig]
new int GetNextSymbolMatchWide(
[In] UInt64 Handle,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 MatchSize,
[Out] out UInt64 Offset);
[PreserveSig]
new int ReloadWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Module);
[PreserveSig]
new int GetSymbolPathWide(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 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,
[In] Int32 BufferSize,
[Out] out UInt32 PathSize);
[PreserveSig]
new int GetSourcePathElementWide(
[In] UInt32 Index,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 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(
[In] UInt32 StartElement,
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[In] DEBUG_FIND_SOURCE Flags,
[Out] out UInt32 FoundElement,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 FoundSize);
[PreserveSig]
new int GetSourceFileLineOffsetsWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Buffer,
[In] Int32 BufferLines,
[Out] out UInt32 FileLines);
[PreserveSig]
new int GetModuleVersionInformationWide(
[In] UInt32 Index,
[In] UInt64 Base,
[In, MarshalAs(UnmanagedType.LPWStr)] string Item,
[In] IntPtr Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 VerInfoSize);
[PreserveSig]
new int GetModuleNameStringWide(
[In] DEBUG_MODNAME Which,
[In] UInt32 Index,
[In] UInt64 Base,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetConstantNameWide(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt64 Value,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int GetFieldNameWide(
[In] UInt64 Module,
[In] UInt32 TypeId,
[In] UInt32 FieldIndex,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 NameSize);
[PreserveSig]
new int IsManagedModule(
[In] UInt32 Index,
[In] UInt64 Base
);
[PreserveSig]
new int GetModuleByModuleName2(
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[In] UInt32 StartIndex,
[In] DEBUG_GETMOD Flags,
[Out] out UInt32 Index,
[Out] out UInt64 Base
);
[PreserveSig]
new int GetModuleByModuleName2Wide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[In] UInt32 StartIndex,
[In] DEBUG_GETMOD Flags,
[Out] out UInt32 Index,
[Out] out UInt64 Base
);
[PreserveSig]
new int GetModuleByOffset2(
[In] UInt64 Offset,
[In] UInt32 StartIndex,
[In] DEBUG_GETMOD Flags,
[Out] out UInt32 Index,
[Out] out UInt64 Base
);
[PreserveSig]
new int AddSyntheticModule(
[In] UInt64 Base,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPStr)] string ImagePath,
[In, MarshalAs(UnmanagedType.LPStr)] string ModuleName,
[In] DEBUG_ADDSYNTHMOD Flags
);
[PreserveSig]
new int AddSyntheticModuleWide(
[In] UInt64 Base,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPWStr)] string ImagePath,
[In, MarshalAs(UnmanagedType.LPWStr)] string ModuleName,
[In] DEBUG_ADDSYNTHMOD Flags
);
[PreserveSig]
new int RemoveSyntheticModule(
[In] UInt64 Base
);
[PreserveSig]
new int GetCurrentScopeFrameIndex(
[Out] out UInt32 Index
);
[PreserveSig]
new int SetScopeFrameByIndex(
[In] UInt32 Index
);
[PreserveSig]
new int SetScopeFromJitDebugInfo(
[In] UInt32 OutputControl,
[In] UInt64 InfoOffset
);
[PreserveSig]
new int SetScopeFromStoredEvent(
);
[PreserveSig]
new int OutputSymbolByOffset(
[In] UInt32 OutputControl,
[In] DEBUG_OUTSYM Flags,
[In] UInt64 Offset
);
[PreserveSig]
new int GetFunctionEntryByOffset(
[In] UInt64 Offset,
[In] DEBUG_GETFNENT Flags,
[In] IntPtr Buffer,
[In] UInt32 BufferSize,
[Out] out UInt32 BufferNeeded
);
[PreserveSig]
new int GetFieldTypeAndOffset(
[In] UInt64 Module,
[In] UInt32 ContainerTypeId,
[In, MarshalAs(UnmanagedType.LPStr)] string Field,
[Out] out UInt32 FieldTypeId,
[Out] out UInt32 Offset
);
[PreserveSig]
new int GetFieldTypeAndOffsetWide(
[In] UInt64 Module,
[In] UInt32 ContainerTypeId,
[In, MarshalAs(UnmanagedType.LPWStr)] string Field,
[Out] out UInt32 FieldTypeId,
[Out] out UInt32 Offset
);
[PreserveSig]
new int AddSyntheticSymbol(
[In] UInt64 Offset,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPStr)] string Name,
[In] DEBUG_ADDSYNTHSYM Flags,
[Out] out DEBUG_MODULE_AND_ID Id
);
[PreserveSig]
new int AddSyntheticSymbolWide(
[In] UInt64 Offset,
[In] UInt32 Size,
[In, MarshalAs(UnmanagedType.LPWStr)] string Name,
[In] DEBUG_ADDSYNTHSYM Flags,
[Out] out DEBUG_MODULE_AND_ID Id
);
[PreserveSig]
new int RemoveSyntheticSymbol([In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID Id
);
[PreserveSig]
new int GetSymbolEntriesByOffset(
[In] UInt64 Offset,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_AND_ID[] Ids,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt64[] Displacements,
[In] UInt32 IdsCount,
[Out] out UInt32 Entries
);
[PreserveSig]
new int GetSymbolEntriesByName(
[In, MarshalAs(UnmanagedType.LPStr)] string Symbol,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_AND_ID[] Ids,
[In] UInt32 IdsCount,
[Out] out UInt32 Entries
);
[PreserveSig]
new int GetSymbolEntriesByNameWide(
[In, MarshalAs(UnmanagedType.LPWStr)] string Symbol,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_MODULE_AND_ID[] Ids,
[In] UInt32 IdsCount,
[Out] out UInt32 Entries
);
[PreserveSig]
new int GetSymbolEntryByToken(
[In] UInt64 ModuleBase,
[In] UInt32 Token,
[Out] out DEBUG_MODULE_AND_ID Id
);
[PreserveSig]
new unsafe int GetSymbolEntryInformation(
[In] DEBUG_MODULE_AND_ID* Id,
[Out] out DEBUG_SYMBOL_ENTRY Info
);
[PreserveSig]
new int GetSymbolEntryString(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID Id,
[In] UInt32 Which,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize
);
[PreserveSig]
new int GetSymbolEntryStringWide(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID Id,
[In] UInt32 Which,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize
);
[PreserveSig]
new int GetSymbolEntryOffsetRegions(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID Id,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_OFFSET_REGION[] Regions,
[In] UInt32 RegionsCount,
[Out] out UInt32 RegionsAvail
);
[Obsolete( "Do not use: no longer implemented.", true )]
[PreserveSig]
new int GetSymbolEntryBySymbolEntry(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_MODULE_AND_ID FromId,
[In] UInt32 Flags,
[Out] out DEBUG_MODULE_AND_ID ToId
);
[PreserveSig]
new int GetSourceEntriesByOffset(
[In] UInt64 Offset,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SYMBOL_SOURCE_ENTRY[] Entries,
[In] UInt32 EntriesCount,
[Out] out UInt32 EntriesAvail
);
[PreserveSig]
new int GetSourceEntriesByLine(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPStr)] string File,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SYMBOL_SOURCE_ENTRY[] Entries,
[In] UInt32 EntriesCount,
[Out] out UInt32 EntriesAvail
);
[PreserveSig]
new int GetSourceEntriesByLineWide(
[In] UInt32 Line,
[In, MarshalAs(UnmanagedType.LPWStr)] string File,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_SYMBOL_SOURCE_ENTRY[] Entries,
[In] UInt32 EntriesCount,
[Out] out UInt32 EntriesAvail
);
[PreserveSig]
new int GetSourceEntryString(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_SYMBOL_SOURCE_ENTRY Entry,
[In] UInt32 Which,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize
);
[PreserveSig]
new int GetSourceEntryStringWide(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_SYMBOL_SOURCE_ENTRY Entry,
[In] UInt32 Which,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 StringSize
);
[PreserveSig]
new int GetSourceEntryOffsetRegions(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_SYMBOL_SOURCE_ENTRY Entry,
[In] UInt32 Flags,
[Out, MarshalAs(UnmanagedType.LPArray)] DEBUG_OFFSET_REGION[] Regions,
[In] UInt32 RegionsCount,
[Out] out UInt32 RegionsAvail
);
[PreserveSig]
new int GetSourceEntryBySourceEntry(
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_SYMBOL_SOURCE_ENTRY FromEntry,
[In] UInt32 Flags,
[Out] out DEBUG_SYMBOL_SOURCE_ENTRY ToEntry
);
/* IDebugSymbols4 */
[PreserveSig]
new int GetScopeEx(
[Out] out UInt64 InstructionOffset,
[Out] out DEBUG_STACK_FRAME_EX ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize
);
[PreserveSig]
new int SetScopeEx(
[In] UInt64 InstructionOffset,
[In, MarshalAs(UnmanagedType.LPStruct)] DEBUG_STACK_FRAME_EX ScopeFrame,
[In] IntPtr ScopeContext,
[In] UInt32 ScopeContextSize
);
[PreserveSig]
new int GetNameByInlineContext(
[In] UInt64 Offset,
[In] UInt32 InlineContext,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement
);
[PreserveSig]
new int GetNameByInlineContextWide(
[In] UInt64 Offset,
[In] UInt32 InlineContext,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder NameBuffer,
[In] Int32 NameBufferSize,
[Out] out UInt32 NameSize,
[Out] out UInt64 Displacement
);
[PreserveSig]
new int GetLineByInlineContext(
[In] UInt64 Offset,
[In] UInt32 InlineContext,
[Out] out UInt32 Line,
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder FileBuffer,
[In] Int32 FileBufferSize,
[Out] out UInt32 FileSize,
[Out] out UInt64 Displacement
);
[PreserveSig]
new int GetLineByInlineContextWide(
[In] UInt64 Offset,
[In] UInt32 InlineContext,
[Out] out UInt32 Line,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder FileBuffer,
[In] Int32 FileBufferSize,
[Out] out UInt32 FileSize,
[Out] out UInt64 Displacement
);
[PreserveSig]
new int OutputSymbolByInlineContext(
[In] UInt32 OutputControl,
[In] UInt32 Flags,
[In] UInt64 Offset,
[In] UInt32 InlineContext
);
/* IDebugSymbols5 */
[PreserveSig]
int GetCurrentScopeFrameIndexEx(
[In] DEBUG_FRAME Flags,
[Out] out UInt32 Index
);
[PreserveSig]
int SetScopeFrameByIndexEx(
[In] DEBUG_FRAME Flags,
[In] UInt32 Index
);
}
}

Просмотреть файл

@ -0,0 +1,149 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("6b86fe2c-2c4f-4f0c-9da2-174311acc327")]
public interface IDebugSystemObjects
{
[PreserveSig]
int GetEventThread(
[Out] out UInt32 Id);
[PreserveSig]
int GetEventProcess(
[Out] out UInt32 Id);
[PreserveSig]
int GetCurrentThreadId(
[Out] out UInt32 Id);
[PreserveSig]
int SetCurrentThreadId(
[In] UInt32 Id);
[PreserveSig]
int GetCurrentProcessId(
[Out] out UInt32 Id);
[PreserveSig]
int SetCurrentProcessId(
[In] UInt32 Id);
[PreserveSig]
int GetNumberThreads(
[Out] out UInt32 Number);
[PreserveSig]
int GetTotalNumberThreads(
[Out] out UInt32 Total,
[Out] out UInt32 LargestProcess);
[PreserveSig]
int GetThreadIdsByIndex(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] SysIds);
[PreserveSig]
int GetThreadIdByProcessor(
[In] UInt32 Processor,
[Out] out UInt32 Id);
[PreserveSig]
int GetCurrentThreadDataOffset(
[Out] out UInt64 Offset);
[PreserveSig]
int GetThreadIdByDataOffset(
[In] UInt64 Offset,
[Out] out UInt32 Id);
[PreserveSig]
int GetCurrentThreadTeb(
[Out] out UInt64 Offset);
[PreserveSig]
int GetThreadIdByTeb(
[In] UInt64 Offset,
[Out] out UInt32 Id);
[PreserveSig]
int GetCurrentThreadSystemId(
[Out] out UInt32 SysId);
[PreserveSig]
int GetThreadIdBySystemId(
[In] UInt32 SysId,
[Out] out UInt32 Id);
[PreserveSig]
int GetCurrentThreadHandle(
[Out] out UInt64 Handle);
[PreserveSig]
int GetThreadIdByHandle(
[In] UInt64 Handle,
[Out] out UInt32 Id);
[PreserveSig]
int GetNumberProcesses(
[Out] out UInt32 Number);
[PreserveSig]
int GetProcessIdsByIndex(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] SysIds);
[PreserveSig]
int GetCurrentProcessDataOffset(
[Out] out UInt64 Offset);
[PreserveSig]
int GetProcessIdByDataOffset(
[In] UInt64 Offset,
[Out] out UInt32 Id);
[PreserveSig]
int GetCurrentProcessPeb(
[Out] out UInt64 Offset);
[PreserveSig]
int GetProcessIdByPeb(
[In] UInt64 Offset,
[Out] out UInt32 Id);
[PreserveSig]
int GetCurrentProcessSystemId(
[Out] out UInt32 SysId);
[PreserveSig]
int GetProcessIdBySystemId(
[In] UInt32 SysId,
[Out] out UInt32 Id);
[PreserveSig]
int GetCurrentProcessHandle(
[Out] out UInt64 Handle);
[PreserveSig]
int GetProcessIdByHandle(
[In] UInt64 Handle,
[Out] out UInt32 Id);
[PreserveSig]
int GetCurrentProcessExecutableName(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ExeSize);
}
}

Просмотреть файл

@ -0,0 +1,173 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0ae9f5ff-1852-4679-b055-494bee6407ee")]
public interface IDebugSystemObjects2 : IDebugSystemObjects
{
/* IDebugSystemObjects */
[PreserveSig]
new int GetEventThread(
[Out] out UInt32 Id);
[PreserveSig]
new int GetEventProcess(
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentThreadId(
[Out] out UInt32 Id);
[PreserveSig]
new int SetCurrentThreadId(
[In] UInt32 Id);
[PreserveSig]
new int GetCurrentProcessId(
[Out] out UInt32 Id);
[PreserveSig]
new int SetCurrentProcessId(
[In] UInt32 Id);
[PreserveSig]
new int GetNumberThreads(
[Out] out UInt32 Number);
[PreserveSig]
new int GetTotalNumberThreads(
[Out] out UInt32 Total,
[Out] out UInt32 LargestProcess);
[PreserveSig]
new int GetThreadIdsByIndex(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] SysIds);
[PreserveSig]
new int GetThreadIdByProcessor(
[In] UInt32 Processor,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentThreadDataOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int GetThreadIdByDataOffset(
[In] UInt64 Offset,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentThreadTeb(
[Out] out UInt64 Offset);
[PreserveSig]
new int GetThreadIdByTeb(
[In] UInt64 Offset,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentThreadSystemId(
[Out] out UInt32 SysId);
[PreserveSig]
new int GetThreadIdBySystemId(
[In] UInt32 SysId,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentThreadHandle(
[Out] out UInt64 Handle);
[PreserveSig]
new int GetThreadIdByHandle(
[In] UInt64 Handle,
[Out] out UInt32 Id);
[PreserveSig]
new int GetNumberProcesses(
[Out] out UInt32 Number);
[PreserveSig]
new int GetProcessIdsByIndex(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] SysIds);
[PreserveSig]
new int GetCurrentProcessDataOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int GetProcessIdByDataOffset(
[In] UInt64 Offset,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentProcessPeb(
[Out] out UInt64 Offset);
[PreserveSig]
new int GetProcessIdByPeb(
[In] UInt64 Offset,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentProcessSystemId(
[Out] out UInt32 SysId);
[PreserveSig]
new int GetProcessIdBySystemId(
[In] UInt32 SysId,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentProcessHandle(
[Out] out UInt64 Handle);
[PreserveSig]
new int GetProcessIdByHandle(
[In] UInt64 Handle,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentProcessExecutableName(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ExeSize);
/* IDebugSystemObjects2 */
[PreserveSig]
int GetCurrentProcessUpTime(
[Out] out uint UpTime);
[PreserveSig]
int GetImplicitThreadDataOffset(
[Out] out UInt64 Offset);
[PreserveSig]
int SetImplicitThreadDataOffset(
[In] UInt64 Offset);
[PreserveSig]
int GetImplicitProcessDataOffset(
[Out] out UInt64 Offset);
[PreserveSig]
int SetImplicitProcessDataOffset(
[In] UInt64 Offset);
}
}

Просмотреть файл

@ -0,0 +1,203 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("e9676e2f-e286-4ea3-b0f9-dfe5d9fc330e")]
public interface IDebugSystemObjects3 : IDebugSystemObjects
{
/* IDebugSystemObjects */
[PreserveSig]
new int GetEventThread(
[Out] out UInt32 Id);
[PreserveSig]
new int GetEventProcess(
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentThreadId(
[Out] out UInt32 Id);
[PreserveSig]
new int SetCurrentThreadId(
[In] UInt32 Id);
[PreserveSig]
new int GetCurrentProcessId(
[Out] out UInt32 Id);
[PreserveSig]
new int SetCurrentProcessId(
[In] UInt32 Id);
[PreserveSig]
new int GetNumberThreads(
[Out] out UInt32 Number);
[PreserveSig]
new int GetTotalNumberThreads(
[Out] out UInt32 Total,
[Out] out UInt32 LargestProcess);
[PreserveSig]
new int GetThreadIdsByIndex(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] SysIds);
[PreserveSig]
new int GetThreadIdByProcessor(
[In] UInt32 Processor,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentThreadDataOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int GetThreadIdByDataOffset(
[In] UInt64 Offset,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentThreadTeb(
[Out] out UInt64 Offset);
[PreserveSig]
new int GetThreadIdByTeb(
[In] UInt64 Offset,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentThreadSystemId(
[Out] out UInt32 SysId);
[PreserveSig]
new int GetThreadIdBySystemId(
[In] UInt32 SysId,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentThreadHandle(
[Out] out UInt64 Handle);
[PreserveSig]
new int GetThreadIdByHandle(
[In] UInt64 Handle,
[Out] out UInt32 Id);
[PreserveSig]
new int GetNumberProcesses(
[Out] out UInt32 Number);
[PreserveSig]
new int GetProcessIdsByIndex(
[In] UInt32 Start,
[In] UInt32 Count,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids,
[Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] SysIds);
[PreserveSig]
new int GetCurrentProcessDataOffset(
[Out] out UInt64 Offset);
[PreserveSig]
new int GetProcessIdByDataOffset(
[In] UInt64 Offset,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentProcessPeb(
[Out] out UInt64 Offset);
[PreserveSig]
new int GetProcessIdByPeb(
[In] UInt64 Offset,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentProcessSystemId(
[Out] out UInt32 SysId);
[PreserveSig]
new int GetProcessIdBySystemId(
[In] UInt32 SysId,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentProcessHandle(
[Out] out UInt64 Handle);
[PreserveSig]
new int GetProcessIdByHandle(
[In] UInt64 Handle,
[Out] out UInt32 Id);
[PreserveSig]
new int GetCurrentProcessExecutableName(
[Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer,
[In] Int32 BufferSize,
[Out] out UInt32 ExeSize);
/* IDebugSystemObjects2 */
[PreserveSig]
int GetCurrentProcessUpTime(
[Out] out uint UpTime);
[PreserveSig]
int GetImplicitThreadDataOffset(
[Out] out UInt64 Offset);
[PreserveSig]
int SetImplicitThreadDataOffset(
[In] UInt64 Offset);
[PreserveSig]
int GetImplicitProcessDataOffset(
[Out] out UInt64 Offset);
[PreserveSig]
int SetImplicitProcessDataOffset(
[In] UInt64 Offset);
/* IDebugSystemObjects3 */
[PreserveSig]
int GetEventSystem([Out] out uint id);
[PreserveSig]
int GetCurrentSystemId([Out] out uint id);
[PreserveSig]
int SetCurrentSystemId([In] uint id);
[PreserveSig]
int GetNumberSystems([Out] out uint count);
[PreserveSig]
int GetSystemIdsByIndex([In] uint start, [In] uint count, [Out, MarshalAs(UnmanagedType.LPArray)] UInt32[] Ids);
[PreserveSig]
int GetTotalNumberThreadsAndProcesses([Out] out uint totalThreads, [Out] out uint totalProcesses,
[Out] out uint largestProcessThreads, [Out] out uint largestSystemThreads,
[Out] out uint largestSystemProcesses);
[PreserveSig]
int GetCurrentSystemServer([Out] out ulong server);
[PreserveSig]
int GetSystemByServer([In] ulong server, [Out] out uint id);
[PreserveSig]
int GetCurrentSystemServerName([Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder buffer, [In] uint size, [Out] out uint needed);
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,383 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
public enum IoctlCode : ushort
{
DumpSymbolInfo = 22, // IG_DUMP_SYMBOL_INFO
}
// Corresponds to DEBUG_DUMP_XXX defines.
[Flags]
public enum DbgDump : uint
{
NO_INDENT = 0x00000001, // Fields are not indented if this is set
NO_OFFSET = 0x00000002, // Offsets are not printed if this is set
VERBOSE = 0x00000004, // Verbose output
CALL_FOR_EACH = 0x00000008, // Callback is done for each of fields
LIST = 0x00000020, // A list of type is dumped, listLink should have info about next element pointer
NO_PRINT = 0x00000040, // Nothing is printed if this is set (only callbacks and data copies done)
GET_SIZE_ONLY = 0x00000080, // Ioctl returns the size as usual, but will not do field prints/callbacks if this is set
COMPACT_OUT = 0x00002000, // No newlines are printed after each field
ARRAY = 0x00008000, // An array of type is dumped, number of elements can be specified in listLink->size
ADDRESS_OF_FIELD = 0x00010000, // The specified addr value is actually the address of field listLink->fName
ADDRESS_AT_END = 0x00020000, // The specified addr value is actually the adress at the end of type
COPY_TYPE_DATA = 0x00040000, // This could be used to copy only the primitive types like ULONG, PVOID etc. - will not work with structures/unions
READ_PHYSICAL = 0x00080000, // Flag to allow read directly from physical memory
FUNCTION_FORMAT = 0x00100000, // This causes a function type to be dumped in format function(arg1, arg2, ...)
BLOCK_RECURSE = 0x00200000, // This recurses on a struct but doesn't expand pointers
MATCH_SIZE = 0x00400000, // Match the type size to resolve ambiguity in case multiple matches with same name are available
} // end enum DbgDump
public class WdbgExts
{
private IDebugControl6 m_debugControl;
public WdbgExts( IDebugControl6 debugControl )
{
if( null == debugControl )
throw new ArgumentNullException( "debugControl" );
m_debugControl = debugControl;
} // end constructor
public IList< FieldInfo > GetSymbolFields( uint typeId, ulong modBase )
{
SYM_DUMP_PARAM sdp = new SYM_DUMP_PARAM();
sdp.size = (uint) Marshal.SizeOf( sdp );
sdp.Options = DbgDump.NO_PRINT | DbgDump.CALL_FOR_EACH;
sdp.ModBase = modBase; // presumably this makes it so we don't have to search all modules? (it's doc'ed as an 'out' param)
List< FieldInfo > fields = new List< FieldInfo >();
GCHandle gchFields = GCHandle.Alloc( fields );
SYM_DUMP_FIELD_CALLBACK callback = new SYM_DUMP_FIELD_CALLBACK(_My_SYM_DUMP_FIELD_CALLBACK);
sdp.Context = GCHandle.ToIntPtr( gchFields );
sdp.CallbackRoutine = Marshal.GetFunctionPointerForDelegate( callback );
sdp.TypeId = typeId;
try
{
int err = Ioctl( IoctlCode.DumpSymbolInfo, sdp );
if( 0 != err )
{
// TODO: proper error
throw new Exception( String.Format( "Ioctl for DumpSymbolInfo returned: {0}", err ) );
}
DebugModuleAndId dmai = new DebugModuleAndId( modBase, typeId );
foreach( var field in fields )
{
field.OwningType = dmai;
}
return fields.AsReadOnly();
}
finally
{
gchFields.Free();
GC.KeepAlive(callback);
}
} // end GetSymbolFields
private int _My_SYM_DUMP_FIELD_CALLBACK( FIELD_INFO pField, IntPtr userContext )
{
GCHandle gchFields = GCHandle.FromIntPtr( userContext );
List< FieldInfo > fields = (List< FieldInfo >) gchFields.Target;
fields.Add( new FieldInfo( fields.Count, pField ) );
return 0;
} // end _My_SYM_DUMP_FIELD_CALLBACK()
private WINDBG_EXTENSION_APIS? m_extApis;
private WINDBG_EXTENSION_APIS _ExtensionApis
{
get
{
if( null == m_extApis )
{
// TODO: does this depend on the debugger bitness or the target bitness? I'm
// guessing debugger bitness.
WINDBG_EXTENSION_APIS wdbgExts = new WINDBG_EXTENSION_APIS();
wdbgExts.nSize = (uint) Marshal.SizeOf( wdbgExts );
int hr;
if( Is32Bit )
hr = m_debugControl.GetWindbgExtensionApis32( ref wdbgExts );
else
hr = m_debugControl.GetWindbgExtensionApis64( ref wdbgExts );
if( 0 != hr )
// TODO: proper error
throw new Exception( String.Format( "Couldn't get wdbgexts API: 0x{0:x8}", hr ) );
m_extApis = wdbgExts;
}
return (WINDBG_EXTENSION_APIS) m_extApis;
}
} // end property _ExtensionApis
private IoctlDelegate m_ioctl;
private IoctlDelegate _NativeIoctl
{
get
{
if( null == m_ioctl )
{
m_ioctl = (IoctlDelegate) Marshal.GetDelegateForFunctionPointer( _ExtensionApis.lpIoctlRoutine,
typeof( IoctlDelegate ) );
}
return m_ioctl;
}
} // end property _NativeIoctl
public int Ioctl( IoctlCode ioctlType, object data )
{
uint size = (uint) Marshal.SizeOf( data );
GCHandle gch = GCHandle.Alloc( data, GCHandleType.Pinned );
int err = -1;
try
{
IntPtr ptr = gch.AddrOfPinnedObject();
err = _NativeIoctl( (ushort) ioctlType, ptr, size );
}
finally
{
gch.Free();
}
return err;
} // end Ioctl
private bool? m_is32bit;
public bool Is32Bit
{
get
{
if( null == m_is32bit )
{
int hr = m_debugControl.IsPointer64Bit();
if( 0 == hr )
m_is32bit = false;
else if( 1 == hr )
m_is32bit = true;
else
// TODO: proper error
throw new Exception( String.Format( "IsPointer64Bit failed: {0:x8}", hr ) );
}
return (bool) m_is32bit;
}
}
} // end class WdbgExts
[StructLayout( LayoutKind.Sequential )]
public class FIELD_INFO
{
[MarshalAs( UnmanagedType.LPStr )]
public string fName; // Name of the field
[MarshalAs( UnmanagedType.LPStr )]
public string printName; // Name to be printed at dump
public uint size; // Size of the field
public uint fOptions; // Dump Options for the field
public ulong address; // address of the field
public IntPtr pBuffer;
//union {
// PVOID fieldCallBack; // Return info or callBack routine for the field
// PVOID pBuffer; // the type data is copied into this
//};
public uint TypeId; // OUT Type index of the field
public uint FieldOffset; // OUT Offset of field inside struct
public uint BufferSize; // size of buffer used with DBG_DUMP_FIELD_COPY_FIELD_DATA
public uint BitField;
//struct _BitField {
// USHORT Position; // OUT set to start position for bitfield
// USHORT Size; // OUT set to size for bitfields
//} BitField;
public uint Flags;
//uint fPointer:2; // OUT set to 1 for pointers, 3 for 64bit pointers
//uint fArray:1; // OUT set to 1 for array types
//uint fStruct:1; // OUT set to 1 for struct/class tyoes
//uint fConstant:1; // OUT set to 1 for constants (enumerate as fields)
//uint fStatic:1; // OUT set to 1 for statics (class/struct static members)
//uint Reserved:26; // unused
} // end class FIELD_INFO
public delegate int SYM_DUMP_FIELD_CALLBACK( FIELD_INFO pField, IntPtr userContext );
public delegate int IoctlDelegate( ushort IoctlType, IntPtr lpvData, uint cbSizeOfContext );
[StructLayout( LayoutKind.Sequential )]
public struct SYM_DUMP_PARAM
{
public uint size; // size of this struct
// Need to declare as IntPtr so that we can pin this structure.
//[MarshalAs( UnmanagedType.LPStr )]
//public string sName; // type name
public IntPtr sName; // type name
public DbgDump Options; // Dump options
public ulong addr; // Address to take data for type
public IntPtr listLink; // fName here would be used to do list dump // PFIELD_INFO
public IntPtr Context;
// union {
// PVOID Context; // Usercontext passed to CallbackRoutine
// PVOID pBuffer; // the type data is copied into this
//};
// The CallbackRoutine member cannot be a delegate type because a delegate is not
// a blittable data type--if we included a non-blittable data type in this
// structure, then we wouldn't be able to pin it. So we'll make it an IntPtr
// instead and use Marshal.GetFunctionPointerForDelegate.
//public SYM_DUMP_FIELD_CALLBACK CallbackRoutine; // Routine called back
public IntPtr CallbackRoutine; // Routine called back
public uint nFields; // # elements in Fields
public IntPtr Fields; // Used to return information about field // PFIELD_INFO
public ulong ModBase; // OUT Module base address containing type
public uint TypeId; // OUT Type index of the symbol
public uint TypeSize; // OUT Size of type
public uint BufferSize; // IN size of buffer (used with DBG_DUMP_COPY_TYPE_DATA)
public uint Flags;
//uint fPointer:2; // OUT set to 1 for pointers, 3 for 64bit pointers
//uint fArray:1; // OUT set to 1 for array types
//uint fStruct:1; // OUT set to 1 for struct/class tyoes
//uint fConstant:1; // OUT set to 1 for constant types (unused)
//uint Reserved:27; // unused
} // end struct SYM_DUMP_PARAM
public enum PointerFlag
{
None = 0,
Pointer = 1,
Pointer64 = 3
}
public class FieldInfo : IEquatable< FieldInfo >
{
public int Index { get; private set; }
public string Name { get; private set; }
public string PrintName { get; private set; }
public uint Size { get; private set; }
//public uint fOptions { get; private set; } // TODO: enum?
//public ulong Address { get; private set; }
// TODO: what to do about the pBuffer?
// TODO: should I put these 'out' fields in a separate structure
public uint TypeId { get; private set; }
public uint FieldOffset { get; private set; }
public PointerFlag PointerFlag { get; private set; }
public bool IsArray { get; private set; }
public bool IsStruct { get; private set; }
public bool IsConstant { get; private set; }
public bool IsStatic { get; private set; }
public DebugModuleAndId OwningType { get; internal set; } // gets set post-construction
internal FieldInfo( int index, FIELD_INFO nativeFi )
{
Index = index;
Name = nativeFi.fName;
PrintName = nativeFi.printName;
Size = nativeFi.size;
//fOptions = nativeFi.fOptions;
//Address = nativeFi.address;
TypeId = nativeFi.TypeId;
// The nativeFi.FieldOffset field is 0. What is it for? I don't know. Perhaps
// there is a different usage of the FIELD_INFO struct.
// According to comments in wdbgexts.h, if we had supplied an address in the
// SYM_DUMP_PARAM structure, then address would have the address of the field,
// (address in SYM_DUMP_PARAM plus field offset), but we pass 0, so address is
// just the field offset.
FieldOffset = (uint) nativeFi.address;
PointerFlag = (PointerFlag) (nativeFi.Flags & 0x0003);
IsArray = 0 != (nativeFi.Flags & 0x0004);
IsStruct = 0 != (nativeFi.Flags & 0x0008);
IsConstant = 0 != (nativeFi.Flags & 0x0010);
IsStatic = 0 != (nativeFi.Flags & 0x0020);
} // end constructor
#region IEquatable< FieldInfo > Stuff
public bool Equals( FieldInfo other )
{
if( null == other )
return false;
return (TypeId == other.TypeId) &&
(FieldOffset == other.FieldOffset) &&
(Index == other.Index) &&
(OwningType == other.OwningType);
} // end Equals()
public override bool Equals( object obj )
{
return Equals( obj as FieldInfo );
}
public override int GetHashCode()
{
return TypeId.GetHashCode() +
FieldOffset.GetHashCode() +
Index.GetHashCode() +
OwningType.GetHashCode();
}
public static bool operator ==( FieldInfo f1, FieldInfo f2 )
{
if( null == (object) f1 )
return (null == (object) f2);
return f1.Equals( f2 );
}
public static bool operator !=( FieldInfo f1, FieldInfo f2 )
{
return !(f1 == f2);
}
#endregion
} // end class FieldInfo
public class SymDumpParam
{
public string Name { get; private set; }
public ulong Address { get; private set; }
public ulong ModBase { get; private set; }
public uint TypeId { get; private set; }
public uint TypeSize { get; private set; }
public PointerFlag PointerFlag { get; private set; }
public bool IsArray { get; private set; }
public bool IsStruct { get; private set; }
public bool IsConstant { get; private set; }
public SymDumpParam( SYM_DUMP_PARAM nativeSdp )
{
Name = Marshal.PtrToStringAnsi( nativeSdp.sName );
Address = nativeSdp.addr;
ModBase = nativeSdp.ModBase;
TypeId = nativeSdp.TypeId;
TypeSize = nativeSdp.TypeSize;
PointerFlag = (PointerFlag) (nativeSdp.Flags & 0x0003);
IsArray = 0 != (nativeSdp.Flags & 0x0004);
IsStruct = 0 != (nativeSdp.Flags & 0x0008);
IsConstant = 0 != (nativeSdp.Flags & 0x0010);
} // end constructor
} // end class SymDumpParam
}

145
ClrMemDiag/Desktop/com.cs Normal file
Просмотреть файл

@ -0,0 +1,145 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using Address = System.UInt64;
namespace Microsoft.Diagnostics.Runtime.Desktop
{
internal class DesktopInterfaceData : ComInterfaceData
{
public override ClrType Type
{
get { return _type; }
}
public override Address InterfacePointer
{
get { return _interface; }
}
public DesktopInterfaceData(ClrType type, Address ptr)
{
_type = type;
_interface = ptr;
}
private Address _interface;
private ClrType _type;
}
internal class DesktopCCWData : CcwData
{
public override Address IUnknown { get { return _ccw.IUnknown; } }
public override Address Object { get { return _ccw.Object; } }
public override Address Handle { get { return _ccw.Handle; } }
public override int RefCount { get { return _ccw.RefCount + _ccw.JupiterRefCount; } }
public override IList<ComInterfaceData> Interfaces
{
get
{
if (_interfaces != null)
return _interfaces;
_heap.LoadAllTypes();
_interfaces = new List<ComInterfaceData>();
COMInterfacePointerData[] interfaces = _heap.DesktopRuntime.GetCCWInterfaces(_addr, _ccw.InterfaceCount);
for (int i = 0; i < interfaces.Length; ++i)
{
ClrType type = null;
if (interfaces[i].MethodTable != 0)
type = _heap.GetTypeByMethodTable(interfaces[i].MethodTable, 0);
_interfaces.Add(new DesktopInterfaceData(type, interfaces[i].InterfacePtr));
}
return _interfaces;
}
}
internal DesktopCCWData(DesktopGCHeap heap, Address ccw, ICCWData data)
{
_addr = ccw;
_ccw = data;
_heap = heap;
}
private Address _addr;
private ICCWData _ccw;
private DesktopGCHeap _heap;
private List<ComInterfaceData> _interfaces;
}
internal class DesktopRCWData : RcwData
{
//public ulong IdentityPointer { get; }
public override Address IUnknown { get { return _rcw.UnknownPointer; } }
public override Address VTablePointer { get { return _rcw.VTablePtr; } }
public override int RefCount { get { return _rcw.RefCount; } }
public override Address Object { get { return _rcw.ManagedObject; } }
public override bool Disconnected { get { return _rcw.IsDisconnected; } }
public override Address WinRTObject
{
get { return _rcw.JupiterObject; }
}
public override uint CreatorThread
{
get
{
if (_osThreadID == uint.MaxValue)
{
IThreadData data = _heap.DesktopRuntime.GetThread(_rcw.CreatorThread);
if (data == null || data.OSThreadID == uint.MaxValue)
_osThreadID = 0;
else
_osThreadID = data.OSThreadID;
}
return _osThreadID;
}
}
public override IList<ComInterfaceData> Interfaces
{
get
{
if (_interfaces != null)
return _interfaces;
_heap.LoadAllTypes();
_interfaces = new List<ComInterfaceData>();
COMInterfacePointerData[] interfaces = _heap.DesktopRuntime.GetRCWInterfaces(_addr, _rcw.InterfaceCount);
for (int i = 0; i < interfaces.Length; ++i)
{
ClrType type = null;
if (interfaces[i].MethodTable != 0)
type = _heap.GetTypeByMethodTable(interfaces[i].MethodTable, 0);
_interfaces.Add(new DesktopInterfaceData(type, interfaces[i].InterfacePtr));
}
return _interfaces;
}
}
internal DesktopRCWData(DesktopGCHeap heap, Address rcw, IRCWData data)
{
_addr = rcw;
_rcw = data;
_heap = heap;
_osThreadID = uint.MaxValue;
}
private IRCWData _rcw;
private DesktopGCHeap _heap;
private uint _osThreadID;
private List<ComInterfaceData> _interfaces;
private Address _addr;
}
}

Просмотреть файл

@ -0,0 +1,87 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using Address = System.UInt64;
namespace Microsoft.Diagnostics.Runtime.Desktop
{
internal class DesktopAppDomain : ClrAppDomain
{
public override ClrRuntime Runtime
{
get
{
return _runtime;
}
}
/// <summary>
/// Address of the AppDomain.
/// </summary>
public override Address Address { get { return _address; } }
/// <summary>
/// The AppDomain's ID.
/// </summary>
public override int Id { get { return _id; } }
/// <summary>
/// The name of the AppDomain, as specified when the domain was created.
/// </summary>
public override string Name { get { return _name; } }
public override IList<ClrModule> Modules { get { return _modules; } }
internal int InternalId { get { return _internalId; } }
public override string ConfigurationFile
{
get { return _runtime.GetConfigFile(_address); }
}
public override string ApplicationBase
{
get
{
string appBase = _runtime.GetAppBase(_address);
if (string.IsNullOrEmpty(appBase))
return null;
Uri uri = new Uri(appBase);
try
{
return uri.AbsolutePath.Replace('/', '\\');
}
catch (InvalidOperationException)
{
return appBase;
}
}
}
internal DesktopAppDomain(DesktopRuntimeBase runtime, IAppDomainData data, string name)
{
_address = data.Address;
_id = data.Id;
_name = name;
_internalId = s_internalId++;
_runtime = runtime;
}
internal void AddModule(ClrModule module)
{
_modules.Add(module);
}
#region Private
private Address _address;
private string _name;
private int _id, _internalId;
private List<ClrModule> _modules = new List<ClrModule>();
private DesktopRuntimeBase _runtime;
private static int s_internalId;
#endregion
}
}

Просмотреть файл

@ -0,0 +1,932 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Diagnostics;
using Address = System.UInt64;
using System.Reflection;
using Microsoft.Diagnostics.Runtime.Utilities;
using System.Collections.Generic;
namespace Microsoft.Diagnostics.Runtime.Desktop
{
internal class DesktopStaticField : ClrStaticField
{
public DesktopStaticField(DesktopGCHeap heap, IFieldData field, BaseDesktopHeapType containingType, string name, FieldAttributes attributes, object defaultValue, IntPtr sig, int sigLen)
{
_field = field;
_name = name;
_attributes = attributes;
_type = (BaseDesktopHeapType)heap.GetTypeByMethodTable(field.TypeMethodTable, 0);
_defaultValue = defaultValue;
_heap = heap;
if (_type != null && ElementType != ClrElementType.Class)
_type.ElementType = ElementType;
_containingType = containingType;
if (_type == null)
{
if (sig != IntPtr.Zero && sigLen > 0)
{
SigParser sigParser = new SigParser(sig, sigLen);
bool res;
int sigType, etype = 0;
if (res = sigParser.GetCallingConvInfo(out sigType))
Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD);
res = res && sigParser.SkipCustomModifiers();
res = res && sigParser.GetElemType(out etype);
if (res)
{
ClrElementType type = (ClrElementType)etype;
if (type == ClrElementType.Array)
{
res = sigParser.PeekElemType(out etype);
res = res && sigParser.SkipExactlyOne();
int ranks = 0;
res = res && sigParser.GetData(out ranks);
if (res)
_type = heap.GetArrayType((ClrElementType)etype, ranks, null);
}
else if (type == ClrElementType.SZArray)
{
res = sigParser.PeekElemType(out etype);
type = (ClrElementType)etype;
if (DesktopRuntimeBase.IsObjectReference(type))
_type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray);
else
_type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null);
}
else if (type == ClrElementType.Pointer)
{
// Only deal with single pointers for now and types that have already been constructed
res = sigParser.GetElemType(out etype);
type = (ClrElementType)etype;
int token;
sigParser.GetToken(out token);
BaseDesktopHeapType innerType = (BaseDesktopHeapType)heap.GetTypeByToken(heap.DesktopRuntime.GetModule(field.Module), Convert.ToUInt32(token));
if (innerType == null)
{
innerType = (BaseDesktopHeapType)heap.GetBasicType(type);
}
_type = heap.CreatePointerType(innerType, type, null);
}
}
}
if (_type == null)
_type = (BaseDesktopHeapType)TryBuildType(_heap);
if (_type == null)
_type = (BaseDesktopHeapType)heap.GetBasicType(ElementType);
}
}
override public bool HasDefaultValue { get { return _defaultValue != null; } }
override public object GetDefaultValue() { return _defaultValue; }
override public bool IsPublic
{
get
{
return (_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public;
}
}
override public bool IsPrivate
{
get
{
return (_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Private;
}
}
override public bool IsInternal
{
get
{
return (_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Assembly;
}
}
override public bool IsProtected
{
get
{
return (_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family;
}
}
public override ClrElementType ElementType
{
get { return (ClrElementType)_field.CorElementType; }
}
public override string Name { get { return _name; } }
public override ClrType Type
{
get
{
if (_type == null)
_type = (BaseDesktopHeapType)TryBuildType(_heap);
return _type;
}
}
private ClrType TryBuildType(ClrHeap heap)
{
var runtime = heap.Runtime;
var domains = runtime.AppDomains;
ClrType[] types = new ClrType[domains.Count];
ClrElementType elType = ElementType;
if (ClrRuntime.IsPrimitive(elType) || elType == ClrElementType.String)
return ((DesktopGCHeap)heap).GetBasicType(elType);
int count = 0;
foreach (var domain in domains)
{
object value = GetValue(domain);
if (value != null && value is ulong && ((ulong)value != 0))
{
types[count++] = heap.GetObjectType((ulong)value);
}
}
int depth = int.MaxValue;
ClrType result = null;
for (int i = 0; i < count; ++i)
{
ClrType curr = types[i];
if (curr == result || curr == null)
continue;
int nextDepth = GetDepth(curr);
if (nextDepth < depth)
{
result = curr;
depth = nextDepth;
}
}
return result;
}
private int GetDepth(ClrType curr)
{
int depth = 0;
while (curr != null)
{
curr = curr.BaseType;
depth++;
}
return depth;
}
// these are optional.
/// <summary>
/// If the field has a well defined offset from the base of the object, return it (otherwise -1).
/// </summary>
public override int Offset { get { return (int)_field.Offset; } }
/// <summary>
/// Given an object reference, fetch the address of the field.
/// </summary>
public override bool HasSimpleValue
{
get { return _containingType != null; }
}
public override int Size
{
get
{
if (_type == null)
_type = (BaseDesktopHeapType)TryBuildType(_heap);
return DesktopInstanceField.GetSize(_type, ElementType);
}
}
public override object GetValue(ClrAppDomain appDomain, bool convertStrings = true)
{
if (!HasSimpleValue)
return null;
Address addr = GetAddress(appDomain);
if (ElementType == ClrElementType.String)
{
object val = _containingType.DesktopHeap.GetValueAtAddress(ClrElementType.Object, addr);
Debug.Assert(val == null || val is ulong);
if (val == null || !(val is ulong))
return convertStrings ? null : (object)(ulong)0;
addr = (ulong)val;
if (!convertStrings)
return addr;
}
// Structs are stored as objects.
var elementType = ElementType;
if (elementType == ClrElementType.Struct)
elementType = ClrElementType.Object;
if (elementType == ClrElementType.Object && addr == 0)
return (ulong)0;
return _containingType.DesktopHeap.GetValueAtAddress(elementType, addr);
}
public override Address GetAddress(ClrAppDomain appDomain)
{
if (_containingType == null)
return 0;
bool shared = _containingType.Shared;
IDomainLocalModuleData data = null;
if (shared)
{
Address id = _containingType.DesktopModule.ModuleId;
data = _containingType.DesktopHeap.DesktopRuntime.GetDomainLocalModule(appDomain.Address, id);
if (!IsInitialized(data))
return 0;
}
else
{
Address modAddr = _containingType.GetModuleAddress(appDomain);
if (modAddr != 0)
data = _containingType.DesktopHeap.DesktopRuntime.GetDomainLocalModule(modAddr);
}
if (data == null)
return 0;
Address addr;
if (DesktopRuntimeBase.IsPrimitive(ElementType))
addr = data.NonGCStaticDataStart + _field.Offset;
else
addr = data.GCStaticDataStart + _field.Offset;
return addr;
}
public override bool IsInitialized(ClrAppDomain appDomain)
{
if (_containingType == null)
return false;
if (!_containingType.Shared)
return true;
Address id = _containingType.DesktopModule.ModuleId;
IDomainLocalModuleData data = _containingType.DesktopHeap.DesktopRuntime.GetDomainLocalModule(appDomain.Address, id);
if (data == null)
return false;
return IsInitialized(data);
}
private bool IsInitialized(IDomainLocalModuleData data)
{
if (data == null || _containingType == null)
return false;
byte flags = 0;
ulong flagsAddr = data.ClassData + (_containingType.MetadataToken & ~0x02000000u) - 1;
if (!_heap.DesktopRuntime.ReadByte(flagsAddr, out flags))
return false;
return (flags & 1) != 0;
}
private IFieldData _field;
private string _name;
private BaseDesktopHeapType _type, _containingType;
private FieldAttributes _attributes;
private object _defaultValue;
private DesktopGCHeap _heap;
}
internal class DesktopThreadStaticField : ClrThreadStaticField
{
public DesktopThreadStaticField(DesktopGCHeap heap, IFieldData field, string name)
{
_field = field;
_name = name;
_type = (BaseDesktopHeapType)heap.GetTypeByMethodTable(field.TypeMethodTable, 0);
}
public override object GetValue(ClrAppDomain appDomain, ClrThread thread, bool convertStrings = true)
{
if (!HasSimpleValue)
return null;
Address addr = GetAddress(appDomain, thread);
if (addr == 0)
return null;
if (ElementType == ClrElementType.String)
{
object val = _type.DesktopHeap.GetValueAtAddress(ClrElementType.Object, addr);
Debug.Assert(val == null || val is ulong);
if (val == null || !(val is ulong))
return convertStrings ? null : (object)(ulong)0;
addr = (ulong)val;
if (!convertStrings)
return addr;
}
return _type.DesktopHeap.GetValueAtAddress(ElementType, addr);
}
public override Address GetAddress(ClrAppDomain appDomain, ClrThread thread)
{
if (_type == null)
return 0;
DesktopRuntimeBase runtime = _type.DesktopHeap.DesktopRuntime;
IModuleData moduleData = runtime.GetModuleData(_field.Module);
return runtime.GetThreadStaticPointer(thread.Address, (ClrElementType)_field.CorElementType, (uint)Offset, (uint)moduleData.ModuleId, _type.Shared);
}
public override ClrElementType ElementType
{
get { return (ClrElementType)_field.CorElementType; }
}
public override string Name { get { return _name; } }
public override ClrType Type { get { return _type; } }
// these are optional.
/// <summary>
/// If the field has a well defined offset from the base of the object, return it (otherwise -1).
/// </summary>
public override int Offset { get { return (int)_field.Offset; } }
/// <summary>
/// Given an object reference, fetch the address of the field.
/// </summary>
public override bool HasSimpleValue
{
get { return _type != null && !DesktopRuntimeBase.IsValueClass(ElementType); }
}
public override int Size
{
get
{
return DesktopInstanceField.GetSize(_type, ElementType);
}
}
public override bool IsPublic
{
get { throw new NotImplementedException(); }
}
public override bool IsPrivate
{
get { throw new NotImplementedException(); }
}
public override bool IsInternal
{
get { throw new NotImplementedException(); }
}
public override bool IsProtected
{
get { throw new NotImplementedException(); }
}
private IFieldData _field;
private string _name;
private BaseDesktopHeapType _type;
}
internal class DesktopInstanceField : ClrInstanceField
{
override public bool IsPublic
{
get
{
return (_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public;
}
}
override public bool IsPrivate
{
get
{
return (_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Private;
}
}
override public bool IsInternal
{
get
{
return (_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Assembly;
}
}
override public bool IsProtected
{
get
{
return (_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family;
}
}
public DesktopInstanceField(DesktopGCHeap heap, IFieldData data, string name, FieldAttributes attributes, IntPtr sig, int sigLen)
{
_name = name;
_field = data;
_attributes = attributes;
ulong mt = data.TypeMethodTable;
if (mt != 0)
_type = (BaseDesktopHeapType)heap.GetTypeByMethodTable(mt, 0);
if (_type == null)
{
if (sig != IntPtr.Zero && sigLen > 0)
{
SigParser sigParser = new SigParser(sig, sigLen);
bool res;
int sigType, etype = 0;
if (res = sigParser.GetCallingConvInfo(out sigType))
Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD);
res = res && sigParser.SkipCustomModifiers();
res = res && sigParser.GetElemType(out etype);
// Generic instantiation
if (etype == 0x15)
res = res && sigParser.GetElemType(out etype);
if (res)
{
ClrElementType type = (ClrElementType)etype;
if (type == ClrElementType.Array)
{
res = sigParser.PeekElemType(out etype);
res = res && sigParser.SkipExactlyOne();
int ranks = 0;
res = res && sigParser.GetData(out ranks);
if (res)
_type = heap.GetArrayType((ClrElementType)etype, ranks, null);
}
else if (type == ClrElementType.SZArray)
{
res = sigParser.PeekElemType(out etype);
type = (ClrElementType)etype;
if (DesktopRuntimeBase.IsObjectReference(type))
_type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray);
else
_type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null);
}
else if (type == ClrElementType.Pointer)
{
// Only deal with single pointers for now and types that have already been constructed
res = sigParser.GetElemType(out etype);
type = (ClrElementType)etype;
int token;
sigParser.GetToken(out token);
BaseDesktopHeapType innerType = (BaseDesktopHeapType)heap.GetTypeByToken(heap.DesktopRuntime.GetModule(data.Module), Convert.ToUInt32(token));
if (innerType == null)
{
innerType = (BaseDesktopHeapType)heap.GetBasicType(type);
}
_type = heap.CreatePointerType(innerType, type, null);
}
else
{
// If it's a class or struct, then try to get the token
int token = 0;
if (etype == 0x11 || etype == 0x12)
res = res && sigParser.GetToken(out token);
if (token != 0)
_type = (BaseDesktopHeapType)heap.GetTypeByToken(heap.DesktopRuntime.GetModule(data.Module), (uint)token);
if (_type == null)
if ((_type = (BaseDesktopHeapType)heap.GetBasicType((ClrElementType)etype)) == null)
_type = heap.DesktopErrorType;
}
}
}
if (_type == null)
_type = (BaseDesktopHeapType)heap.GetBasicType(ElementType);
}
else if (ElementType != ClrElementType.Class)
{
_type.ElementType = ElementType;
}
if (_type.IsArray && _type.ComponentType == null)
{
if (sig != IntPtr.Zero && sigLen > 0)
{
SigParser sigParser = new SigParser(sig, sigLen);
bool res;
int sigType, etype = 0;
if (res = sigParser.GetCallingConvInfo(out sigType))
Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD);
res = res && sigParser.SkipCustomModifiers();
res = res && sigParser.GetElemType(out etype);
res = res && sigParser.GetElemType(out etype);
// Generic instantiation
if (etype == 0x15)
res = res && sigParser.GetElemType(out etype);
// If it's a class or struct, then try to get the token
int token = 0;
if (etype == 0x11 || etype == 0x12)
res = res && sigParser.GetToken(out token);
if (token != 0)
_type.ComponentType = heap.GetTypeByToken(heap.DesktopRuntime.GetModule(data.Module), (uint)token);
else if (_type.ComponentType == null)
if ((_type.ComponentType = heap.GetBasicType((ClrElementType)etype)) == null)
_type.ComponentType = heap.DesktopErrorType;
}
}
}
public override ClrElementType ElementType
{
get
{
if (_elementType != ClrElementType.Unknown)
return _elementType;
if (_type == null)
_elementType = (ClrElementType)_field.CorElementType;
else if (_type.IsEnum)
_elementType = _type.GetEnumElementType();
else
_elementType = _type.ElementType;
return _elementType;
}
}
public override string Name { get { return _name; } }
public override ClrType Type { get { return _type; } }
// these are optional.
/// <summary>
/// If the field has a well defined offset from the base of the object, return it (otherwise -1).
/// </summary>
public override int Offset { get { return (int)_field.Offset; } }
/// <summary>
/// Given an object reference, fetch the address of the field.
/// </summary>
public override bool HasSimpleValue
{
get { return _type != null && !DesktopRuntimeBase.IsValueClass(ElementType); }
}
public override int Size
{
get
{
return GetSize(_type, ElementType);
}
}
#region Fields
private string _name;
private BaseDesktopHeapType _type;
private IFieldData _field;
private FieldAttributes _attributes;
private ClrElementType _elementType = ClrElementType.Unknown;
#endregion
public override object GetValue(Address objRef, bool interior = false, bool convertStrings = true)
{
if (!HasSimpleValue)
return null;
Address addr = GetAddress(objRef, interior);
if (ElementType == ClrElementType.String)
{
object val = _type.DesktopHeap.GetValueAtAddress(ClrElementType.Object, addr);
Debug.Assert(val == null || val is ulong);
if (val == null || !(val is ulong))
return convertStrings ? null : (object)(ulong)0;
addr = (ulong)val;
if (!convertStrings)
return addr;
}
return _type.DesktopHeap.GetValueAtAddress(ElementType, addr);
}
public override Address GetAddress(Address objRef, bool interior = false)
{
if (interior)
return objRef + (Address)Offset;
// TODO: Type really shouldn't be null here, but due to the dac it can be. We still need
// to respect m_heap.PointerSize, so there needs to be a way to track this when m_type is null.
if (_type == null)
return objRef + (Address)(Offset + IntPtr.Size);
return objRef + (Address)(Offset + _type.DesktopHeap.PointerSize);
}
internal static int GetSize(BaseDesktopHeapType type, ClrElementType cet)
{
// todo: What if we have a struct which is not fully constructed (null MT,
// null type) and need to get the size of the field?
switch (cet)
{
case ClrElementType.Struct:
if (type == null)
return 1;
return type.BaseSize;
case ClrElementType.Int8:
case ClrElementType.UInt8:
case ClrElementType.Boolean:
return 1;
case ClrElementType.Float:
case ClrElementType.Int32:
case ClrElementType.UInt32:
return 4;
case ClrElementType.Double: // double
case ClrElementType.Int64:
case ClrElementType.UInt64:
return 8;
case ClrElementType.String:
case ClrElementType.Class:
case ClrElementType.Array:
case ClrElementType.SZArray:
case ClrElementType.Object:
case ClrElementType.NativeInt: // native int
case ClrElementType.NativeUInt: // native unsigned int
case ClrElementType.Pointer:
case ClrElementType.FunctionPointer:
if (type == null)
return IntPtr.Size; // todo: fixme
return (int)type.DesktopHeap.PointerSize;
case ClrElementType.UInt16:
case ClrElementType.Int16:
case ClrElementType.Char: // u2
return 2;
}
throw new Exception("Unexpected element type.");
}
}
class SpecialType : BaseDesktopHeapType
{
private string _name;
public SpecialType(DesktopGCHeap heap, string name)
: base(heap, heap.DesktopRuntime.ErrorModule, 0)
{
_name = name;
}
public override int BaseSize
{
get
{
return 0;
}
}
public override ClrType BaseType
{
get
{
return DesktopHeap.ObjectType;
}
}
public override int ElementSize
{
get
{
return 0;
}
}
public override ClrHeap Heap
{
get
{
return DesktopHeap;
}
}
public override IList<ClrInterface> Interfaces
{
get
{
return new ClrInterface[0];
}
}
public override bool IsAbstract
{
get
{
return false;
}
}
public override bool IsFinalizable
{
get
{
return false;
}
}
public override bool IsInterface
{
get
{
return false;
}
}
public override bool IsInternal
{
get
{
return false;
}
}
public override bool IsPrivate
{
get
{
return false;
}
}
public override bool IsProtected
{
get
{
return false;
}
}
public override bool IsPublic
{
get
{
return false;
}
}
public override bool IsSealed
{
get
{
return false;
}
}
public override uint MetadataToken
{
get
{
return 0;
}
}
public override ulong MethodTable
{
get
{
return 0;
}
}
public override string Name
{
get
{
return _name;
}
}
public override IEnumerable<ulong> EnumerateMethodTables()
{
return new ulong[0];
}
public override void EnumerateRefsOfObject(ulong objRef, Action<ulong, int> action)
{
}
public override void EnumerateRefsOfObjectCarefully(ulong objRef, Action<ulong, int> action)
{
}
public override ulong GetArrayElementAddress(ulong objRef, int index)
{
throw new InvalidOperationException();
}
public override object GetArrayElementValue(ulong objRef, int index)
{
throw new InvalidOperationException();
}
public override int GetArrayLength(ulong objRef)
{
throw new InvalidOperationException();
}
public override ClrInstanceField GetFieldByName(string name)
{
return null;
}
public override bool GetFieldForOffset(int fieldOffset, bool inner, out ClrInstanceField childField, out int childFieldOffset)
{
childField = null;
childFieldOffset = 0;
return false;
}
public override ulong GetSize(ulong objRef)
{
return 0;
}
public override ClrStaticField GetStaticFieldByName(string name)
{
return null;
}
internal override ulong GetModuleAddress(ClrAppDomain domain)
{
return 0;
}
}
}

1825
ClrMemDiag/Desktop/heap.cs Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,270 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
namespace Microsoft.Diagnostics.Runtime.Desktop
{
internal class AppDomainHeapWalker
{
#region Variables
private enum InternalHeapTypes
{
IndcellHeap,
LookupHeap,
ResolveHeap,
DispatchHeap,
CacheEntryHeap
}
private List<MemoryRegion> _regions = new List<MemoryRegion>();
private DesktopRuntimeBase.LoaderHeapTraverse _delegate;
private ClrMemoryRegionType _type;
private ulong _appDomain;
private DesktopRuntimeBase _runtime;
#endregion
public AppDomainHeapWalker(DesktopRuntimeBase runtime)
{
_runtime = runtime;
_delegate = new DesktopRuntimeBase.LoaderHeapTraverse(VisitOneHeap);
}
public IEnumerable<MemoryRegion> EnumerateHeaps(IAppDomainData appDomain)
{
Debug.Assert(appDomain != null);
_appDomain = appDomain.Address;
_regions.Clear();
// Standard heaps.
_type = ClrMemoryRegionType.LowFrequencyLoaderHeap;
_runtime.TraverseHeap(appDomain.LowFrequencyHeap, _delegate);
_type = ClrMemoryRegionType.HighFrequencyLoaderHeap;
_runtime.TraverseHeap(appDomain.HighFrequencyHeap, _delegate);
_type = ClrMemoryRegionType.StubHeap;
_runtime.TraverseHeap(appDomain.StubHeap, _delegate);
// Stub heaps.
_type = ClrMemoryRegionType.IndcellHeap;
_runtime.TraverseStubHeap(_appDomain, (int)InternalHeapTypes.IndcellHeap, _delegate);
_type = ClrMemoryRegionType.LookupHeap;
_runtime.TraverseStubHeap(_appDomain, (int)InternalHeapTypes.LookupHeap, _delegate);
_type = ClrMemoryRegionType.ResolveHeap;
_runtime.TraverseStubHeap(_appDomain, (int)InternalHeapTypes.ResolveHeap, _delegate);
_type = ClrMemoryRegionType.DispatchHeap;
_runtime.TraverseStubHeap(_appDomain, (int)InternalHeapTypes.DispatchHeap, _delegate);
_type = ClrMemoryRegionType.CacheEntryHeap;
_runtime.TraverseStubHeap(_appDomain, (int)InternalHeapTypes.CacheEntryHeap, _delegate);
return _regions;
}
public IEnumerable<MemoryRegion> EnumerateModuleHeaps(IAppDomainData appDomain, ulong addr)
{
Debug.Assert(appDomain != null);
_appDomain = appDomain.Address;
_regions.Clear();
if (addr == 0)
return _regions;
IModuleData module = _runtime.GetModuleData(addr);
if (module != null)
{
_type = ClrMemoryRegionType.ModuleThunkHeap;
_runtime.TraverseHeap(module.ThunkHeap, _delegate);
_type = ClrMemoryRegionType.ModuleLookupTableHeap;
_runtime.TraverseHeap(module.LookupTableHeap, _delegate);
}
return _regions;
}
public IEnumerable<MemoryRegion> EnumerateJitHeap(ulong heap)
{
_appDomain = 0;
_regions.Clear();
_type = ClrMemoryRegionType.JitLoaderCodeHeap;
_runtime.TraverseHeap(heap, _delegate);
return _regions;
}
#region Helper Functions
private void VisitOneHeap(ulong address, IntPtr size, int isCurrent)
{
if (_appDomain == 0)
_regions.Add(new MemoryRegion(_runtime, address, (ulong)size.ToInt64(), _type));
else
_regions.Add(new MemoryRegion(_runtime, address, (ulong)size.ToInt64(), _type, _appDomain));
}
#endregion
}
internal class HandleTableWalker
{
#region Variables
private DesktopRuntimeBase _runtime;
private ClrHeap _heap;
private int _max = 10000;
private VISITHANDLEV2 _mV2Delegate;
private VISITHANDLEV4 _mV4Delegate;
#endregion
#region Properties
public List<ClrHandle> Handles { get; private set; }
public byte[] V4Request
{
get
{
// MULTITHREAD ISSUE
if (_mV4Delegate == null)
_mV4Delegate = new VISITHANDLEV4(VisitHandleV4);
IntPtr functionPtr = Marshal.GetFunctionPointerForDelegate(_mV4Delegate);
byte[] request = new byte[IntPtr.Size * 2];
FunctionPointerToByteArray(functionPtr, request, 0);
return request;
}
}
public byte[] V2Request
{
get
{
// MULTITHREAD ISSUE
if (_mV2Delegate == null)
_mV2Delegate = new VISITHANDLEV2(VisitHandleV2);
IntPtr functionPtr = Marshal.GetFunctionPointerForDelegate(_mV2Delegate);
byte[] request = new byte[IntPtr.Size * 2];
FunctionPointerToByteArray(functionPtr, request, 0);
return request;
}
}
#endregion
#region Functions
public HandleTableWalker(DesktopRuntimeBase dac)
{
_runtime = dac;
_heap = dac.GetHeap();
Handles = new List<ClrHandle>();
}
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate int VISITHANDLEV4(ulong HandleAddr, ulong HandleValue, int HandleType, uint ulRefCount, ulong appDomainPtr, IntPtr token);
private int VisitHandleV4(ulong addr, ulong obj, int hndType, uint refCnt, ulong appDomain, IntPtr unused)
{
Debug.Assert(unused == IntPtr.Zero);
return AddHandle(addr, obj, hndType, refCnt, 0, appDomain);
}
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate int VISITHANDLEV2(ulong HandleAddr, ulong HandleValue, int HandleType, ulong appDomainPtr, IntPtr token);
private int VisitHandleV2(ulong addr, ulong obj, int hndType, ulong appDomain, IntPtr unused)
{
Debug.Assert(unused == IntPtr.Zero);
// V2 cannot actually get the ref count from a handle. We'll always report the RefCount as
// 1 in this case so the user will treat this as a strong handle (which the majority of COM
// handles are).
uint refCnt = 0;
if (hndType == (uint)HandleType.RefCount)
refCnt = 1;
return AddHandle(addr, obj, hndType, refCnt, 0, appDomain);
}
public int AddHandle(ulong addr, ulong obj, int hndType, uint refCnt, uint dependentTarget, ulong appDomain)
{
ulong mt;
ulong cmt;
// If we fail to get the MT of this object, just skip it and keep going
if (!GetMethodTables(obj, out mt, out cmt))
return _max-- > 0 ? 1 : 0;
ClrHandle handle = new ClrHandle();
handle.Address = addr;
handle.Object = obj;
handle.Type = _heap.GetObjectType(obj);
handle.HandleType = (HandleType)hndType;
handle.RefCount = refCnt;
handle.AppDomain = _runtime.GetAppDomainByAddress(appDomain);
handle.DependentTarget = dependentTarget;
if (dependentTarget != 0)
handle.DependentType = _heap.GetObjectType(dependentTarget);
Handles.Add(handle);
handle = handle.GetInteriorHandle();
if (handle != null)
Handles.Add(handle);
// Stop if we have too many handles (likely infinite loop in dac due to
// inconsistent data).
return _max-- > 0 ? 1 : 0;
}
private bool GetMethodTables(ulong obj, out ulong mt, out ulong cmt)
{
mt = 0;
cmt = 0;
byte[] data = new byte[IntPtr.Size * 3]; // TODO assumes bitness same as dump
int read = 0;
if (!_runtime.ReadMemory(obj, data, data.Length, out read) || read != data.Length)
return false;
if (IntPtr.Size == 4)
mt = BitConverter.ToUInt32(data, 0);
else
mt = BitConverter.ToUInt64(data, 0);
if (mt == _runtime.ArrayMethodTable)
{
if (IntPtr.Size == 4)
cmt = BitConverter.ToUInt32(data, 2 * IntPtr.Size);
else
cmt = BitConverter.ToUInt64(data, 2 * IntPtr.Size);
}
return true;
}
private static void FunctionPointerToByteArray(IntPtr functionPtr, byte[] request, int start)
{
long ptr = functionPtr.ToInt64();
for (int i = start; i < start + sizeof(ulong); ++i)
{
request[i] = (byte)ptr;
ptr >>= 8;
}
}
#endregion
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,650 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace Microsoft.Diagnostics.Runtime.Desktop
{
internal class LockInspection
{
private DesktopGCHeap _heap;
private DesktopRuntimeBase _runtime;
private ClrType _rwType, _rwsType;
private Dictionary<ulong, DesktopBlockingObject> _monitors = new Dictionary<ulong, DesktopBlockingObject>();
private Dictionary<ulong, DesktopBlockingObject> _locks = new Dictionary<ulong, DesktopBlockingObject>();
private Dictionary<ClrThread, DesktopBlockingObject> _joinLocks = new Dictionary<ClrThread, DesktopBlockingObject>();
private Dictionary<ulong, DesktopBlockingObject> _waitLocks = new Dictionary<ulong, DesktopBlockingObject>();
private Dictionary<ulong, ulong> _syncblks = new Dictionary<ulong, ulong>();
private DesktopBlockingObject[] _result = null;
internal LockInspection(DesktopGCHeap heap, DesktopRuntimeBase runtime)
{
_heap = heap;
_runtime = runtime;
}
internal DesktopBlockingObject[] InitLockInspection()
{
if (_result != null)
return _result;
// First, enumerate all thinlocks on the heap.
foreach (var seg in _heap.Segments)
{
for (ulong obj = seg.FirstObjectAddress; obj != 0; obj = seg.NextObject(obj))
{
ClrType type = _heap.GetObjectType(obj);
if (IsReaderWriterLock(obj, type))
_locks[obj] = CreateRWLObject(obj, type);
else if (IsReaderWriterSlim(obj, type))
_locks[obj] = CreateRWSObject(obj, type);
// Does this object have a syncblk with monitor associated with it?
uint header;
if (!_heap.GetObjectHeader(obj, out header))
continue;
if ((header & (BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX | BIT_SBLK_SPIN_LOCK)) != 0)
continue;
uint threadId = header & SBLK_MASK_LOCK_THREADID;
if (threadId == 0)
continue;
ClrThread thread = _runtime.GetThreadFromThinlockID(threadId);
if (thread != null)
{
int recursion = ((int)header & SBLK_MASK_LOCK_RECLEVEL) >> SBLK_RECLEVEL_SHIFT;
_monitors[obj] = new DesktopBlockingObject(obj, true, recursion + 1, thread, BlockingReason.Monitor);
}
}
}
// Enumerate syncblocks to find locks
int syncblkCnt = _runtime.GetSyncblkCount();
for (int i = 0; i < syncblkCnt; ++i)
{
ISyncBlkData data = _runtime.GetSyncblkData(i);
if (data == null || data.Free)
continue;
_syncblks[data.Address] = data.Object;
_syncblks[data.Object] = data.Object;
ClrThread thread = null;
if (data.MonitorHeld)
{
ulong threadAddr = data.OwningThread;
foreach (var clrThread in _runtime.Threads)
{
if (clrThread.Address == threadAddr)
{
thread = clrThread;
break;
}
}
}
_monitors[data.Object] = new DesktopBlockingObject(data.Object, data.MonitorHeld, (int)data.Recursion, thread, BlockingReason.Monitor);
}
SetThreadWaiters();
int total = _monitors.Count + _locks.Count + _joinLocks.Count + _waitLocks.Count;
_result = new DesktopBlockingObject[total];
int j = 0;
foreach (DesktopBlockingObject blocker in _monitors.Values)
_result[j++] = blocker;
foreach (DesktopBlockingObject blocker in _locks.Values)
_result[j++] = blocker;
foreach (DesktopBlockingObject blocker in _joinLocks.Values)
_result[j++] = blocker;
foreach (DesktopBlockingObject blocker in _waitLocks.Values)
_result[j++] = blocker;
Debug.Assert(j == _result.Length);
// Free up some memory.
_monitors = null;
_locks = null;
_joinLocks = null;
_waitLocks = null;
_syncblks = null;
return _result;
}
private bool IsReaderWriterLock(ulong obj, ClrType type)
{
if (type == null)
return false;
if (_rwType == null)
{
if (type.Name != "System.Threading.ReaderWriterLock")
return false;
_rwType = type;
return true;
}
return _rwType == type;
}
private bool IsReaderWriterSlim(ulong obj, ClrType type)
{
if (type == null)
return false;
if (_rwsType == null)
{
if (type.Name != "System.Threading.ReaderWriterLockSlim")
return false;
_rwsType = type;
return true;
}
return _rwsType == type;
}
private void SetThreadWaiters()
{
HashSet<string> eventTypes = null;
List<BlockingObject> blobjs = new List<BlockingObject>();
foreach (DesktopThread thread in _runtime.Threads)
{
int max = thread.StackTrace.Count;
if (max > 10)
max = 10;
blobjs.Clear();
for (int i = 0; i < max; ++i)
{
DesktopBlockingObject blockingObj = null;
ClrMethod method = thread.StackTrace[i].Method;
if (method == null)
continue;
ClrType type = method.Type;
if (type == null)
continue;
switch (method.Name)
{
case "AcquireWriterLockInternal":
case "FCallUpgradeToWriterLock":
case "UpgradeToWriterLock":
case "AcquireReaderLockInternal":
case "AcquireReaderLock":
if (type.Name == "System.Threading.ReaderWriterLock")
{
blockingObj = FindLocks(thread.StackLimit, thread.StackTrace[i].StackPointer, IsReaderWriterLock);
if (blockingObj == null)
blockingObj = FindLocks(thread.StackTrace[i].StackPointer, thread.StackBase, IsReaderWriterLock);
if (blockingObj != null && (blockingObj.Reason == BlockingReason.Unknown || blockingObj.Reason == BlockingReason.None))
{
// This should have already been set correctly when the BlockingObject was created. This is just a best-guess.
if (method.Name == "AcquireReaderLockInternal" || method.Name == "AcquireReaderLock")
blockingObj.Reason = BlockingReason.WriterAcquired;
else
blockingObj.Reason = BlockingReason.ReaderAcquired;
}
}
break;
case "TryEnterReadLockCore":
case "TryEnterReadLock":
case "TryEnterUpgradeableReadLock":
case "TryEnterUpgradeableReadLockCore":
case "TryEnterWriteLock":
case "TryEnterWriteLockCore":
if (type.Name == "System.Threading.ReaderWriterLockSlim")
{
blockingObj = FindLocks(thread.StackLimit, thread.StackTrace[i].StackPointer, IsReaderWriterSlim);
if (blockingObj == null)
blockingObj = FindLocks(thread.StackTrace[i].StackPointer, thread.StackBase, IsReaderWriterSlim);
if (blockingObj != null && (blockingObj.Reason == BlockingReason.Unknown || blockingObj.Reason == BlockingReason.None))
{
// This should have already been set correctly when the BlockingObject was created. This is just a best-guess.
if (method.Name == "TryEnterWriteLock" || method.Name == "TryEnterWriteLockCore")
blockingObj.Reason = BlockingReason.ReaderAcquired;
else
blockingObj.Reason = BlockingReason.WriterAcquired;
}
}
break;
case "JoinInternal":
case "Join":
if (type.Name == "System.Threading.Thread")
{
ulong threadAddr;
ClrThread target;
if (FindThread(thread.StackLimit, thread.StackTrace[i].StackPointer, out threadAddr, out target) ||
FindThread(thread.StackTrace[i].StackPointer, thread.StackBase, out threadAddr, out target))
{
if (!_joinLocks.TryGetValue(target, out blockingObj))
_joinLocks[target] = blockingObj = new DesktopBlockingObject(threadAddr, true, 0, target, BlockingReason.ThreadJoin);
}
}
break;
case "Wait":
case "ObjWait":
if (type.Name == "System.Threading.Monitor")
{
blockingObj = FindMonitor(thread.StackLimit, thread.StackTrace[i].StackPointer);
if (blockingObj == null)
blockingObj = FindMonitor(thread.StackTrace[i].StackPointer, thread.StackBase);
blockingObj.Reason = BlockingReason.MonitorWait;
}
break;
case "WaitAny":
case "WaitAll":
if (type.Name == "System.Threading.WaitHandle")
{
ulong obj = FindWaitObjects(thread.StackLimit, thread.StackTrace[i].StackPointer, "System.Threading.WaitHandle[]");
if (obj == 0)
obj = FindWaitObjects(thread.StackTrace[i].StackPointer, thread.StackBase, "System.Threading.WaitHandle[]");
if (obj != 0)
{
BlockingReason reason = method.Name == "WaitAny" ? BlockingReason.WaitAny : BlockingReason.WaitAll;
if (!_waitLocks.TryGetValue(obj, out blockingObj))
_waitLocks[obj] = blockingObj = new DesktopBlockingObject(obj, true, 0, null, reason);
}
}
break;
case "WaitOne":
case "InternalWaitOne":
case "WaitOneNative":
if (type.Name == "System.Threading.WaitHandle")
{
if (eventTypes == null)
{
eventTypes = new HashSet<string>();
eventTypes.Add("System.Threading.Mutex");
eventTypes.Add("System.Threading.Semaphore");
eventTypes.Add("System.Threading.ManualResetEvent");
eventTypes.Add("System.Threading.AutoResetEvent");
eventTypes.Add("System.Threading.WaitHandle");
eventTypes.Add("Microsoft.Win32.SafeHandles.SafeWaitHandle");
}
ulong obj = FindWaitHandle(thread.StackLimit, thread.StackTrace[i].StackPointer, eventTypes);
if (obj == 0)
obj = FindWaitHandle(thread.StackTrace[i].StackPointer, thread.StackBase, eventTypes);
if (obj != 0)
{
if (_waitLocks == null)
_waitLocks = new Dictionary<ulong, DesktopBlockingObject>();
if (!_waitLocks.TryGetValue(obj, out blockingObj))
_waitLocks[obj] = blockingObj = new DesktopBlockingObject(obj, true, 0, null, BlockingReason.WaitOne);
}
}
break;
case "TryEnter":
case "ReliableEnterTimeout":
case "TryEnterTimeout":
case "Enter":
if (type.Name == "System.Threading.Monitor")
{
blockingObj = FindMonitor(thread.StackLimit, thread.StackTrace[i].StackPointer);
if (blockingObj != null)
blockingObj.Reason = BlockingReason.Monitor;
}
break;
}
if (blockingObj != null)
{
bool alreadyEncountered = false;
foreach (var blobj in blobjs)
{
if (blobj.Object == blockingObj.Object)
{
alreadyEncountered = true;
break;
}
}
if (!alreadyEncountered)
blobjs.Add(blockingObj);
}
}
foreach (DesktopBlockingObject blobj in blobjs)
blobj.AddWaiter(thread);
thread.SetBlockingObjects(blobjs.ToArray());
}
}
private DesktopBlockingObject CreateRWLObject(ulong obj, ClrType type)
{
if (type == null)
return new DesktopBlockingObject(obj, false, 0, null, BlockingReason.None);
ClrInstanceField writerID = type.GetFieldByName("_dwWriterID");
if (writerID != null && writerID.ElementType == ClrElementType.Int32)
{
int id = (int)writerID.GetValue(obj);
if (id > 0)
{
ClrThread thread = GetThreadById(id);
if (thread != null)
return new DesktopBlockingObject(obj, true, 0, thread, BlockingReason.ReaderAcquired);
}
}
ClrInstanceField uLock = type.GetFieldByName("_dwULockID");
ClrInstanceField lLock = type.GetFieldByName("_dwLLockID");
if (uLock != null && uLock.ElementType == ClrElementType.Int32 && lLock != null && lLock.ElementType == ClrElementType.Int32)
{
int uId = (int)uLock.GetValue(obj);
int lId = (int)lLock.GetValue(obj);
List<ClrThread> threads = null;
foreach (ClrThread thread in _runtime.Threads)
{
foreach (IRWLockData l in _runtime.EnumerateLockData(thread.Address))
{
if (l.LLockID == lId && l.ULockID == uId && l.Level > 0)
{
if (threads == null)
threads = new List<ClrThread>();
threads.Add(thread);
break;
}
}
}
if (threads != null)
return new DesktopBlockingObject(obj, true, 0, BlockingReason.ReaderAcquired, threads.ToArray());
}
return new DesktopBlockingObject(obj, false, 0, null, BlockingReason.None);
}
private DesktopBlockingObject CreateRWSObject(ulong obj, ClrType type)
{
if (type == null)
return new DesktopBlockingObject(obj, false, 0, null, BlockingReason.None);
ClrInstanceField field = type.GetFieldByName("writeLockOwnerId");
if (field != null && field.ElementType == ClrElementType.Int32)
{
int id = (int)field.GetValue(obj);
ClrThread thread = GetThreadById(id);
if (thread != null)
return new DesktopBlockingObject(obj, true, 0, thread, BlockingReason.WriterAcquired);
}
field = type.GetFieldByName("upgradeLockOwnerId");
if (field != null && field.ElementType == ClrElementType.Int32)
{
int id = (int)field.GetValue(obj);
ClrThread thread = GetThreadById(id);
if (thread != null)
return new DesktopBlockingObject(obj, true, 0, thread, BlockingReason.WriterAcquired);
}
field = type.GetFieldByName("rwc");
if (field != null)
{
List<ClrThread> threads = null;
ulong rwc = (ulong)field.GetValue(obj);
ClrType rwcArrayType = _heap.GetObjectType(rwc);
if (rwcArrayType != null && rwcArrayType.IsArray && rwcArrayType.ComponentType != null)
{
ClrType rwcType = rwcArrayType.ComponentType;
ClrInstanceField threadId = rwcType.GetFieldByName("threadid");
ClrInstanceField next = rwcType.GetFieldByName("next");
if (threadId != null && next != null)
{
int count = rwcArrayType.GetArrayLength(rwc);
for (int i = 0; i < count; ++i)
{
ulong entry = (ulong)rwcArrayType.GetArrayElementValue(rwc, i);
GetThreadEntry(ref threads, threadId, next, entry, false);
}
}
}
if (threads != null)
return new DesktopBlockingObject(obj, true, 0, BlockingReason.ReaderAcquired, threads.ToArray());
}
return new DesktopBlockingObject(obj, false, 0, null, BlockingReason.None);
}
private void GetThreadEntry(ref List<ClrThread> threads, ClrInstanceField threadId, ClrInstanceField next, ulong curr, bool interior)
{
if (curr == 0)
return;
int id = (int)threadId.GetValue(curr, interior);
ClrThread thread = GetThreadById(id);
if (thread != null)
{
if (threads == null)
threads = new List<ClrThread>();
threads.Add(thread);
}
curr = (ulong)next.GetValue(curr, interior);
if (curr != 0)
GetThreadEntry(ref threads, threadId, next, curr, false);
}
private ulong FindWaitHandle(ulong start, ulong stop, HashSet<string> eventTypes)
{
ClrHeap heap = _runtime.GetHeap();
foreach (ulong obj in EnumerateObjectsOfTypes(start, stop, eventTypes))
return obj;
return 0;
}
private ulong FindWaitObjects(ulong start, ulong stop, string typeName)
{
ClrHeap heap = _runtime.GetHeap();
foreach (ulong obj in EnumerateObjectsOfType(start, stop, typeName))
return obj;
return 0;
}
private IEnumerable<ulong> EnumerateObjectsOfTypes(ulong start, ulong stop, HashSet<string> types)
{
ClrHeap heap = _runtime.GetHeap();
foreach (ulong ptr in EnumeratePointersInRange(start, stop))
{
ulong obj;
if (_runtime.ReadPointer(ptr, out obj))
{
if (heap.IsInHeap(obj))
{
ClrType type = heap.GetObjectType(obj);
int sanity = 0;
while (type != null)
{
if (types.Contains(type.Name))
{
yield return obj;
break;
}
type = type.BaseType;
if (sanity++ == 16)
break;
}
}
}
}
}
private IEnumerable<ulong> EnumerateObjectsOfType(ulong start, ulong stop, string typeName)
{
ClrHeap heap = _runtime.GetHeap();
foreach (ulong ptr in EnumeratePointersInRange(start, stop))
{
ulong obj;
if (_runtime.ReadPointer(ptr, out obj))
{
if (heap.IsInHeap(obj))
{
ClrType type = heap.GetObjectType(obj);
int sanity = 0;
while (type != null)
{
if (type.Name == typeName)
{
yield return obj;
break;
}
type = type.BaseType;
if (sanity++ == 16)
break;
}
}
}
}
}
private bool FindThread(ulong start, ulong stop, out ulong threadAddr, out ClrThread target)
{
ClrHeap heap = _runtime.GetHeap();
foreach (ulong obj in EnumerateObjectsOfType(start, stop, "System.Threading.Thread"))
{
ClrType type = heap.GetObjectType(obj);
ClrInstanceField threadIdField = type.GetFieldByName("m_ManagedThreadId");
if (threadIdField != null && threadIdField.ElementType == ClrElementType.Int32)
{
int id = (int)threadIdField.GetValue(obj);
ClrThread thread = GetThreadById(id);
if (thread != null)
{
threadAddr = obj;
target = thread;
return true;
}
}
}
threadAddr = 0;
target = null;
return false;
}
private IEnumerable<ulong> EnumeratePointersInRange(ulong start, ulong stop)
{
uint diff = (uint)_runtime.PointerSize;
if (start > stop)
for (ulong ptr = stop; ptr <= start; ptr += diff)
yield return ptr;
else
for (ulong ptr = stop; ptr >= start; ptr -= diff)
yield return ptr;
}
private DesktopBlockingObject FindLocks(ulong start, ulong stop, Func<ulong, ClrType, bool> isCorrectType)
{
foreach (ulong ptr in EnumeratePointersInRange(start, stop))
{
ulong val = 0;
if (_runtime.ReadPointer(ptr, out val))
{
DesktopBlockingObject result = null;
if (_locks.TryGetValue(val, out result) && isCorrectType(val, _heap.GetObjectType(val)))
return result;
}
}
return null;
}
private DesktopBlockingObject FindMonitor(ulong start, ulong stop)
{
ulong obj = 0;
foreach (ulong ptr in EnumeratePointersInRange(start, stop))
{
ulong tmp = 0;
if (_runtime.ReadPointer(ptr, out tmp))
{
if (_syncblks.TryGetValue(tmp, out tmp))
{
obj = tmp;
break;
}
}
}
DesktopBlockingObject result = null;
if (obj != 0 && _monitors.TryGetValue(obj, out result))
return result;
return null;
}
private ClrThread GetThreadById(int id)
{
if (id < 0)
return null;
foreach (ClrThread thread in _runtime.Threads)
if (thread.ManagedThreadId == id)
return thread;
return null;
}
private const int HASHCODE_BITS = 25;
private const int SYNCBLOCKINDEX_BITS = 26;
private const uint BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX = 0x08000000;
private const uint BIT_SBLK_FINALIZER_RUN = 0x40000000;
private const uint BIT_SBLK_SPIN_LOCK = 0x10000000;
private const uint SBLK_MASK_LOCK_THREADID = 0x000003FF; // special value of 0 + 1023 thread ids
private const int SBLK_MASK_LOCK_RECLEVEL = 0x0000FC00; // 64 recursion levels
private const uint SBLK_APPDOMAIN_SHIFT = 16; // shift right this much to get appdomain index
private const uint SBLK_MASK_APPDOMAININDEX = 0x000007FF; // 2048 appdomain indices
private const int SBLK_RECLEVEL_SHIFT = 10; // shift right this much to get recursion level
private const uint BIT_SBLK_IS_HASHCODE = 0x04000000;
private const uint MASK_HASHCODE = ((1 << HASHCODE_BITS) - 1);
private const uint MASK_SYNCBLOCKINDEX = ((1 << SYNCBLOCKINDEX_BITS) - 1);
}
}

Просмотреть файл

@ -0,0 +1,241 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using Address = System.UInt64;
namespace Microsoft.Diagnostics.Runtime.Desktop
{
internal class DesktopMethod : ClrMethod
{
public override string ToString()
{
return _sig;
}
internal static DesktopMethod Create(DesktopRuntimeBase runtime, ICorDebug.IMetadataImport metadata, IMethodDescData mdData)
{
if (mdData == null)
return null;
MethodAttributes attrs = (MethodAttributes)0;
if (metadata != null)
{
int pClass, methodLength;
uint blobLen, codeRva, implFlags;
IntPtr blob;
if (metadata.GetMethodProps(mdData.MDToken, out pClass, null, 0, out methodLength, out attrs, out blob, out blobLen, out codeRva, out implFlags) < 0)
attrs = (MethodAttributes)0;
}
return new DesktopMethod(runtime, mdData.MethodDesc, mdData, attrs);
}
List<ulong> _methodHandles;
internal void AddMethodHandle(ulong methodDesc)
{
if (_methodHandles == null)
_methodHandles = new List<ulong>(1);
_methodHandles.Add(methodDesc);
}
public override ulong MethodDesc
{
get
{
if (_methodHandles != null && _methodHandles[0] != 0)
return _methodHandles[0];
return EnumerateMethodDescs().FirstOrDefault();
}
}
public override IEnumerable<ulong> EnumerateMethodDescs()
{
if (_methodHandles == null)
_type.InitMethodHandles();
return _methodHandles;
}
internal static ClrMethod Create(DesktopRuntimeBase runtime, IMethodDescData mdData)
{
if (mdData == null)
return null;
DesktopModule module = runtime.GetModule(mdData.Module);
return Create(runtime, module != null ? module.GetMetadataImport() : null, mdData);
}
public DesktopMethod(DesktopRuntimeBase runtime, ulong md, IMethodDescData mdData, MethodAttributes attrs)
{
_runtime = runtime;
_sig = runtime.GetNameForMD(md);
_ip = mdData.NativeCodeAddr;
_jit = mdData.JITType;
_attrs = attrs;
_token = mdData.MDToken;
var heap = runtime.GetHeap();
_type = (DesktopHeapType)heap.GetTypeByMethodTable(mdData.MethodTable, 0);
}
public override string Name
{
get
{
if (_sig == null)
return null;
int last = _sig.LastIndexOf('(');
if (last > 0)
{
int first = _sig.LastIndexOf('.', last - 1);
if (first != -1 && _sig[first - 1] == '.')
first--;
return _sig.Substring(first + 1, last - first - 1);
}
return "{error}";
}
}
public override Address NativeCode
{
get { return _ip; }
}
public override MethodCompilationType CompilationType
{
get { return _jit; }
}
public override string GetFullSignature()
{
return _sig;
}
public override int GetILOffset(ulong addr)
{
ILToNativeMap[] map = ILOffsetMap;
if (map == null)
return -1;
int ilOffset = 0;
if (map.Length > 1)
ilOffset = map[1].ILOffset;
for (int i = 0; i < map.Length; ++i)
if (map[i].StartAddress <= addr && addr <= map[i].EndAddress)
return map[i].ILOffset;
return ilOffset;
}
public override bool IsStatic
{
get { return (_attrs & MethodAttributes.Static) == MethodAttributes.Static; }
}
public override bool IsFinal
{
get { return (_attrs & MethodAttributes.Final) == MethodAttributes.Final; }
}
public override bool IsPInvoke
{
get { return (_attrs & MethodAttributes.PinvokeImpl) == MethodAttributes.PinvokeImpl; }
}
public override bool IsVirtual
{
get { return (_attrs & MethodAttributes.Virtual) == MethodAttributes.Virtual; }
}
public override bool IsAbstract
{
get { return (_attrs & MethodAttributes.Abstract) == MethodAttributes.Abstract; }
}
public override bool IsPublic
{
get { return (_attrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public; }
}
public override bool IsPrivate
{
get { return (_attrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Private; }
}
public override bool IsInternal
{
get
{
MethodAttributes access = (_attrs & MethodAttributes.MemberAccessMask);
return access == MethodAttributes.Assembly || access == MethodAttributes.FamANDAssem;
}
}
public override bool IsProtected
{
get
{
MethodAttributes access = (_attrs & MethodAttributes.MemberAccessMask);
return access == MethodAttributes.Family || access == MethodAttributes.FamANDAssem || access == MethodAttributes.FamORAssem;
}
}
public override bool IsSpecialName
{
get
{
return (_attrs & MethodAttributes.SpecialName) == MethodAttributes.SpecialName;
}
}
public override bool IsRTSpecialName
{
get
{
return (_attrs & MethodAttributes.RTSpecialName) == MethodAttributes.RTSpecialName;
}
}
public override ILToNativeMap[] ILOffsetMap
{
get
{
if (_ilMap == null)
_ilMap = _runtime.GetILMap(_ip);
return _ilMap;
}
}
public override uint MetadataToken
{
get { return _token; }
}
public override ClrType Type
{
get { return _type; }
}
private uint _token;
private ILToNativeMap[] _ilMap;
private string _sig;
private ulong _ip;
private MethodCompilationType _jit;
private MethodAttributes _attrs;
private DesktopRuntimeBase _runtime;
private DesktopHeapType _type;
}
}

Просмотреть файл

@ -0,0 +1,471 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Address = System.UInt64;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.Diagnostics.Runtime.Utilities;
using System.Linq;
namespace Microsoft.Diagnostics.Runtime.Desktop
{
internal abstract class DesktopBaseModule : ClrModule
{
protected DesktopRuntimeBase _runtime;
public override ClrRuntime Runtime
{
get
{
return _runtime;
}
}
internal abstract Address GetDomainModule(ClrAppDomain appDomain);
internal Address ModuleId { get; set; }
internal virtual ICorDebug.IMetadataImport GetMetadataImport()
{
return null;
}
public int Revision { get; set; }
public DesktopBaseModule(DesktopRuntimeBase runtime)
{
_runtime = runtime;
}
}
internal class DesktopModule : DesktopBaseModule
{
static PdbInfo s_failurePdb = new PdbInfo();
private bool _reflection, _isPE;
private string _name, _assemblyName;
private ICorDebug.IMetadataImport _metadata;
private Dictionary<ClrAppDomain, ulong> _mapping = new Dictionary<ClrAppDomain, ulong>();
private Address _imageBase, _size;
private Address _metadataStart;
private Address _metadataLength;
private DebuggableAttribute.DebuggingModes? _debugMode;
private Address _assemblyAddress;
private bool _typesLoaded;
ClrAppDomain[] _appDomainList;
PdbInfo _pdb;
public DesktopModule(DesktopRuntimeBase runtime, ulong address, IModuleData data, string name, string assemblyName, ulong size)
: base(runtime)
{
Revision = runtime.Revision;
_imageBase = data.ImageBase;
_assemblyName = assemblyName;
_isPE = data.IsPEFile;
_reflection = data.IsReflection || string.IsNullOrEmpty(name) || !name.Contains("\\");
_name = name;
ModuleId = data.ModuleId;
ModuleIndex = data.ModuleIndex;
_metadataStart = data.MetdataStart;
_metadataLength = data.MetadataLength;
_assemblyAddress = data.Assembly;
_size = size;
if (!runtime.DataReader.IsMinidump)
{
// This is very expensive in the minidump case, as we may be heading out to the symbol server or
// reading multiple files from disk. Only optimistically fetch this data if we have full memory.
_metadata = data.LegacyMetaDataImport as ICorDebug.IMetadataImport;
}
else
{
// If we are a minidump and metadata isn't mapped in, attempt to fetch this module from the symbol server
// on a background thread.
#if !V2_SUPPORT
if (_isPE && _metadataStart != 0 && _metadataLength > 0)
{
int read;
byte[] tmp = new byte[1];
if (!_runtime.DataReader.ReadMemory(_metadataStart, tmp, 1, out read) || read == 0)
{
int filesize, imagesize;
if (PEFile.TryGetIndexProperties(new ReadVirtualStream(_runtime.DataReader, (long)data.ImageBase, (long)size), true, out imagesize, out filesize))
_runtime.DataTarget.SymbolLocator.PrefetchBinary(Path.GetFileName(assemblyName), imagesize, filesize);
}
}
#endif
}
}
public override PdbInfo Pdb
{
get
{
if (_pdb == null)
{
try
{
using (PEFile pefile = new PEFile(new ReadVirtualStream(_runtime.DataReader, (long)ImageBase, (long)(Size > 0 ? Size : 0x1000)), true))
{
_pdb = pefile.PdbInfo ?? s_failurePdb;
}
}
catch
{
}
}
return _pdb != s_failurePdb ? _pdb : null;
}
}
internal ulong GetMTForDomain(ClrAppDomain domain, DesktopHeapType type)
{
DesktopGCHeap heap = null;
var mtList = _runtime.GetMethodTableList(_mapping[domain]);
bool hasToken = type.MetadataToken != 0 && type.MetadataToken != uint.MaxValue;
uint token = ~0xff000000 & type.MetadataToken;
foreach (MethodTableTokenPair pair in mtList)
{
if (hasToken)
{
if (pair.Token == token)
return pair.MethodTable;
}
else
{
if (heap == null)
heap = (DesktopGCHeap)_runtime.GetHeap();
if (heap.GetTypeByMethodTable(pair.MethodTable, 0) == type)
return pair.MethodTable;
}
}
return 0;
}
public override IEnumerable<ClrType> EnumerateTypes()
{
var heap = (DesktopGCHeap)_runtime.GetHeap();
if (_typesLoaded)
{
foreach (var type in heap.EnumerateTypes())
if (type.Module == this)
yield return type;
}
else
{
var mtList = _runtime.GetMethodTableList(_mapping.First().Value);
if (mtList != null)
{
foreach (var pair in mtList)
{
ulong mt = pair.MethodTable;
if (mt != _runtime.ArrayMethodTable)
{
// prefetch element type, as this also can load types
var type = heap.GetTypeByMethodTable(mt, 0, 0);
if (type != null)
yield return type;
}
}
}
_typesLoaded = true;
}
}
public override string AssemblyName
{
get { return _assemblyName; }
}
public override string Name
{
get { return _name; }
}
public override bool IsDynamic
{
get { return _reflection; }
}
public override bool IsFile
{
get { return _isPE; }
}
public override string FileName
{
get { return _isPE ? _name : null; }
}
internal ulong ModuleIndex { get; private set; }
internal void AddMapping(ClrAppDomain domain, ulong domainModule)
{
DesktopAppDomain appDomain = (DesktopAppDomain)domain;
_mapping[domain] = domainModule;
}
public override IList<ClrAppDomain> AppDomains
{
get
{
if (_appDomainList == null)
{
_appDomainList = new ClrAppDomain[_mapping.Keys.Count];
_appDomainList = _mapping.Keys.ToArray();
Array.Sort(_appDomainList, (d, d2) => d.Id.CompareTo(d2.Id));
}
return _appDomainList;
}
}
internal override ulong GetDomainModule(ClrAppDomain domain)
{
_runtime.InitDomains();
if (domain == null)
{
foreach (ulong addr in _mapping.Values)
return addr;
return 0;
}
ulong value;
if (_mapping.TryGetValue(domain, out value))
return value;
return 0;
}
internal override ICorDebug.IMetadataImport GetMetadataImport()
{
if (Revision != _runtime.Revision)
ClrDiagnosticsException.ThrowRevisionError(Revision, _runtime.Revision);
if (_metadata != null)
return _metadata;
ulong module = GetDomainModule(null);
if (module == 0)
return null;
_metadata = _runtime.GetMetadataImport(module);
return _metadata;
}
public override Address ImageBase
{
get { return _imageBase; }
}
public override Address Size
{
get
{
return _size;
}
}
public override Address MetadataAddress
{
get { return _metadataStart; }
}
public override Address MetadataLength
{
get { return _metadataLength; }
}
public override ICorDebug.IMetadataImport MetadataImport
{
get { return GetMetadataImport(); }
}
public override DebuggableAttribute.DebuggingModes DebuggingMode
{
get
{
if (_debugMode == null)
InitDebugAttributes();
Debug.Assert(_debugMode != null);
return _debugMode.Value;
}
}
private void InitDebugAttributes()
{
ICorDebug.IMetadataImport metadata = GetMetadataImport();
if (metadata == null)
{
_debugMode = DebuggableAttribute.DebuggingModes.None;
return;
}
try
{
IntPtr data;
uint cbData;
int hr = metadata.GetCustomAttributeByName(0x20000001, "System.Diagnostics.DebuggableAttribute", out data, out cbData);
if (hr != 0 || cbData <= 4)
{
_debugMode = DebuggableAttribute.DebuggingModes.None;
return;
}
unsafe
{
byte* b = (byte*)data.ToPointer();
UInt16 opt = b[2];
UInt16 dbg = b[3];
_debugMode = (System.Diagnostics.DebuggableAttribute.DebuggingModes)((dbg << 8) | opt);
}
}
catch (SEHException)
{
_debugMode = DebuggableAttribute.DebuggingModes.None;
}
}
public override ClrType GetTypeByToken(uint token)
{
return _runtime.HeapBase.GetTypeByToken(this, token);
}
public override ClrType GetTypeByName(string name)
{
foreach (ClrType type in EnumerateTypes())
if (type.Name == name)
return type;
return null;
}
public override Address AssemblyId
{
get { return _assemblyAddress; }
}
}
internal class ErrorModule : DesktopBaseModule
{
private static uint s_id = 0;
private uint _id = s_id++;
public ErrorModule(DesktopRuntimeBase runtime)
: base(runtime)
{
}
public override PdbInfo Pdb
{
get
{
return null;
}
}
public override IList<ClrAppDomain> AppDomains
{
get
{
return new ClrAppDomain[0];
}
}
public override string AssemblyName
{
get { return "<error>"; }
}
public override string Name
{
get { return "<error>"; }
}
public override bool IsDynamic
{
get { return false; }
}
public override bool IsFile
{
get { return false; }
}
public override string FileName
{
get { return "<error>"; }
}
public override Address ImageBase
{
get { return 0; }
}
public override Address Size
{
get { return 0; }
}
public override IEnumerable<ClrType> EnumerateTypes()
{
return new ClrType[0];
}
public override Address MetadataAddress
{
get { return 0; }
}
public override Address MetadataLength
{
get { return 0; }
}
public override ICorDebug.IMetadataImport MetadataImport
{
get { return null; }
}
internal override Address GetDomainModule(ClrAppDomain appDomain)
{
return 0;
}
public override DebuggableAttribute.DebuggingModes DebuggingMode
{
get { return DebuggableAttribute.DebuggingModes.None; }
}
public override ClrType GetTypeByName(string name)
{
return null;
}
public override Address AssemblyId
{
get { return _id; }
}
public override ClrType GetTypeByToken(uint token)
{
return Runtime.GetHeap().ErrorType;
}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,322 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using Address = System.UInt64;
namespace Microsoft.Diagnostics.Runtime.Desktop
{
internal class DesktopThreadPool : ClrThreadPool
{
private DesktopRuntimeBase _runtime;
private ClrHeap _heap;
private int _totalThreads;
private int _runningThreads;
private int _idleThreads;
private int _minThreads;
private int _maxThreads;
private int _minCP;
private int _maxCP;
private int _cpu;
private int _freeCP;
private int _maxFreeCP;
public DesktopThreadPool(DesktopRuntimeBase runtime, IThreadPoolData data)
{
_runtime = runtime;
_totalThreads = data.TotalThreads;
_runningThreads = data.RunningThreads;
_idleThreads = data.IdleThreads;
_minThreads = data.MinThreads;
_maxThreads = data.MaxThreads;
_minCP = data.MinCP;
_maxCP = data.MaxCP;
_cpu = data.CPU;
_freeCP = data.NumFreeCP;
_maxFreeCP = data.MaxFreeCP;
}
public override int TotalThreads
{
get { return _totalThreads; }
}
public override int RunningThreads
{
get { return _runningThreads; }
}
public override int IdleThreads
{
get { return _idleThreads; }
}
public override int MinThreads
{
get { return _minThreads; }
}
public override int MaxThreads
{
get { return _maxThreads; }
}
public override IEnumerable<NativeWorkItem> EnumerateNativeWorkItems()
{
return _runtime.EnumerateWorkItems();
}
public override IEnumerable<ManagedWorkItem> EnumerateManagedWorkItems()
{
foreach (ulong obj in EnumerateManagedThreadpoolObjects())
{
if (obj != 0)
{
ClrType type = _heap.GetObjectType(obj);
if (type != null)
yield return new DesktopManagedWorkItem(type, obj);
}
}
}
private IEnumerable<ulong> EnumerateManagedThreadpoolObjects()
{
_heap = _runtime.GetHeap();
ClrModule mscorlib = GetMscorlib();
if (mscorlib != null)
{
ClrType queueType = mscorlib.GetTypeByName("System.Threading.ThreadPoolGlobals");
if (queueType != null)
{
ClrStaticField workQueueField = queueType.GetStaticFieldByName("workQueue");
if (workQueueField != null)
{
foreach (var appDomain in _runtime.AppDomains)
{
object workQueueValue = workQueueField.GetValue(appDomain);
ulong workQueue = workQueueValue == null ? 0L : (ulong)workQueueValue;
ClrType workQueueType = _heap.GetObjectType(workQueue);
if (workQueue == 0 || workQueueType == null)
continue;
ulong queueHead;
ClrType queueHeadType;
do
{
if (!GetFieldObject(workQueueType, workQueue, "queueHead", out queueHeadType, out queueHead))
break;
ulong nodes;
ClrType nodesType;
if (GetFieldObject(queueHeadType, queueHead, "nodes", out nodesType, out nodes) && nodesType.IsArray)
{
int len = nodesType.GetArrayLength(nodes);
for (int i = 0; i < len; ++i)
{
ulong addr = (ulong)nodesType.GetArrayElementValue(nodes, i);
if (addr != 0)
yield return addr;
}
}
if (!GetFieldObject(queueHeadType, queueHead, "Next", out queueHeadType, out queueHead))
break;
} while (queueHead != 0);
}
}
}
queueType = mscorlib.GetTypeByName("System.Threading.ThreadPoolWorkQueue");
if (queueType != null)
{
ClrStaticField threadQueuesField = queueType.GetStaticFieldByName("allThreadQueues");
if (threadQueuesField != null)
{
foreach (ClrAppDomain domain in _runtime.AppDomains)
{
ulong? threadQueue = (ulong?)threadQueuesField.GetValue(domain);
if (!threadQueue.HasValue || threadQueue.Value == 0)
continue;
ClrType threadQueueType = _heap.GetObjectType(threadQueue.Value);
if (threadQueueType == null)
continue;
ulong outerArray = 0;
ClrType outerArrayType = null;
if (!GetFieldObject(threadQueueType, threadQueue.Value, "m_array", out outerArrayType, out outerArray) || !outerArrayType.IsArray)
continue;
int outerLen = outerArrayType.GetArrayLength(outerArray);
for (int i = 0; i < outerLen; ++i)
{
ulong entry = (ulong)outerArrayType.GetArrayElementValue(outerArray, i);
if (entry == 0)
continue;
ClrType entryType = _heap.GetObjectType(entry);
if (entryType == null)
continue;
ulong array;
ClrType arrayType;
if (!GetFieldObject(entryType, entry, "m_array", out arrayType, out array) || !arrayType.IsArray)
continue;
int len = arrayType.GetArrayLength(array);
for (int j = 0; j < len; ++j)
{
ulong addr = (ulong)arrayType.GetArrayElementValue(array, i);
if (addr != 0)
yield return addr;
}
}
}
}
}
}
}
private ClrModule GetMscorlib()
{
foreach (ClrModule module in _runtime.Modules)
if (module.AssemblyName.Contains("mscorlib.dll"))
return module;
// Uh oh, this shouldn't have happened. Let's look more carefully (slowly).
foreach (ClrModule module in _runtime.Modules)
if (module.AssemblyName.ToLower().Contains("mscorlib"))
return module;
// Ok...not sure why we couldn't find it.
return null;
}
private bool GetFieldObject(ClrType type, ulong obj, string fieldName, out ClrType valueType, out ulong value)
{
value = 0;
valueType = null;
ClrInstanceField field = type.GetFieldByName(fieldName);
if (field == null)
return false;
value = (ulong)field.GetValue(obj);
if (value == 0)
return false;
valueType = _heap.GetObjectType(value);
return valueType != null;
}
public override int MinCompletionPorts
{
get { return _minCP; }
}
public override int MaxCompletionPorts
{
get { return _maxCP; }
}
public override int CpuUtilization
{
get { return _cpu; }
}
public override int FreeCompletionPortCount
{
get { return _freeCP; }
}
public override int MaxFreeCompletionPorts
{
get { return _maxFreeCP; }
}
}
internal class DesktopManagedWorkItem : ManagedWorkItem
{
private ClrType _type;
private Address _addr;
public DesktopManagedWorkItem(ClrType type, ulong addr)
{
_type = type;
_addr = addr;
}
public override Address Object
{
get { return _addr; }
}
public override ClrType Type
{
get { return _type; }
}
}
internal class DesktopNativeWorkItem : NativeWorkItem
{
private WorkItemKind _kind;
private ulong _callback, _data;
public DesktopNativeWorkItem(DacpWorkRequestData result)
{
_callback = result.Function;
_data = result.Context;
switch (result.FunctionType)
{
default:
case WorkRequestFunctionTypes.UNKNOWNWORKITEM:
_kind = WorkItemKind.Unknown;
break;
case WorkRequestFunctionTypes.TIMERDELETEWORKITEM:
_kind = WorkItemKind.TimerDelete;
break;
case WorkRequestFunctionTypes.QUEUEUSERWORKITEM:
_kind = WorkItemKind.QueueUserWorkItem;
break;
case WorkRequestFunctionTypes.ASYNCTIMERCALLBACKCOMPLETION:
_kind = WorkItemKind.AsyncTimer;
break;
case WorkRequestFunctionTypes.ASYNCCALLBACKCOMPLETION:
_kind = WorkItemKind.AsyncCallback;
break;
}
}
public DesktopNativeWorkItem(V45WorkRequestData result)
{
_callback = result.Function;
_data = result.Context;
_kind = WorkItemKind.Unknown;
}
public override WorkItemKind Kind
{
get { return _kind; }
}
public override Address Callback
{
get { return _callback; }
}
public override Address Data
{
get { return _data; }
}
}
}

Просмотреть файл

@ -0,0 +1,492 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using Microsoft.Diagnostics.Runtime.ICorDebug;
using System.Text;
using Address = System.UInt64;
using System.Linq;
namespace Microsoft.Diagnostics.Runtime.Desktop
{
internal class DesktopStackFrame : ClrStackFrame
{
public override ClrRuntime Runtime
{
get
{
return _runtime;
}
}
public override ClrThread Thread
{
get
{
return _thread;
}
}
public override Address StackPointer
{
get { return _sp; }
}
public override Address InstructionPointer
{
get { return _ip; }
}
public override ClrStackFrameType Kind
{
get { return _type; }
}
public override string DisplayString
{
get { return _frameName; }
}
public override IList<ClrValue> Arguments
{
get
{
if (_arguments != null)
return _arguments;
if (CordbFrame == null)
_thread.InitLocalData();
if (CordbFrame == null)
return new ClrValue[0];
ICorDebugValueEnum valueEnum;
CordbFrame.EnumerateArguments(out valueEnum);
_arguments = GetValueList(valueEnum);
return _arguments;
}
}
public override IList<ClrValue> Locals
{
get
{
if (_locals != null)
return _locals;
if (CordbFrame == null)
_thread.InitLocalData();
if (CordbFrame == null)
return new ClrValue[0];
ICorDebugValueEnum valueEnum;
CordbFrame.EnumerateLocalVariables(out valueEnum);
_locals = GetValueList(valueEnum);
return _locals;
}
}
private ClrValue[] GetValueList(ICorDebugValueEnum valueEnum)
{
uint count;
valueEnum.GetCount(out count);
ClrValue[] result = new ClrValue[count];
ICorDebugValue[] tmp = new ICorDebugValue[1];
uint fetched;
int i = 0;
while (i < result.Length && valueEnum.Next(1, tmp, out fetched) >= 0 && fetched == 1)
{
result[i] = new CorDebugValue(_runtime, tmp[0]);
i++;
}
return result;
}
public override ClrMethod Method
{
get
{
if (_method == null && _ip != 0 && _type == ClrStackFrameType.ManagedMethod)
_method = _runtime.GetMethodByAddress(_ip);
return _method;
}
}
public ICorDebugILFrame CordbFrame { get; internal set; }
public override string ToString()
{
if (_type == ClrStackFrameType.ManagedMethod)
return _frameName;
int methodLen = 0;
int methodTypeLen = 0;
if (_method != null)
{
methodLen = _method.Name.Length;
if (_method.Type != null)
methodTypeLen = _method.Type.Name.Length;
}
StringBuilder sb = new StringBuilder(_frameName.Length + methodLen + methodTypeLen + 10);
sb.Append('[');
sb.Append(_frameName);
sb.Append(']');
if (_method != null)
{
sb.Append(" (");
if (_method.Type != null)
{
sb.Append(_method.Type.Name);
sb.Append('.');
}
sb.Append(_method.Name);
sb.Append(')');
}
return sb.ToString();
}
public DesktopStackFrame(DesktopRuntimeBase runtime, DesktopThread thread, ulong ip, ulong sp, ulong md)
{
_runtime = runtime;
_thread = thread;
_ip = ip;
_sp = sp;
_frameName = _runtime.GetNameForMD(md) ?? "Unknown";
_type = ClrStackFrameType.ManagedMethod;
InitMethod(md);
}
public DesktopStackFrame(DesktopRuntimeBase runtime, DesktopThread thread, ulong sp, ulong md)
{
_runtime = runtime;
_thread = thread;
_sp = sp;
_frameName = _runtime.GetNameForMD(md) ?? "Unknown";
_type = ClrStackFrameType.Runtime;
InitMethod(md);
}
public DesktopStackFrame(DesktopRuntimeBase runtime, DesktopThread thread, ulong sp, string method, ClrMethod innerMethod)
{
_runtime = runtime;
_thread = thread;
_sp = sp;
_frameName = method ?? "Unknown";
_type = ClrStackFrameType.Runtime;
_method = innerMethod;
}
private void InitMethod(ulong md)
{
if (_method != null)
return;
if (_ip != 0 && _type == ClrStackFrameType.ManagedMethod)
{
_method = _runtime.GetMethodByAddress(_ip);
}
else if (md != 0)
{
IMethodDescData mdData = _runtime.GetMethodDescData(md);
_method = DesktopMethod.Create(_runtime, mdData);
}
}
private ulong _ip, _sp;
private string _frameName;
private ClrStackFrameType _type;
private ClrMethod _method;
private DesktopRuntimeBase _runtime;
private DesktopThread _thread;
private ClrValue[] _arguments;
private ClrValue[] _locals;
}
internal class DesktopThread : ThreadBase
{
internal DesktopRuntimeBase DesktopRuntime
{
get
{
return _runtime;
}
}
internal ICorDebugThread CorDebugThread
{
get
{
return DesktopRuntime.GetCorDebugThread(OSThreadId);
}
}
public override ClrRuntime Runtime
{
get
{
return _runtime;
}
}
public override ClrException CurrentException
{
get
{
ulong ex = _exception;
if (ex == 0)
return null;
if (!_runtime.ReadPointer(ex, out ex) || ex == 0)
return null;
return _runtime.GetHeap().GetExceptionObject(ex);
}
}
public override ulong StackBase
{
get
{
if (_teb == 0)
return 0;
ulong ptr = _teb + (ulong)IntPtr.Size;
if (!_runtime.ReadPointer(ptr, out ptr))
return 0;
return ptr;
}
}
public override ulong StackLimit
{
get
{
if (_teb == 0)
return 0;
ulong ptr = _teb + (ulong)IntPtr.Size * 2;
if (!_runtime.ReadPointer(ptr, out ptr))
return 0;
return ptr;
}
}
public override IEnumerable<ClrRoot> EnumerateStackObjects()
{
return _runtime.EnumerateStackReferences(this, true);
}
public override IEnumerable<ClrRoot> EnumerateStackObjects(bool includePossiblyDead)
{
return _runtime.EnumerateStackReferences(this, includePossiblyDead);
}
public override IList<ClrStackFrame> StackTrace
{
get
{
if (_stackTrace == null)
{
List<ClrStackFrame> frames = new List<ClrStackFrame>(32);
ulong lastSP = ulong.MaxValue;
int spCount = 0;
int max = 4096;
foreach (ClrStackFrame frame in _runtime.EnumerateStackFrames(this))
{
// We only allow a maximum of 4096 frames to be enumerated out of this stack trace to
// ensure we don't hit degenerate cases of stack unwind where we never make progress
// but the stack pointer keeps changing somehow.
if (max-- == 0)
break;
if (frame.StackPointer == lastSP)
{
// If we hit five stack frames with the same stack pointer then we aren't making progress
// in the unwind. At that point we need to stop to ensure we don't loop infinitely.
if (spCount++ >= 5)
break;
}
else
{
lastSP = frame.StackPointer;
spCount = 0;
}
frames.Add(frame);
}
_stackTrace = frames.ToArray();
}
return _stackTrace;
}
}
internal unsafe void InitLocalData()
{
if (_corDebugInit)
return;
_corDebugInit = true;
ICorDebugThread3 thread = (ICorDebugThread3)CorDebugThread;
ICorDebugStackWalk stackwalk;
thread.CreateStackWalk(out stackwalk);
do
{
ICorDebugFrame frame;
stackwalk.GetFrame(out frame);
ICorDebugILFrame ilFrame = frame as ICorDebugILFrame;
if (ilFrame == null)
continue;
byte[] context = ContextHelper.Context;
uint size;
fixed (byte *ptr = context)
stackwalk.GetContext(ContextHelper.ContextFlags, ContextHelper.Length, out size, new IntPtr(ptr));
ulong ip = BitConverter.ToUInt32(context, ContextHelper.InstructionPointerOffset);
ulong sp = BitConverter.ToUInt32(context, ContextHelper.StackPointerOffset);
DesktopStackFrame result = _stackTrace.Where(frm => sp == frm.StackPointer && ip == frm.InstructionPointer).Select(p => (DesktopStackFrame)p).SingleOrDefault();
if (result != null)
result.CordbFrame = ilFrame;
} while (stackwalk.Next() == 0);
}
public override IEnumerable<ClrStackFrame> EnumerateStackTrace()
{
return _runtime.EnumerateStackFrames(this);
}
public override IList<BlockingObject> BlockingObjects
{
get
{
((DesktopGCHeap)_runtime.GetHeap()).InitLockInspection();
if (_blockingObjs == null)
return new BlockingObject[0];
return _blockingObjs;
}
}
internal DesktopThread(DesktopRuntimeBase clr, IThreadData thread, ulong address, bool finalizer)
: base(thread, address, finalizer)
{
_runtime = clr;
}
private DesktopRuntimeBase _runtime;
private bool _corDebugInit;
}
internal class LocalVarRoot : ClrRoot
{
private bool _pinned;
private bool _falsePos;
private bool _interior;
private ClrThread _thread;
private ClrType _type;
private ClrAppDomain _domain;
public LocalVarRoot(ulong addr, ulong obj, ClrType type, ClrAppDomain domain, ClrThread thread, bool pinned, bool falsePos, bool interior)
{
Address = addr;
Object = obj;
_pinned = pinned;
_falsePos = falsePos;
_interior = interior;
_domain = domain;
_thread = thread;
_type = type;
}
public override ClrAppDomain AppDomain
{
get
{
return _domain;
}
}
public override ClrThread Thread
{
get
{
return _thread;
}
}
public override bool IsPossibleFalsePositive
{
get
{
return _falsePos;
}
}
public override string Name
{
get
{
return "local var";
}
}
public override bool IsPinned
{
get
{
return _pinned;
}
}
public override GCRootKind Kind
{
get
{
return GCRootKind.LocalVar;
}
}
public override bool IsInterior
{
get
{
return _interior;
}
}
public override ClrType Type
{
get { return _type; }
}
}
}

1964
ClrMemDiag/Desktop/types.cs Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,208 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using IStream = System.Runtime.InteropServices.ComTypes.IStream;
namespace Microsoft.Diagnostics.Runtime.ICorDebug
{
/// <summary>
/// Wrapper for the ICLRDebugging shim interface. This interface exposes the native pipeline
/// architecture startup APIs
/// </summary>
sealed class CLRDebugging
{
private static readonly Guid clsidCLRDebugging = new Guid("BACC578D-FBDD-48a4-969F-02D932B74634");
private ICLRDebugging _clrDebugging;
/// <summary>
/// Constructor
/// </summary>
/// <remarks>Creates the underlying interface from mscoree!CLRCreateInstance</remarks>
public CLRDebugging()
{
object o;
Guid ifaceId = typeof(ICLRDebugging).GUID;
Guid clsid = clsidCLRDebugging;
NativeMethods.CLRCreateInstance(ref clsid, ref ifaceId, out o);
_clrDebugging = (ICLRDebugging)o;
}
public static ICorDebug GetDebuggerForProcess(int processID, string minimumVersion, DebuggerCallBacks callBacks = null)
{
CLRMetaHost mh = new CLRMetaHost();
CLRRuntimeInfo highestLoadedRuntime = null;
foreach (var runtime in mh.EnumerateLoadedRuntimes(processID))
{
if (highestLoadedRuntime == null ||
string.Compare(highestLoadedRuntime.GetVersionString(), runtime.GetVersionString(), StringComparison.OrdinalIgnoreCase) < 0)
highestLoadedRuntime = runtime;
}
if (highestLoadedRuntime == null)
throw new ApplicationException("Could not enumerate .NET runtimes on the system.");
var runtimeVersion = highestLoadedRuntime.GetVersionString();
if (string.Compare(runtimeVersion, minimumVersion, StringComparison.OrdinalIgnoreCase) < 0)
throw new ApplicationException("Runtime in process " + runtimeVersion + " below the minimum of " + minimumVersion);
ICorDebug rawDebuggingAPI = highestLoadedRuntime.GetLegacyICorDebugInterface();
if (rawDebuggingAPI == null)
throw new ArgumentException("Cannot be null.", "rawDebugggingAPI");
rawDebuggingAPI.Initialize();
if (callBacks == null)
callBacks = new DebuggerCallBacks();
rawDebuggingAPI.SetManagedHandler(callBacks);
return rawDebuggingAPI;
}
public static ICorDebugProcess CreateICorDebugProcess(ulong baseAddress, ICorDebugDataTarget dataTarget, ICLRDebuggingLibraryProvider libraryProvider)
{
Debug.Assert(baseAddress != 0);
Version version;
ClrDebuggingProcessFlags flags;
ICorDebugProcess process;
int errorCode = new CLRDebugging().TryOpenVirtualProcess(baseAddress, dataTarget, libraryProvider, new Version(4, 6, 0x7fff, 0x7fff), out version, out flags, out process);
if (errorCode < 0)
{
if (((errorCode != -2146231228) && (errorCode != -2146231226)) && (errorCode != -2146231225))
{
Marshal.ThrowExceptionForHR(errorCode);
}
process = null;
}
return process;
}
/// <summary>
/// Detects if a native module represents a CLR and if so provides the debugging interface
/// and versioning information
/// </summary>
/// <param name="moduleBaseAddress">The native base address of a module which might be a CLR</param>
/// <param name="dataTarget">The process abstraction which can be used for inspection</param>
/// <param name="libraryProvider">A callback interface for locating version specific debug libraries
/// such as mscordbi.dll and mscordacwks.dll</param>
/// <param name="maxDebuggerSupportedVersion">The highest version of the CLR/debugging libraries which
/// the caller can support</param>
/// <param name="version">The version of the CLR detected or null if no CLR was detected</param>
/// <param name="flags">Flags which have additional information about the CLR.
/// See ClrDebuggingProcessFlags for more details</param>
/// <returns>The CLR's debugging interface</returns>
public ICorDebugProcess OpenVirtualProcess(ulong moduleBaseAddress,
ICorDebugDataTarget dataTarget,
ICLRDebuggingLibraryProvider libraryProvider,
Version maxDebuggerSupportedVersion,
out Version version,
out ClrDebuggingProcessFlags flags)
{
ICorDebugProcess process;
int hr = TryOpenVirtualProcess(moduleBaseAddress, dataTarget, libraryProvider, maxDebuggerSupportedVersion, out version, out flags, out process);
if (hr < 0)
throw new Exception("Failed to OpenVirtualProcess for module at " + moduleBaseAddress + ". hr = " + hr.ToString("x"));
return process;
}
/// <summary>
/// Version of the above that doesn't throw exceptions on failure
/// </summary>
public int TryOpenVirtualProcess(ulong moduleBaseAddress,
ICorDebugDataTarget dataTarget,
ICLRDebuggingLibraryProvider libraryProvider,
Version maxDebuggerSupportedVersion,
out Version version,
out ClrDebuggingProcessFlags flags,
out ICorDebugProcess process)
{
ClrDebuggingVersion maxSupport = new ClrDebuggingVersion();
ClrDebuggingVersion clrVersion = new ClrDebuggingVersion();
maxSupport.StructVersion = 0;
maxSupport.Major = (short)maxDebuggerSupportedVersion.Major;
maxSupport.Minor = (short)maxDebuggerSupportedVersion.Minor;
maxSupport.Build = (short)maxDebuggerSupportedVersion.Build;
maxSupport.Revision = (short)maxDebuggerSupportedVersion.Revision;
object processIface = null;
clrVersion.StructVersion = 0;
Guid iid = typeof(ICorDebugProcess).GUID;
int result = _clrDebugging.OpenVirtualProcess(moduleBaseAddress, dataTarget, libraryProvider,
ref maxSupport, ref iid, out processIface, ref clrVersion, out flags);
// This may be set regardless of success/failure
version = new Version(clrVersion.Major, clrVersion.Minor, clrVersion.Build, clrVersion.Revision);
if (result < 0)
{
// OpenVirtualProcess failed
process = null;
return result;
}
// Success
process = (ICorDebugProcess)processIface;
return 0;
}
/// <summary>
/// Determines if the module is no longer in use
/// </summary>
/// <param name="moduleHandle">A module handle that was provided via the ILibraryProvider</param>
/// <returns>True if the module can be unloaded, False otherwise</returns>
public bool CanUnloadNow(IntPtr moduleHandle)
{
int ret = _clrDebugging.CanUnloadNow(moduleHandle);
if (ret == 0) // S_OK
return true;
else if (ret == (int)1) // S_FALSE
return false;
else
Marshal.ThrowExceptionForHR(ret);
//unreachable
throw new Exception();
}
}
class DebuggerCallBacks : ICorDebugManagedCallback3, ICorDebugManagedCallback2, ICorDebugManagedCallback
{
public virtual void CustomNotification(ICorDebugThread pThread, ICorDebugAppDomain pAppDomain) { pAppDomain.Continue(0); }
public virtual void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset) { pAppDomain.Continue(0); }
public virtual void CreateConnection(ICorDebugProcess pProcess, uint dwConnectionId, ref ushort pConnName) { pProcess.Continue(0); }
public virtual void ChangeConnection(ICorDebugProcess pProcess, uint dwConnectionId) { pProcess.Continue(0); }
public virtual void DestroyConnection(ICorDebugProcess pProcess, uint dwConnectionId) { pProcess.Continue(0); }
public virtual void Exception(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFrame pFrame, uint nOffset, CorDebugExceptionCallbackType dwEventType, uint dwFlags) { pAppDomain.Continue(0); }
public virtual void ExceptionUnwind(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags) { pAppDomain.Continue(0); }
public virtual void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction) { pAppDomain.Continue(0); }
public virtual void MDANotification(ICorDebugController pController, ICorDebugThread pThread, ICorDebugMDA pMDA) { pController.Continue(0); }
public virtual void Breakpoint(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint pBreakpoint) { pAppDomain.Continue(0); }
public virtual void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason) { pAppDomain.Continue(0); }
public virtual void Break(ICorDebugAppDomain pAppDomain, ICorDebugThread thread) { pAppDomain.Continue(0); }
public virtual void Exception(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int unhandled) { pAppDomain.Continue(0); }
public virtual void EvalComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval pEval) { pAppDomain.Continue(0); }
public virtual void EvalException(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval pEval) { pAppDomain.Continue(0); }
public virtual void CreateProcess(ICorDebugProcess pProcess) { pProcess.Continue(0); }
public virtual void ExitProcess(ICorDebugProcess pProcess) { pProcess.Continue(0); }
public virtual void CreateThread(ICorDebugAppDomain pAppDomain, ICorDebugThread thread) { pAppDomain.Continue(0); }
public virtual void ExitThread(ICorDebugAppDomain pAppDomain, ICorDebugThread thread) { pAppDomain.Continue(0); }
public virtual void LoadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { pAppDomain.Continue(0); }
public virtual void UnloadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { pAppDomain.Continue(0); }
public virtual void LoadClass(ICorDebugAppDomain pAppDomain, ICorDebugClass c) { pAppDomain.Continue(0); }
public virtual void UnloadClass(ICorDebugAppDomain pAppDomain, ICorDebugClass c) { pAppDomain.Continue(0); }
public virtual void DebuggerError(ICorDebugProcess pProcess, int errorHR, uint errorCode) { pProcess.Continue(0); }
public virtual void LogMessage(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int lLevel, string pLogSwitchName, string pMessage) { pAppDomain.Continue(0); }
public virtual void LogSwitch(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int lLevel, uint ulReason, string pLogSwitchName, string pParentName) { pAppDomain.Continue(0); }
public virtual void CreateAppDomain(ICorDebugProcess pProcess, ICorDebugAppDomain pAppDomain) { pAppDomain.Continue(0); }
public virtual void ExitAppDomain(ICorDebugProcess pProcess, ICorDebugAppDomain pAppDomain) { pAppDomain.Continue(0); }
public virtual void LoadAssembly(ICorDebugAppDomain pAppDomain, ICorDebugAssembly pAssembly) { pAppDomain.Continue(0); }
public virtual void UnloadAssembly(ICorDebugAppDomain pAppDomain, ICorDebugAssembly pAssembly) { pAppDomain.Continue(0); }
public virtual void ControlCTrap(ICorDebugProcess pProcess) { pProcess.Continue(0); }
public virtual void NameChange(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread) { pAppDomain.Continue(0); }
public virtual void UpdateModuleSymbols(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule, IStream pSymbolStream) { pAppDomain.Continue(0); }
public virtual void EditAndContinueRemap(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate) { pAppDomain.Continue(0); }
public virtual void BreakpointSetError(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint pBreakpoint, uint dwError) { pAppDomain.Continue(0); }
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,562 @@
//---------------------------------------------------------------------
// This file is part of the CLR Managed Debugger (mdbg) Sample.
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Security.Permissions;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.ICorDebug
{
class ProcessSafeHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
private ProcessSafeHandle()
: base(true)
{
}
private ProcessSafeHandle(IntPtr handle, bool ownsHandle)
: base(ownsHandle)
{
SetHandle(handle);
}
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
override protected bool ReleaseHandle()
{
return NativeMethods.CloseHandle(handle);
}
}
static class NativeMethods
{
private const string Kernel32LibraryName = "kernel32.dll";
private const string Ole32LibraryName = "ole32.dll";
private const string ShlwapiLibraryName = "shlwapi.dll";
private const string ShimLibraryName = "mscoree.dll";
public const int MAX_PATH = 260;
[
System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success),
DllImport(Kernel32LibraryName)
]
public static extern bool CloseHandle(IntPtr handle);
[
DllImport(ShimLibraryName, CharSet = CharSet.Unicode, PreserveSig = false)
]
public static extern ICorDebug CreateDebuggingInterfaceFromVersion(int iDebuggerVersion
, string szDebuggeeVersion);
[
DllImport(ShimLibraryName, CharSet = CharSet.Unicode, PreserveSig = false)
]
public static extern void GetVersionFromProcess(ProcessSafeHandle hProcess, StringBuilder versionString,
Int32 bufferSize, out Int32 dwLength);
[
DllImport(ShimLibraryName, CharSet = CharSet.Unicode, PreserveSig = false)
]
public static extern void GetRequestedRuntimeVersion(string pExe, StringBuilder pVersion,
Int32 cchBuffer, out Int32 dwLength);
[
DllImport(ShimLibraryName, CharSet = CharSet.Unicode, PreserveSig = false)
]
public static extern void CLRCreateInstance(ref Guid clsid, ref Guid riid,
[MarshalAs(UnmanagedType.Interface)]out object metahostInterface);
public enum ProcessAccessOptions : int
{
ProcessTerminate = 0x0001,
ProcessCreateThread = 0x0002,
ProcessSetSessionID = 0x0004,
ProcessVMOperation = 0x0008,
ProcessVMRead = 0x0010,
ProcessVMWrite = 0x0020,
ProcessDupHandle = 0x0040,
ProcessCreateProcess = 0x0080,
ProcessSetQuota = 0x0100,
ProcessSetInformation = 0x0200,
ProcessQueryInformation = 0x0400,
ProcessSuspendResume = 0x0800,
Synchronize = 0x100000,
}
[
DllImport(Kernel32LibraryName, PreserveSig = true)
]
public static extern ProcessSafeHandle OpenProcess(Int32 dwDesiredAccess, bool bInheritHandle, Int32 dwProcessId);
#if false
[
DllImport(Kernel32LibraryName, CharSet = CharSet.Unicode, PreserveSig = true)
]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool QueryFullProcessImageName(ProcessSafeHandle hProcess,
int dwFlags,
StringBuilder lpExeName,
ref int lpdwSize);
[
DllImport(Ole32LibraryName, PreserveSig = false)
]
public static extern void CoCreateInstance(ref Guid rclsid, IntPtr pUnkOuter,
Int32 dwClsContext,
ref Guid riid, // must use "typeof(ICorDebug).GUID"
[MarshalAs(UnmanagedType.Interface)]out ICorDebug debuggingInterface
);
public enum Stgm
{
StgmRead = 0x00000000,
StgmWrite = 0x00000001,
StgmReadWrite = 0x00000002,
StgmShareDenyNone = 0x00000040,
StgmShareDenyRead = 0x00000030,
StgmShareDenyWrite = 0x00000020,
StgmShareExclusive = 0x00000010,
StgmPriority = 0x00040000,
StgmCreate = 0x00001000,
StgmConvert = 0x00020000,
StgmFailIfThere = 0x00000000,
StgmDirect = 0x00000000,
StgmTransacted = 0x00010000,
StgmNoScratch = 0x00100000,
StgmNoSnapshot = 0x00200000,
StgmSimple = 0x08000000,
StgmDirectSwmr = 0x00400000,
StgmDeleteOnRelease = 0x04000000
}
// SHCreateStreamOnFile* is used to create IStreams to pass to ICLRMetaHostPolicy::GetRequestedRuntime().
// Since we can't count on the EX version being available, we have SHCreateStreamOnFile as a fallback.
[
DllImport(ShlwapiLibraryName, PreserveSig = false)
]
// Only in version 6 and later
public static extern void SHCreateStreamOnFileEx([MarshalAs(UnmanagedType.LPWStr)]string file,
Stgm dwMode,
Int32 dwAttributes, // Used if a file is created. Identical to dwFlagsAndAttributes param of CreateFile.
bool create,
IntPtr pTemplate, // Reserved, always pass null.
[MarshalAs(UnmanagedType.Interface)]out IStream openedStream);
[
DllImport(ShlwapiLibraryName, PreserveSig = false)
]
public static extern void SHCreateStreamOnFile(string file,
Stgm dwMode,
[MarshalAs(UnmanagedType.Interface)]out IStream openedStream);
#endif
}
// Wrapper for ICLRMetaHost. Used to find information about runtimes.
sealed class CLRMetaHost
{
private ICLRMetaHost m_metaHost;
public const int MaxVersionStringLength = 26; // 24 + NULL and an extra
private static readonly Guid clsidCLRMetaHost = new Guid("9280188D-0E8E-4867-B30C-7FA83884E8DE");
public CLRMetaHost()
{
object o;
Guid ifaceId = typeof(ICLRMetaHost).GUID;
Guid clsid = clsidCLRMetaHost;
NativeMethods.CLRCreateInstance(ref clsid, ref ifaceId, out o);
m_metaHost = (ICLRMetaHost)o;
}
public CLRRuntimeInfo GetInstalledRuntimeByVersion(string version)
{
IEnumerable<CLRRuntimeInfo> runtimes = EnumerateInstalledRuntimes();
foreach (CLRRuntimeInfo rti in runtimes)
{
if (rti.GetVersionString().ToString().ToLower() == version.ToLower())
{
return rti;
}
}
return null;
}
public CLRRuntimeInfo GetLoadedRuntimeByVersion(Int32 processId, string version)
{
IEnumerable<CLRRuntimeInfo> runtimes = EnumerateLoadedRuntimes(processId);
foreach (CLRRuntimeInfo rti in runtimes)
{
if (rti.GetVersionString().Equals(version, StringComparison.OrdinalIgnoreCase))
{
return rti;
}
}
return null;
}
// Retrieve information about runtimes installed on the machine (i.e. in %WINDIR%\Microsoft.NET\)
public IEnumerable<CLRRuntimeInfo> EnumerateInstalledRuntimes()
{
List<CLRRuntimeInfo> runtimes = new List<CLRRuntimeInfo>();
IEnumUnknown enumRuntimes = m_metaHost.EnumerateInstalledRuntimes();
// Since we're only getting one at a time, we can pass NULL for count.
// S_OK also means we got the single element we asked for.
for (object oIUnknown; enumRuntimes.Next(1, out oIUnknown, IntPtr.Zero) == 0; /* empty */)
{
runtimes.Add(new CLRRuntimeInfo(oIUnknown));
}
return runtimes;
}
// Retrieve information about runtimes that are currently loaded into the target process.
public IEnumerable<CLRRuntimeInfo> EnumerateLoadedRuntimes(Int32 processId)
{
List<CLRRuntimeInfo> runtimes = new List<CLRRuntimeInfo>();
IEnumUnknown enumRuntimes;
using (ProcessSafeHandle hProcess = NativeMethods.OpenProcess(
/*
(int)(NativeMethods.ProcessAccessOptions.ProcessVMRead |
NativeMethods.ProcessAccessOptions.ProcessQueryInformation |
NativeMethods.ProcessAccessOptions.ProcessDupHandle |
NativeMethods.ProcessAccessOptions.Synchronize),
**/
// TODO FIX NOW for debugging.
0x1FFFFF, // PROCESS_ALL_ACCESS
false, // inherit handle
processId))
{
if (hProcess.IsInvalid)
{
throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error());
}
enumRuntimes = m_metaHost.EnumerateLoadedRuntimes(hProcess);
}
// Since we're only getting one at a time, we can pass NULL for count.
// S_OK also means we got the single element we asked for.
for (object oIUnknown; enumRuntimes.Next(1, out oIUnknown, IntPtr.Zero) == 0; /* empty */)
{
runtimes.Add(new CLRRuntimeInfo(oIUnknown));
}
return runtimes;
}
public CLRRuntimeInfo GetRuntime(string version)
{
Guid ifaceId = typeof(ICLRRuntimeInfo).GUID;
return new CLRRuntimeInfo(m_metaHost.GetRuntime(version, ref ifaceId));
}
}
// You're expected to get this interface from mscoree!GetCLRMetaHost.
// Details for APIs are in metahost.idl.
[ComImport, InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown), Guid("D332DB9E-B9B3-4125-8207-A14884F53216")]
internal interface ICLRMetaHost
{
[return: MarshalAs(UnmanagedType.Interface)]
System.Object GetRuntime(
[In, MarshalAs(UnmanagedType.LPWStr)] string pwzVersion,
[In] ref Guid riid /*must use typeof(ICLRRuntimeInfo).GUID*/);
void GetVersionFromFile(
[In, MarshalAs(UnmanagedType.LPWStr)] string pwzFilePath,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwzBuffer,
[In, Out] ref uint pcchBuffer);
[return: MarshalAs(UnmanagedType.Interface)]
IEnumUnknown EnumerateInstalledRuntimes();
[return: MarshalAs(UnmanagedType.Interface)]
IEnumUnknown EnumerateLoadedRuntimes(
[In] ProcessSafeHandle hndProcess);
}
// Wrapper for ICLRRuntimeInfo. Represents information about a CLR install instance.
sealed class CLRRuntimeInfo
{
public CLRRuntimeInfo(System.Object clrRuntimeInfo)
{
m_runtimeInfo = (ICLRRuntimeInfo)clrRuntimeInfo;
}
public string GetVersionString()
{
StringBuilder sb = new StringBuilder(CLRMetaHost.MaxVersionStringLength);
int verStrLength = sb.Capacity;
m_runtimeInfo.GetVersionString(sb, ref verStrLength);
return sb.ToString();
}
public string GetRuntimeDirectory()
{
StringBuilder sb = new StringBuilder();
int strLength = 0;
m_runtimeInfo.GetRuntimeDirectory(sb, ref strLength);
sb.Capacity = strLength;
int ret = m_runtimeInfo.GetRuntimeDirectory(sb, ref strLength);
if (ret < 0)
Marshal.ThrowExceptionForHR(ret);
return sb.ToString();
}
public ICorDebug GetLegacyICorDebugInterface()
{
Guid ifaceId = typeof(ICorDebug).GUID;
Guid clsId = s_ClsIdClrDebuggingLegacy;
return (ICorDebug)m_runtimeInfo.GetInterface(ref clsId, ref ifaceId);
}
#region private
private static Guid s_ClsIdClrDebuggingLegacy = new Guid("DF8395B5-A4BA-450b-A77C-A9A47762C520");
private static Guid s_ClsIdClrProfiler = new Guid("BD097ED8-733E-43FE-8ED7-A95FF9A8448C");
private static Guid s_CorMetaDataDispenser = new Guid("E5CB7A31-7512-11d2-89CE-0080C792E5D8");
private ICLRRuntimeInfo m_runtimeInfo;
#endregion
}
[ComImport, Guid("809C652E-7396-11D2-9771-00A0C9B4D50C"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IMetaDataDispenser
{
/// <summary>
/// Creates a new area in memory in which you can create new metadata.
/// </summary>
/// <param name="rclsid">[in] The CLSID of the version of metadata structures to be created. This value must be CLSID_CorMetaDataRuntime.</param>
/// <param name="dwCreateFlags">[in] Flags that specify options. This value must be zero.</param>
/// <param name="riid">
/// [in] The IID of the desired metadata interface to be returned; the caller will use the interface to create the new metadata.
/// The value of riid must specify one of the "emit" interfaces. Valid values are IID_IMetaDataEmit, IID_IMetaDataAssemblyEmit, or IID_IMetaDataEmit2.
/// </param>
/// <param name="ppIUnk">[out] The pointer to the returned interface.</param>
/// <remarks>
/// STDMETHOD(DefineScope)( // Return code.
/// REFCLSID rclsid, // [in] What version to create.
/// DWORD dwCreateFlags, // [in] Flags on the create.
/// REFIID riid, // [in] The interface desired.
/// IUnknown **ppIUnk) PURE; // [out] Return interface on success.
/// </remarks>
[PreserveSig]
void DefineScope(
[In] ref Guid rclsid,
[In] uint dwCreateFlags,
[In] ref Guid riid,
[Out, MarshalAs(UnmanagedType.Interface)] out object ppIUnk);
/// <summary>
/// Opens an existing, on-disk file and maps its metadata into memory.
/// </summary>
/// <param name="szScope">[in] The name of the file to be opened. The file must contain common language runtime (CLR) metadata.</param>
/// <param name="dwOpenFlags">[in] A value of the <c>CorOpenFlags</c> enumeration to specify the mode (read, write, and so on) for opening. </param>
/// <param name="riid">
/// [in] The IID of the desired metadata interface to be returned; the caller will use the interface to import (read) or emit (write) metadata.
/// The value of riid must specify one of the "import" or "emit" interfaces. Valid values are IID_IMetaDataEmit, IID_IMetaDataImport, IID_IMetaDataAssemblyEmit, IID_IMetaDataAssemblyImport, IID_IMetaDataEmit2, or IID_IMetaDataImport2.
/// </param>
/// <param name="ppIUnk">[out] The pointer to the returned interface.</param>
/// <remarks>
/// STDMETHOD(OpenScope)( // Return code.
/// LPCWSTR szScope, // [in] The scope to open.
/// DWORD dwOpenFlags, // [in] Open mode flags.
/// REFIID riid, // [in] The interface desired.
/// IUnknown **ppIUnk) PURE; // [out] Return interface on success.
/// </remarks>
[PreserveSig]
void OpenScope(
[In, MarshalAs(UnmanagedType.LPWStr)] string szScope,
[In] int dwOpenFlags,
[In] ref Guid riid,
[Out, MarshalAs(UnmanagedType.Interface)] out object ppIUnk);
/// <summary>
/// Opens an area of memory that contains existing metadata. That is, this method opens a specified area of memory in which the existing data is treated as metadata.
/// </summary>
/// <param name="pData">[in] A pointer that specifies the starting address of the memory area.</param>
/// <param name="cbData">[in] The size of the memory area, in bytes.</param>
/// <param name="dwOpenFlags">[in] A value of the <c>CorOpenFlags</c> enumeration to specify the mode (read, write, and so on) for opening.</param>
/// <param name="riid">
/// [in] The IID of the desired metadata interface to be returned; the caller will use the interface to import (read) or emit (write) metadata.
/// The value of riid must specify one of the "import" or "emit" interfaces. Valid values are IID_IMetaDataEmit, IID_IMetaDataImport, IID_IMetaDataAssemblyEmit, IID_IMetaDataAssemblyImport, IID_IMetaDataEmit2, or IID_IMetaDataImport2.
/// </param>
/// <param name="ppIUnk">[out] The pointer to the returned interface.</param>
/// <remarks>
/// STDMETHOD(OpenScopeOnMemory)( // Return code.
/// LPCVOID pData, // [in] Location of scope data.
/// ULONG cbData, // [in] Size of the data pointed to by pData.
/// DWORD dwOpenFlags, // [in] Open mode flags.
/// REFIID riid, // [in] The interface desired.
/// IUnknown **ppIUnk) PURE; // [out] Return interface on success.
/// </remarks>
[PreserveSig]
void OpenScopeOnMemory(
[In] IntPtr pData,
[In] uint cbData,
[In] int dwOpenFlags,
[In] ref Guid riid,
[Out, MarshalAs(UnmanagedType.IUnknown)] out object ppIUnk);
}
// Details about this interface are in metahost.idl.
[ComImport, InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown), Guid("BD39D1D2-BA2F-486A-89B0-B4B0CB466891")]
internal interface ICLRRuntimeInfo
{
// Marshalling pcchBuffer as int even though it's unsigned. Max version string is 24 characters, so we should not need to go over 2 billion soon.
void GetVersionString([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwzBuffer,
[In, Out, MarshalAs(UnmanagedType.U4)] ref int pcchBuffer);
// Marshalling pcchBuffer as int even though it's unsigned. MAX_PATH is 260, unicode paths are 65535, so we should not need to go over 2 billion soon.
[PreserveSig]
int GetRuntimeDirectory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwzBuffer,
[In, Out, MarshalAs(UnmanagedType.U4)] ref int pcchBuffer);
int IsLoaded([In] IntPtr hndProcess);
// Marshal pcchBuffer as int even though it's unsigned. Error strings approaching 2 billion characters are currently unheard-of.
[LCIDConversion(3)]
void LoadErrorString([In, MarshalAs(UnmanagedType.U4)] int iResourceID,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwzBuffer,
[In, Out, MarshalAs(UnmanagedType.U4)] ref int pcchBuffer,
[In] int iLocaleID);
IntPtr LoadLibrary([In, MarshalAs(UnmanagedType.LPWStr)] string pwzDllName);
IntPtr GetProcAddress([In, MarshalAs(UnmanagedType.LPStr)] string pszProcName);
[return: MarshalAs(UnmanagedType.IUnknown)]
System.Object GetInterface([In] ref Guid rclsid, [In] ref Guid riid);
}
// Wrapper for standard COM IEnumUnknown, needed for ICLRMetaHost enumeration APIs.
[ComImport, InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown), Guid("00000100-0000-0000-C000-000000000046")]
internal interface IEnumUnknown
{
[PreserveSig]
int Next(
[In, MarshalAs(UnmanagedType.U4)]
int celt,
[Out, MarshalAs(UnmanagedType.IUnknown)]
out System.Object rgelt,
IntPtr pceltFetched);
[PreserveSig]
int Skip(
[In, MarshalAs(UnmanagedType.U4)]
int celt);
void Reset();
void Clone(
[Out]
out IEnumUnknown ppenum);
}
/// <summary>
/// Represents a version of the CLR runtime
/// </summary>
public struct ClrDebuggingVersion
{
public short StructVersion;
public short Major;
public short Minor;
public short Build;
public short Revision;
}
/// <summary>
/// Information flags about the state of a CLR when it is being attached
/// to in the native pipeline debugging model
/// </summary>
public enum ClrDebuggingProcessFlags
{
// This CLR has a non-catchup managed debug event to send after jit attach is complete
ManagedDebugEventPending = 1
}
/// <summary>
/// This interface exposes the native pipeline architecture startup APIs
/// </summary>
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("D28F3C5A-9634-4206-A509-477552EEFB10")]
public interface ICLRDebugging
{
/// <summary>
/// Detects if a native module represents a CLR and if so provides the debugging interface
/// and versioning information
/// </summary>
/// <param name="moduleBaseAddress">The native base address of a module which might be a CLR</param>
/// <param name="dataTarget">The process abstraction which can be used for inspection</param>
/// <param name="libraryProvider">A callback interface for locating version specific debug libraries
/// such as mscordbi.dll and mscordacwks.dll</param>
/// <param name="maxDebuggerSupportedVersion">The highest version of the CLR/debugging libraries which
/// the caller can support</param>
/// <param name="process">The CLR's debugging interface or null if no debugger was detected</param>
/// <param name="version">The version of the CLR detected or null if no CLR was detected</param>
/// <param name="flags">Flags which have additional information about the CLR.
/// <param name="riidProcess">The Guid for the interface requested.</param>
/// See ClrDebuggingProcessFlags for more details</param>
/// <returns>HResults.S_OK if an appropriate version CLR was detected, otherwise an appropriate
/// error hresult</returns>
[PreserveSig]
int OpenVirtualProcess([In] ulong moduleBaseAddress,
[In, MarshalAs(UnmanagedType.IUnknown)] object dataTarget,
[In, MarshalAs(UnmanagedType.Interface)] ICLRDebuggingLibraryProvider libraryProvider,
[In] ref ClrDebuggingVersion maxDebuggerSupportedVersion,
[In] ref Guid riidProcess,
[Out, MarshalAs(UnmanagedType.IUnknown)] out object process,
[In, Out] ref ClrDebuggingVersion version,
[Out] out ClrDebuggingProcessFlags flags);
/// <summary>
/// Determines if the module is no longer in use
/// </summary>
/// <param name="moduleHandle">A module handle that was provided via the ILibraryProvider</param>
/// <returns>HResults.S_OK if the module can be unloaded, HResults.S_FALSE if it is in use
/// or an appropriate error hresult otherwise</returns>
[PreserveSig]
int CanUnloadNow(IntPtr moduleHandle);
}
/// <summary>
/// Provides version specific debugging libraries such as mscordbi.dll and mscorwks.dll during
/// startup in the native pipeline debugging architecture
/// </summary>
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("3151C08D-4D09-4f9b-8838-2880BF18FE51")]
public interface ICLRDebuggingLibraryProvider
{
/// <summary>
/// Provides a version specific debugging library
/// </summary>
/// <param name="fileName">The name of the library being requested</param>
/// <param name="timestamp">The timestamp of the library being requested as specified
/// in the PE header</param>
/// <param name="sizeOfImage">The SizeOfImage of the library being requested as specified
/// in the PE header</param>
/// <param name="hModule">An OS handle to the requested library</param>
/// <returns>HResults.S_OK if the library was located, otherwise any appropriate
/// error hresult</returns>
[PreserveSig]
int ProvideLibrary([In, MarshalAs(UnmanagedType.LPWStr)]string fileName,
int timestamp,
int sizeOfImage,
out IntPtr hModule);
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,35 @@
using System;
namespace Microsoft.Diagnostics.Runtime
{
/// <summary>
/// While ClrMD provides a managed PDB reader and PDB locator, it would be inefficient to load our own PDB
/// reader into memory if the user already has one available. For ClrMD operations which require reading data
/// from PDBs, you will need to provide this implementation. (This is currently only required for debugging
/// .Net Native applications).
/// </summary>
public interface ISymbolProvider
{
/// <summary>
/// Loads a PDB by its given guid/age and provides an ISymbolResolver for that PDB.
/// </summary>
/// <param name="pdbName">The name of the pdb. This may be a full path and not just a simple name.</param>
/// <param name="guid">The guid of the pdb to locate.</param>
/// <param name="age">The age of the pdb to locate.</param>
/// <returns>A symbol resolver for the given pdb. Null if none was found.</returns>
ISymbolResolver GetSymbolResolver(string pdbName, Guid guid, int age);
}
/// <summary>
/// ISymbolResolver represents a single symbol module (PDB) loaded into the process.
/// </summary>
public interface ISymbolResolver
{
/// <summary>
/// Retrieves the given symbol's name based on its RVA.
/// </summary>
/// <param name="rva">A relative virtual address in the module.</param>
/// <returns>The symbol corresponding to RVA.</returns>
string GetSymbolNameByRVA(uint rva);
}
}

21
ClrMemDiag/LICENSE Normal file
Просмотреть файл

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Просмотреть файл

@ -0,0 +1,24 @@
using System.IO;
namespace Microsoft.Diagnostics.Runtime
{
/// <summary>
/// Thrown when we fail to read memory from the target process.
/// </summary>
public class MemoryReadException : IOException
{
/// <summary>
/// The address of memory that could not be read.
/// </summary>
public ulong Address { get; private set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="address">The address of memory that could not be read.</param>
public MemoryReadException(ulong address)
: base(string.Format("Could not read memory at {0:x}."))
{
}
}
}

Просмотреть файл

@ -0,0 +1,204 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A82126CA-23AA-41F1-8586-A5938D44D0A7}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Diagnostics.Runtime</RootNamespace>
<AssemblyName>Microsoft.Diagnostics.Runtime</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Debug\x64\Debugger</OutputPath>
<DefineConstants>TRACE;DEBUG;_REDHAWK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit>
<DocumentationFile>$(OutputPath)\Microsoft.Diagnostics.Runtime.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Release\x64\Debugger</OutputPath>
<DefineConstants>TRACE;_REDHAWK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit>
<DocumentationFile>$(OutputPath)\Microsoft.Diagnostics.Runtime.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Debug\x86\Debugger</OutputPath>
<DefineConstants>TRACE;DEBUG;_REDHAWK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile>$(OutputPath)\Microsoft.Diagnostics.Runtime.xml</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Release\x86\Debugger</OutputPath>
<DefineConstants>TRACE;_REDHAWK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile>$(OutputPath)\Microsoft.Diagnostics.Runtime.xml</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ClrAppDomain.cs" />
<Compile Include="ClrObject.cs" />
<Compile Include="ClrValue.cs" />
<Compile Include="DataTarget.cs" />
<Compile Include="Debugger\Enums.cs" />
<Compile Include="Debugger\IDebugAdvanced.cs" />
<Compile Include="Debugger\IDebugAdvanced2.cs" />
<Compile Include="Debugger\IDebugAdvanced3.cs" />
<Compile Include="Debugger\IDebugBreakpoint.cs" />
<Compile Include="Debugger\IDebugBreakpoint2.cs" />
<Compile Include="Debugger\IDebugBreakpoint3.cs" />
<Compile Include="Debugger\IDebugClient.cs" />
<Compile Include="Debugger\IDebugClient2.cs" />
<Compile Include="Debugger\IDebugClient3.cs" />
<Compile Include="Debugger\IDebugClient4.cs" />
<Compile Include="Debugger\IDebugClient5.cs" />
<Compile Include="Debugger\IDebugClient6.cs" />
<Compile Include="Debugger\IDebugControl.cs" />
<Compile Include="Debugger\IDebugControl2.cs" />
<Compile Include="Debugger\IDebugControl3.cs" />
<Compile Include="Debugger\IDebugControl4.cs" />
<Compile Include="Debugger\IDebugControl5.cs" />
<Compile Include="Debugger\IDebugControl6.cs" />
<Compile Include="Debugger\IDebugDataSpaces.cs" />
<Compile Include="Debugger\IDebugDataSpaces2.cs" />
<Compile Include="Debugger\IDebugDataSpaces3.cs" />
<Compile Include="Debugger\IDebugDataSpaces4.cs" />
<Compile Include="Debugger\IDebugEventCallbacks.cs" />
<Compile Include="Debugger\IDebugEventCallbacksWide.cs" />
<Compile Include="Debugger\IDebugEventContextCallbacks.cs" />
<Compile Include="Debugger\IDebugInputCallbacks.cs" />
<Compile Include="Debugger\IDebugOutputCallbacks.cs" />
<Compile Include="Debugger\IDebugOutputCallbacks2.cs" />
<Compile Include="Debugger\IDebugOutputCallbacksWide.cs" />
<Compile Include="Debugger\IDebugRegisters.cs" />
<Compile Include="Debugger\IDebugRegisters2.cs" />
<Compile Include="Debugger\IDebugSymbolGroup.cs" />
<Compile Include="Debugger\IDebugSymbolGroup2.cs" />
<Compile Include="Debugger\IDebugSymbols.cs" />
<Compile Include="Debugger\IDebugSymbols2.cs" />
<Compile Include="Debugger\IDebugSymbols3.cs" />
<Compile Include="Debugger\IDebugSymbols4.cs" />
<Compile Include="Debugger\IDebugSymbols5.cs" />
<Compile Include="Debugger\IDebugSystemObjects.cs" />
<Compile Include="Debugger\IDebugSystemObjects2.cs" />
<Compile Include="Debugger\IDebugSystemObjects3.cs" />
<Compile Include="Debugger\Structs.cs" />
<Compile Include="Debugger\WdbgExts.cs" />
<Compile Include="Desktop\com.cs" />
<Compile Include="DacInterfaces.cs" />
<Compile Include="Desktop\lockinspection.cs" />
<Compile Include="Desktop\threadpool.cs" />
<Compile Include="Desktop\domains.cs" />
<Compile Include="Desktop\fields.cs" />
<Compile Include="Desktop\heap.cs" />
<Compile Include="Desktop\helpers.cs" />
<Compile Include="Desktop\legacyruntime.cs" />
<Compile Include="Desktop\methods.cs" />
<Compile Include="Desktop\modules.cs" />
<Compile Include="Desktop\runtimebase.cs" />
<Compile Include="Desktop\threads.cs" />
<Compile Include="Desktop\types.cs" />
<Compile Include="Desktop\v45runtime.cs" />
<Compile Include="ClrModule.cs" />
<Compile Include="DumpDataReader.cs" />
<Compile Include="ClrHeap.cs" />
<Compile Include="ICorDebug\ICorDebugHelpers.cs" />
<Compile Include="ICorDebug\ICorDebugWrappers.cs" />
<Compile Include="ICorDebug\IMetaHostWrappers.cs" />
<Compile Include="ICorDebug\IMetadataImport.cs" />
<Compile Include="internal.cs" />
<Compile Include="ISymbolResolver.cs" />
<Compile Include="MemoryReadException.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ClrException.cs" />
<Compile Include="Native\NativeThread.cs" />
<Compile Include="Native\NativeDac.cs" />
<Compile Include="Native\NativeHeap.cs" />
<Compile Include="Native\NativeModule.cs" />
<Compile Include="Native\NativeRoots.cs" />
<Compile Include="Native\NativeRuntime.cs" />
<Compile Include="Native\NativeTypes.cs" />
<Compile Include="ClrRuntime.cs" />
<Compile Include="Utilities\sigparser.cs" />
<Compile Include="ClrThread.cs" />
<Compile Include="ClrType.cs" />
<Compile Include="Utilities\command.cs" />
<Compile Include="Utilities\DumpReader.cs" />
<Compile Include="Utilities\PDB\BitAccess.cs" />
<Compile Include="Utilities\PDB\BitSet.cs" />
<Compile Include="Utilities\PDB\CvInfo.cs" />
<Compile Include="Utilities\PDB\DataStream.cs" />
<Compile Include="Utilities\PDB\DbiDbgHdr.cs" />
<Compile Include="Utilities\PDB\DbiHeader.cs" />
<Compile Include="Utilities\PDB\DbiModuleInfo.cs" />
<Compile Include="Utilities\PDB\DbiSecCon.cs" />
<Compile Include="Utilities\PDB\MsfDirectory.cs" />
<Compile Include="Utilities\PDB\PdbConstant.cs" />
<Compile Include="Utilities\PDB\PdbDebugException.cs" />
<Compile Include="Utilities\PDB\PdbException.cs" />
<Compile Include="Utilities\PDB\PdbFile.cs" />
<Compile Include="Utilities\PDB\PdbFileHeader.cs" />
<Compile Include="Utilities\PDB\PdbFunction.cs" />
<Compile Include="Utilities\PDB\PdbSequencePoint.cs" />
<Compile Include="Utilities\PDB\PdbSequencePointCollection.cs" />
<Compile Include="Utilities\PDB\PdbStreamHelper.cs" />
<Compile Include="Utilities\PDB\PdbScope.cs" />
<Compile Include="Utilities\PDB\PdbSlot.cs" />
<Compile Include="Utilities\PDB\PdbSource.cs" />
<Compile Include="Utilities\PDB\PdbReader.cs" />
<Compile Include="Utilities\pefile.cs" />
<Compile Include="Utilities\SymbolLocator.Async.cs" />
<Compile Include="Utilities\SymbolLocator.cs" />
<Compile Include="Utilities\SymbolPath.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,425 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Diagnostics.Runtime.Desktop;
using System;
using System.Runtime.InteropServices;
#pragma warning disable 649
namespace Microsoft.Diagnostics.Runtime.Native
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void STATICROOTCALLBACK(IntPtr token, ulong addr, ulong obj, int pinned, int interior);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void HANDLECALLBACK(IntPtr ptr, ulong HandleAddr, ulong DependentTarget, int HandleType, uint ulRefCount, int strong);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void THREADROOTCALLBACK(IntPtr token, ulong symbol, ulong address, ulong obj, int pinned, int interior);
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("90456375-3774-4c70-999a-a6fa78aab107")]
internal interface ISOSNative
{
// ThreadStore
[PreserveSig]
int Flush();
[PreserveSig]
int GetThreadStoreData(out NativeThreadStoreData pData);
[PreserveSig]
int GetThreadAddress(ulong teb, out ulong pThread);
[PreserveSig]
int GetThreadData(ulong addr, out NativeThreadData pThread);
[PreserveSig]
int GetCurrentExceptionObject(ulong thread, out ulong pExceptionRefAddress);
[PreserveSig]
int GetObjectData(ulong addr, out NativeObjectData pData);
[PreserveSig]
int GetEETypeData(ulong addr, out NativeMethodTableData pData);
[PreserveSig]
int GetGcHeapAnalyzeData_do_not_use();//(CLRDATA_ADDRESS addr, struct DacpGcHeapAnalyzeData *pData);
[PreserveSig]
int GetGCHeapData(out LegacyGCInfo pData);
[PreserveSig]
int GetGCHeapList(int count, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] ulong[] heaps, out int pNeeded);
[PreserveSig]
int GetGCHeapDetails(ulong heap, out NativeHeapDetails details);
[PreserveSig]
int GetGCHeapStaticData(out NativeHeapDetails data);
[PreserveSig]
int GetGCHeapSegment(ulong segment, out NativeSegementData pSegmentData);
[PreserveSig]
int GetFreeEEType(out ulong freeType);
[PreserveSig]
int DumpGCInfo_do_not_use(ulong codeAddr, IntPtr callback);
[PreserveSig]
int DumpEHInfo_do_not_use(ulong ehInfo, IntPtr symbolResolver, IntPtr callback);
[PreserveSig]
int DumpStackObjects(ulong threadAddr, IntPtr pCallback, IntPtr token);
[PreserveSig]
int TraverseStackRoots(ulong threadAddr, IntPtr pInitialContext, int initialContextSize, IntPtr pCallback, IntPtr token);
[PreserveSig]
int TraverseStaticRoots(IntPtr pCallback);
[PreserveSig]
int TraverseHandleTable(IntPtr pCallback, IntPtr token);
[PreserveSig]
int TraverseHandleTableFiltered(IntPtr pCallback, IntPtr token, int type, int gen);
[PreserveSig]
int GetCodeHeaderData(ulong ip, out NativeCodeHeader pData);
[PreserveSig]
int GetModuleList(int count, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] ulong[] modules, out int pNeeded);
[PreserveSig]
int GetStressLogAddress_do_not_use();//(CLRDATA_ADDRESS *stressLog);
[PreserveSig]
int GetStressLogData_do_not_use();//(CLRDATA_ADDRESS addr, struct DacpStressLogData *pData);
[PreserveSig]
int EnumStressLogMessages_do_not_use();//(CLRDATA_ADDRESS addr, STRESSMSGCALLBACK smcb, ENDTHREADLOGCALLBACK etcb, void *token);
[PreserveSig]
int EnumStressLogMemRanges_do_not_use();//(CLRDATA_ADDRESS addr, STRESSLOGMEMRANGECALLBACK slmrcb, void* token);
[PreserveSig]
int UpdateDebugEventFilter_do_not_use();//(uint eventFilter);
//HRESULT UpdateCurrentExceptionNotificationFrame(CLRDATA_ADDRESS pThread, CLRDATA_ADDRESS sp);
//HRESULT EnumGcStressStatsInfo(GCSTRESSINFOCALLBACK cb, void* token);
}
internal struct NativeCodeHeader
{
public ulong GCInfo;
public ulong EHInfo;
public ulong MethodStart;
public uint MethodSize;
}
internal enum DacpObjectType
{
OBJ_FREE = 0,
OBJ_OBJECT = 1,
OBJ_VALUETYPE = 2,
OBJ_ARRAY = 3,
OBJ_OTHER = 4
}
internal struct NativeObjectData
{
public ulong MethodTable;
public DacpObjectType ObjectType;
public uint Size;
public ulong ElementTypeHandle;
public uint ElementType;
public uint dwRank;
public uint dwNumComponents;
public uint dwComponentSize;
public ulong ArrayDataPtr;
public ulong ArrayBoundsPtr;
public ulong ArrayLowerBoundsPtr;
}
internal struct NativeThreadStoreData : IThreadStoreData
{
public int threadCount;
public ulong firstThread;
public ulong finalizerThread;
public ulong gcThread;
public ulong Finalizer
{
get { return finalizerThread; }
}
public ulong FirstThread
{
get { return firstThread; }
}
public int Count
{
get { return threadCount; }
}
}
internal struct NativeThreadData : IThreadData
{
public uint osThreadId;
public int state;
public uint preemptiveGCDisabled;
public ulong allocContextPtr;
public ulong allocContextLimit;
public ulong context;
public ulong teb;
public ulong nextThread;
public ulong Next
{
get { return nextThread; }
}
public ulong AllocPtr
{
get { return allocContextPtr; }
}
public ulong AllocLimit
{
get { return allocContextLimit; }
}
public uint OSThreadID
{
get { return osThreadId; }
}
public ulong Teb
{
get { return teb; }
}
public ulong AppDomain
{
get { return 0; }
}
public uint LockCount
{
get { return 0; }
}
public int State
{
get { return state; }
}
public ulong ExceptionPtr
{
get { return 0; }
}
public uint ManagedThreadID
{
get { return osThreadId; }
}
public bool Preemptive
{
get { return preemptiveGCDisabled == 0; }
}
}
internal struct NativeMethodTableData : IMethodTableData
{
public uint objectType; // everything else is NULL if this is true.
public ulong canonicalMethodTable;
public ulong parentMethodTable;
public ushort wNumInterfaces;
public ushort wNumVtableSlots;
public uint baseSize;
public uint componentSize;
public uint sizeofMethodTable;
public uint containsPointers;
public ulong elementTypeHandle;
public bool ContainsPointers
{
get { return containsPointers != 0; }
}
public uint BaseSize
{
get { return baseSize; }
}
public uint ComponentSize
{
get { return componentSize; }
}
public ulong EEClass
{
get { return canonicalMethodTable; }
}
public bool Free
{
get { return objectType == 0; }
}
public ulong Parent
{
get { return parentMethodTable; }
}
public bool Shared
{
get { return false; }
}
public uint NumMethods
{
get { return wNumVtableSlots; }
}
public ulong ElementTypeHandle
{
get { return elementTypeHandle; }
}
}
internal struct NativeSegementData : ISegmentData
{
public ulong segmentAddr;
public ulong allocated;
public ulong committed;
public ulong reserved;
public ulong used;
public ulong mem;
public ulong next;
public ulong gc_heap;
public ulong highAllocMark;
public uint isReadOnly;
public ulong Address
{
get { return segmentAddr; }
}
public ulong Next
{
get { return next; }
}
public ulong Start
{
get { return mem; }
}
public ulong End
{
get { return allocated; }
}
public ulong Reserved
{
get { return reserved; }
}
public ulong Committed
{
get { return committed; }
}
}
internal struct NativeHeapDetails : IHeapDetails
{
public ulong heapAddr;
public ulong alloc_allocated;
public V4GenerationData generation_table0;
public V4GenerationData generation_table1;
public V4GenerationData generation_table2;
public V4GenerationData generation_table3;
public ulong ephemeral_heap_segment;
public ulong finalization_fill_pointers0;
public ulong finalization_fill_pointers1;
public ulong finalization_fill_pointers2;
public ulong finalization_fill_pointers3;
public ulong finalization_fill_pointers4;
public ulong finalization_fill_pointers5;
public ulong finalization_fill_pointers6;
public ulong lowest_address;
public ulong highest_address;
public ulong card_table;
public ulong FirstHeapSegment
{
get { return generation_table2.StartSegment; }
}
public ulong FirstLargeHeapSegment
{
get { return generation_table3.StartSegment; }
}
public ulong EphemeralSegment
{
get { return ephemeral_heap_segment; }
}
public ulong EphemeralEnd { get { return alloc_allocated; } }
public ulong EphemeralAllocContextPtr
{
get { return generation_table0.AllocContextPtr; }
}
public ulong EphemeralAllocContextLimit
{
get { return generation_table0.AllocContextLimit; }
}
public ulong FQAllObjectsStop
{
get { return finalization_fill_pointers5; }
}
public ulong FQAllObjectsStart
{
get { return finalization_fill_pointers4; }
}
public ulong FQRootsStart
{
get { return finalization_fill_pointers0; }
}
public ulong FQRootsEnd
{
get { return finalization_fill_pointers3; }
}
public ulong Gen0Start
{
get { return generation_table0.AllocationStart; }
}
public ulong Gen0Stop
{
get { return alloc_allocated; }
}
public ulong Gen1Start
{
get { return generation_table1.AllocationStart; }
}
public ulong Gen1Stop
{
get { return generation_table0.AllocationStart; }
}
public ulong Gen2Start
{
get { return generation_table2.AllocationStart; }
}
public ulong Gen2Stop
{
get { return generation_table1.AllocationStart; }
}
}
}

Просмотреть файл

@ -0,0 +1,344 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Diagnostics.Runtime.Desktop;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Address = System.UInt64;
namespace Microsoft.Diagnostics.Runtime.Native
{
internal class NativeHeap : HeapBase
{
internal NativeRuntime NativeRuntime { get; set; }
private ulong _lastObj;
private ClrType _lastType;
private Dictionary<ulong, int> _indices = new Dictionary<ulong, int>();
private List<NativeType> _types = new List<NativeType>(1024);
private NativeModule[] _modules;
private NativeModule _mrtModule;
private NativeType _free;
private ISymbolProvider _symProvider;
private Dictionary<NativeModule, ISymbolResolver> _resolvers = new Dictionary<NativeModule, ISymbolResolver>();
internal NativeHeap(NativeRuntime runtime, NativeModule[] modules)
: base(runtime)
{
NativeRuntime = runtime;
_modules = modules;
_symProvider = runtime.DataTarget.SymbolProvider;
if (_symProvider == null)
throw new InvalidOperationException("You must set DataTarget.SymbolProvider to enumerate the heap on a .Net Native runtime.");
_mrtModule = FindMrtModule();
CreateFreeType();
InitSegments(runtime);
}
internal override ClrType GetTypeByToken(ClrModule module, uint token)
{
throw new NotImplementedException();
}
public override ClrType GetBasicType(ClrElementType elType)
{
throw new NotImplementedException();
}
internal override string GetStringContents(ulong addr)
{
throw new NotImplementedException();
}
public override ClrType ErrorType
{
get
{
throw new NotImplementedException();
}
}
public override ClrType NullType
{
get
{
throw new NotImplementedException();
}
}
public override bool TryGetMethodTable(ulong obj, out ulong methodTable, out ulong componentMethodTable)
{
throw new NotImplementedException();
}
public override ClrRuntime Runtime
{
get
{
return NativeRuntime;
}
}
public override ClrType GetTypeByMethodTable(ulong methodTable, ulong componentMethodTable)
{
if (componentMethodTable != 0)
return null;
int index;
if (_indices.TryGetValue(methodTable, out index))
return _types[index];
return null;
}
private NativeModule FindMrtModule()
{
foreach (NativeModule module in _modules)
if (string.Compare(module.Name, "mrt100", StringComparison.CurrentCultureIgnoreCase) == 0 ||
string.Compare(module.Name, "mrt100_app", StringComparison.CurrentCultureIgnoreCase) == 0)
return module;
return null;
}
private void CreateFreeType()
{
ulong free = NativeRuntime.GetFreeType();
IMethodTableData mtData = NativeRuntime.GetMethodTableData(free);
_free = new NativeType(this, _types.Count, _mrtModule, "Free", free, mtData);
_indices[free] = _types.Count;
_types.Add(_free);
}
public override ClrType GetObjectType(ulong objRef)
{
ulong eeType;
if (_lastObj == objRef)
return _lastType;
var cache = MemoryReader;
if (!cache.Contains(objRef))
cache = NativeRuntime.MemoryReader;
if (!cache.ReadPtr(objRef, out eeType))
return null;
if ((((int)eeType) & 3) != 0)
eeType &= ~3UL;
ClrType last = null;
int index;
if (_indices.TryGetValue(eeType, out index))
last = _types[index];
else
last = ConstructObjectType(eeType);
_lastObj = objRef;
_lastType = last;
return last;
}
private ClrType ConstructObjectType(ulong eeType)
{
IMethodTableData mtData = NativeRuntime.GetMethodTableData(eeType);
if (mtData == null)
return null;
ulong componentType = mtData.ElementTypeHandle;
bool isArray = componentType != 0;
// EEClass is the canonical method table. I stuffed the pointer there instead of creating a new property.
ulong canonType = isArray ? componentType : mtData.EEClass;
if (!isArray && canonType != 0)
{
int index;
if (!isArray && _indices.TryGetValue(canonType, out index))
{
_indices[eeType] = index; // Link the original eeType to its canonical GCHeapType.
return _types[index];
}
ulong tmp = eeType;
eeType = canonType;
canonType = tmp;
}
NativeModule module = FindContainingModule(eeType);
if (module == null && canonType != 0)
module = FindContainingModule(canonType);
string name = null;
if (module != null)
{
Debug.Assert(module.ImageBase < eeType);
PdbInfo pdb = module.Pdb;
if (pdb != null)
{
ISymbolResolver resolver;
if (!_resolvers.TryGetValue(module, out resolver))
_resolvers[module] = resolver = _symProvider.GetSymbolResolver(pdb.FileName, pdb.Guid, pdb.Revision);
name = resolver?.GetSymbolNameByRVA((uint)(eeType - module.ImageBase));
}
}
if (name == null)
{
string moduleName = module != null ? Path.GetFileNameWithoutExtension(module.FileName) : "UNKNWON";
name = string.Format("{0}_{1:x}", moduleName, eeType);
}
int len = name.Length;
if (name.EndsWith("::`vftable'"))
len -= 11;
int i = name.IndexOf('!') + 1;
name = name.Substring(i, len - i);
if (isArray)
name += "[]";
if (module == null)
module = _mrtModule;
NativeType type = new NativeType(this, _types.Count, module, name, eeType, mtData);
_indices[eeType] = _types.Count;
if (!isArray)
_indices[canonType] = _types.Count;
_types.Add(type);
return type;
}
private NativeModule FindContainingModule(Address eeType)
{
int min = 0, max = _modules.Length;
while (min <= max)
{
int mid = (min + max) / 2;
int compare = _modules[mid].ComparePointer(eeType);
if (compare < 0)
max = mid - 1;
else if (compare > 0)
min = mid + 1;
else
return _modules[mid];
}
return null;
}
public override IEnumerable<ClrRoot> EnumerateRoots()
{
return EnumerateRoots(true);
}
public override IEnumerable<ClrRoot> EnumerateRoots(bool enumerateStatics)
{
// Stack objects.
foreach (var thread in NativeRuntime.Threads)
foreach (var stackRef in NativeRuntime.EnumerateStackRoots(thread))
yield return stackRef;
// Static Variables.
foreach (var root in NativeRuntime.EnumerateStaticRoots(enumerateStatics))
yield return root;
// Handle Table.
foreach (ClrRoot root in NativeRuntime.EnumerateHandleRoots())
yield return root;
// Finalizer Queue.
ClrAppDomain domain = NativeRuntime.AppDomains[0];
foreach (ulong obj in NativeRuntime.EnumerateFinalizerQueueObjectAddresses())
{
ClrType type = GetObjectType(obj);
if (type == null)
continue;
yield return new NativeFinalizerRoot(obj, type, domain, "finalizer root");
}
}
public override int ReadMemory(Address address, byte[] buffer, int offset, int count)
{
if (offset != 0)
throw new NotImplementedException("Non-zero offsets not supported (yet)");
int bytesRead = 0;
if (!NativeRuntime.ReadMemory(address, buffer, count, out bytesRead))
return 0;
return bytesRead;
}
public override IEnumerable<ClrType> EnumerateTypes() { return null; }
public override IEnumerable<Address> EnumerateFinalizableObjectAddresses() { throw new NotImplementedException(); }
public override IEnumerable<BlockingObject> EnumerateBlockingObjects() { throw new NotImplementedException(); }
public override ClrException GetExceptionObject(Address objRef) { throw new NotImplementedException(); }
protected override int GetRuntimeRevision()
{
return 0;
}
public override ClrObject GetObject(ulong address)
{
return new ClrObject(address, GetObjectType(address));
}
}
internal class NativeFinalizerRoot : ClrRoot
{
private string _name;
private ClrType _type;
private ClrAppDomain _appDomain;
public override GCRootKind Kind
{
get { return GCRootKind.Finalizer; }
}
public override ClrType Type
{
get { return _type; }
}
public override string Name
{
get
{
return _name;
}
}
public override ClrAppDomain AppDomain
{
get
{
return _appDomain;
}
}
public NativeFinalizerRoot(Address obj, ClrType type, ClrAppDomain domain, string name)
{
Object = obj;
_name = name;
_type = type;
_appDomain = domain;
}
}
}

Просмотреть файл

@ -0,0 +1,187 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.IO;
using Address = System.UInt64;
namespace Microsoft.Diagnostics.Runtime.Native
{
internal class NativeAppDomain : ClrAppDomain
{
public override ClrRuntime Runtime
{
get
{
return _runtime;
}
}
private IList<ClrModule> _modules;
private ClrRuntime _runtime;
public NativeAppDomain(ClrRuntime runtime, IList<ClrModule> modules)
{
_runtime = runtime;
_modules = modules;
}
public override Address Address
{
get { return 0; }
}
public override int Id
{
get { return 0; }
}
public override string Name
{
get { return "default domain"; }
}
public override IList<ClrModule> Modules
{
get { return _modules; }
}
public override string ConfigurationFile
{
get { return null; }
}
public override string ApplicationBase
{
get { return null; }
}
}
internal class NativeModule : ClrModule
{
private NativeRuntime _runtime;
private string _name;
private string _filename;
private Address _imageBase;
private Address _size;
private PdbInfo _pdb;
public NativeModule(NativeRuntime runtime, ModuleInfo module)
{
_runtime = runtime;
_name = string.IsNullOrEmpty(module.FileName) ? "" : Path.GetFileNameWithoutExtension(module.FileName);
_filename = module.FileName;
_imageBase = module.ImageBase;
_size = module.FileSize;
_pdb = module.Pdb;
}
public override ClrRuntime Runtime
{
get
{
return _runtime;
}
}
public override PdbInfo Pdb { get { return _pdb; } }
public override IList<ClrAppDomain> AppDomains
{
get
{
return new ClrAppDomain[] { _runtime.AppDomains[0] };
}
}
public override string AssemblyName
{
get { return _name; }
}
public override string Name
{
get { return _name; }
}
public override bool IsDynamic
{
get { return false; }
}
public override bool IsFile
{
get { return true; }
}
public override string FileName
{
get { return _filename; }
}
public override Address ImageBase
{
get { return _imageBase; }
}
public override Address Size
{
get { return _size; }
}
public override IEnumerable<ClrType> EnumerateTypes()
{
foreach (var type in _runtime.GetHeap().EnumerateTypes())
if (type.Module == this)
yield return type;
}
internal int ComparePointer(Address eetype)
{
if (eetype < ImageBase)
return -1;
if (eetype >= ImageBase + Size)
return 1;
return 0;
}
public override Address MetadataAddress
{
get { throw new NotImplementedException(); }
}
public override Address MetadataLength
{
get { throw new NotImplementedException(); }
}
public override ICorDebug.IMetadataImport MetadataImport
{
get { throw new NotImplementedException(); }
}
public override System.Diagnostics.DebuggableAttribute.DebuggingModes DebuggingMode
{
get { throw new NotImplementedException(); }
}
public override ClrType GetTypeByName(string name)
{
throw new NotImplementedException();
}
public override ClrType GetTypeByToken(uint token)
{
throw new NotImplementedException();
}
public override Address AssemblyId
{
get { throw new NotImplementedException(); }
}
}
}

Просмотреть файл

@ -0,0 +1,310 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using Address = System.UInt64;
namespace Microsoft.Diagnostics.Runtime.Native
{
internal class NativeStackRootWalker
{
private ClrHeap _heap;
private ClrAppDomain _domain;
private ClrThread _thread;
public List<ClrRoot> Roots { get; set; }
public NativeStackRootWalker(ClrHeap heap, ClrAppDomain domain, ClrThread thread)
{
_heap = heap;
_domain = domain;
_thread = thread;
Roots = new List<ClrRoot>();
}
public void Callback(IntPtr token, ulong symbol, ulong addr, ulong obj, int pinned, int interior)
{
string name = "local variable";
NativeStackRoot root = new NativeStackRoot(_thread, addr, obj, name, _heap.GetObjectType(obj), _domain, pinned != 0, interior != 0);
Roots.Add(root);
}
}
internal class NativeHandleRootWalker
{
public List<ClrRoot> Roots { get; set; }
private ClrHeap _heap;
private ClrAppDomain _domain;
private bool _dependentSupport;
public NativeHandleRootWalker(NativeRuntime runtime, bool dependentHandleSupport)
{
_heap = runtime.GetHeap();
_domain = runtime.GetRhAppDomain();
_dependentSupport = dependentHandleSupport;
}
public void RootCallback(IntPtr ptr, ulong addr, ulong obj, int hndType, uint refCount, int strong)
{
bool isDependent = hndType == (int)HandleType.Dependent;
if ((isDependent && _dependentSupport) || strong != 0)
{
if (Roots == null)
Roots = new List<ClrRoot>(128);
string name = Enum.GetName(typeof(HandleType), hndType) + " handle";
if (isDependent)
{
ulong dependentTarget = obj;
if (!_heap.ReadPointer(addr, out obj))
obj = 0;
ClrType type = _heap.GetObjectType(obj);
Roots.Add(new NativeHandleRoot(addr, obj, dependentTarget, type, hndType, _domain, name));
}
else
{
ClrType type = _heap.GetObjectType(obj);
Roots.Add(new NativeHandleRoot(addr, obj, type, hndType, _domain, name));
}
}
}
}
internal class NativeStaticRootWalker
{
public List<ClrRoot> Roots { get; set; }
private NativeRuntime _runtime;
private ClrHeap _heap;
public NativeStaticRootWalker(NativeRuntime runtime, bool resolveStatics)
{
Roots = new List<ClrRoot>(128);
_runtime = resolveStatics ? runtime : null;
_heap = _runtime.GetHeap();
}
public void Callback(IntPtr token, ulong addr, ulong obj, int pinned, int interior)
{
// TODO: Resolve name of addr.
string name = "static var " + addr.ToString();
var type = _heap.GetObjectType(obj);
Roots.Add(new NativeStaticVar(_runtime, addr, obj, type, name, interior != 0, pinned != 0));
}
}
internal class NativeStackRoot : ClrRoot
{
private string _name;
private ClrType _type;
private ClrAppDomain _appDomain;
private ClrThread _thread;
private bool _pinned;
private bool _interior;
public override GCRootKind Kind
{
get { return GCRootKind.LocalVar; }
}
public override ClrType Type
{
get { return _type; }
}
public override bool IsPinned
{
get
{
return _pinned;
}
}
public override bool IsInterior
{
get
{
return _interior;
}
}
public override ClrAppDomain AppDomain
{
get
{
return _appDomain;
}
}
public override string Name
{
get
{
return _name;
}
}
public override ClrThread Thread
{
get
{
return _thread;
}
}
public NativeStackRoot(ClrThread thread, ulong addr, ulong obj, string name, ClrType type, ClrAppDomain domain, bool pinned, bool interior)
{
Address = addr;
Object = obj;
_name = name;
_type = type;
_appDomain = domain;
_pinned = pinned;
_interior = interior;
_thread = thread;
}
}
internal class NativeHandleRoot : ClrRoot
{
private string _name;
private ClrType _type;
private ClrAppDomain _appDomain;
private GCRootKind _kind;
public override GCRootKind Kind
{
get { return _kind; }
}
public override ClrType Type
{
get { return _type; }
}
public override string Name
{
get
{
return _name;
}
}
public override ClrAppDomain AppDomain
{
get
{
return _appDomain;
}
}
public NativeHandleRoot(Address addr, Address obj, Address dependentTarget, ClrType type, int hndType, ClrAppDomain domain, string name)
{
Init(addr, obj, dependentTarget, type, hndType, domain, name);
}
public NativeHandleRoot(Address addr, Address obj, ClrType type, int hndType, ClrAppDomain domain, string name)
{
Init(addr, obj, 0, type, hndType, domain, name);
}
private void Init(Address addr, Address obj, Address dependentTarget, ClrType type, int hndType, ClrAppDomain domain, string name)
{
HandleType htype = (HandleType)hndType;
switch (htype)
{
case HandleType.AsyncPinned:
_kind = GCRootKind.AsyncPinning;
break;
case HandleType.Pinned:
_kind = GCRootKind.Pinning;
break;
case HandleType.WeakShort:
case HandleType.WeakLong:
_kind = GCRootKind.Weak;
break;
default:
_kind = GCRootKind.Strong;
break;
}
Address = addr;
_name = name;
_type = type;
_appDomain = domain;
if (htype == HandleType.Dependent && dependentTarget != 0)
Object = dependentTarget;
else
Object = obj;
}
}
internal class NativeStaticVar : ClrRoot
{
private string _name;
private bool _pinned;
private bool _interior;
private ClrType _type;
private ClrAppDomain _appDomain;
public override GCRootKind Kind
{
get { return GCRootKind.StaticVar; }
}
public override ClrType Type
{
get { return _type; }
}
public override string Name
{
get
{
return _name;
}
}
public override bool IsPinned
{
get
{
return _pinned;
}
}
public override bool IsInterior
{
get
{
return _interior;
}
}
public override ClrAppDomain AppDomain
{
get
{
return _appDomain;
}
}
public NativeStaticVar(NativeRuntime runtime, Address addr, Address obj, ClrType type, string name, bool pinned, bool interior)
{
Address = addr;
Object = obj;
_type = type;
_name = name;
_pinned = pinned;
_interior = interior;
_type = runtime.GetHeap().GetObjectType(obj);
_appDomain = runtime.GetRhAppDomain();
}
}
}

Просмотреть файл

@ -0,0 +1,401 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Diagnostics.Runtime.Desktop;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Address = System.UInt64;
namespace Microsoft.Diagnostics.Runtime.Native
{
internal class NativeRuntime : RuntimeBase
{
private ISOSNative _sos;
private ClrThread[] _threads;
private NativeModule[] _modules;
private NativeAppDomain _domain;
private int _dacRawVersion;
public NativeRuntime(ClrInfo info, DataTargetImpl dt, DacLibrary lib)
: base(info, dt, lib)
{
byte[] tmp = new byte[sizeof(int)];
if (!Request(DacRequests.VERSION, null, tmp))
throw new ClrDiagnosticsException("Failed to request dac version.", ClrDiagnosticsException.HR.DacError);
_dacRawVersion = BitConverter.ToInt32(tmp, 0);
if (_dacRawVersion != 10 && _dacRawVersion != 11)
throw new ClrDiagnosticsException("Unsupported dac version.", ClrDiagnosticsException.HR.DacError);
}
public override ClrMethod GetMethodByHandle(ulong methodHandle)
{
return null;
}
protected override void InitApi()
{
if (_sos == null)
{
var dac = _library.DacInterface;
if (!(dac is ISOSNative))
throw new ClrDiagnosticsException("This version of mrt100 is too old.", ClrDiagnosticsException.HR.DataRequestError);
_sos = (ISOSNative)dac;
}
}
public override ClrHeap GetHeap()
{
if (_heap == null)
_heap = new NativeHeap(this, NativeModules);
return _heap;
}
public override int PointerSize
{
get { return IntPtr.Size; }
}
public override IList<ClrAppDomain> AppDomains
{
get
{
return new ClrAppDomain[] { GetRhAppDomain() };
}
}
public override ClrAppDomain SharedDomain
{
get
{
throw new NotImplementedException();
}
}
public override ClrAppDomain SystemDomain
{
get
{
throw new NotImplementedException();
}
}
public override IList<ClrThread> Threads
{
get
{
if (_threads == null)
InitThreads();
return _threads;
}
}
public override IEnumerable<ClrHandle> EnumerateHandles()
{
throw new NotImplementedException();
}
public override IEnumerable<ClrMemoryRegion> EnumerateMemoryRegions()
{
throw new NotImplementedException();
}
public override ClrMethod GetMethodByAddress(ulong ip)
{
throw new NotImplementedException();
}
public override void Flush()
{
OnRuntimeFlushed();
throw new NotImplementedException();
}
override public ClrThreadPool GetThreadPool() { throw new NotImplementedException(); }
internal ClrAppDomain GetRhAppDomain()
{
if (_domain == null)
_domain = new NativeAppDomain(this, NativeModules);
return _domain;
}
internal NativeModule[] NativeModules
{
get
{
if (_modules != null)
return _modules;
List<ModuleInfo> modules = new List<ModuleInfo>(DataTarget.EnumerateModules());
modules.Sort((x, y) => x.ImageBase.CompareTo(y.ImageBase));
int count;
if (_sos.GetModuleList(0, null, out count) < 0)
{
_modules = ConvertModuleList(modules);
return _modules;
}
Address[] ptrs = new Address[count];
if (_sos.GetModuleList(count, ptrs, out count) < 0)
{
_modules = ConvertModuleList(modules);
return _modules;
}
Array.Sort(ptrs);
int i = 0, j = 0;
while (i < modules.Count && j < ptrs.Length)
{
ModuleInfo info = modules[i];
ulong addr = ptrs[j];
if (info.ImageBase <= addr && addr < info.ImageBase + info.FileSize)
{
i++;
j++;
}
else if (addr < info.ImageBase)
{
j++;
}
else if (addr >= info.ImageBase + info.FileSize)
{
modules.RemoveAt(i);
}
}
modules.RemoveRange(i, modules.Count - i);
_modules = ConvertModuleList(modules);
return _modules;
}
}
private NativeModule[] ConvertModuleList(List<ModuleInfo> modules)
{
NativeModule[] result = new NativeModule[modules.Count];
int i = 0;
foreach (var module in modules)
result[i++] = new NativeModule(this, module);
return result;
}
internal unsafe IList<ClrRoot> EnumerateStackRoots(ClrThread thread)
{
int contextSize;
var plat = _dataReader.GetArchitecture();
if (plat == Architecture.Amd64)
contextSize = 0x4d0;
else if (plat == Architecture.X86)
contextSize = 0x2d0;
else if (plat == Architecture.Arm)
contextSize = 0x1a0;
else
throw new InvalidOperationException("Unexpected architecture.");
byte[] context = new byte[contextSize];
_dataReader.GetThreadContext(thread.OSThreadId, 0, (uint)contextSize, context);
var walker = new NativeStackRootWalker(GetHeap(), GetRhAppDomain(), thread);
THREADROOTCALLBACK del = new THREADROOTCALLBACK(walker.Callback);
IntPtr callback = Marshal.GetFunctionPointerForDelegate(del);
fixed (byte* b = &context[0])
{
IntPtr ctx = new IntPtr(b);
_sos.TraverseStackRoots(thread.Address, ctx, contextSize, callback, IntPtr.Zero);
}
GC.KeepAlive(del);
return walker.Roots;
}
internal IList<ClrRoot> EnumerateStaticRoots(bool resolveStatics)
{
var walker = new NativeStaticRootWalker(this, resolveStatics);
STATICROOTCALLBACK del = new STATICROOTCALLBACK(walker.Callback);
IntPtr ptr = Marshal.GetFunctionPointerForDelegate(del);
_sos.TraverseStaticRoots(ptr);
GC.KeepAlive(del);
return walker.Roots;
}
internal IEnumerable<ClrRoot> EnumerateHandleRoots()
{
var walker = new NativeHandleRootWalker(this, _dacRawVersion != 10);
HANDLECALLBACK callback = new HANDLECALLBACK(walker.RootCallback);
IntPtr ptr = Marshal.GetFunctionPointerForDelegate(callback);
_sos.TraverseHandleTable(ptr, IntPtr.Zero);
GC.KeepAlive(callback);
return walker.Roots;
}
private void InitThreads()
{
IThreadStoreData tsData = GetThreadStoreData();
List<ClrThread> threads = new List<ClrThread>(tsData.Count);
ulong addr = tsData.FirstThread;
IThreadData thread = GetThread(tsData.FirstThread);
for (int i = 0; thread != null; i++)
{
threads.Add(new NativeThread(this, thread, addr, tsData.Finalizer == addr));
addr = thread.Next;
thread = GetThread(addr);
}
_threads = threads.ToArray();
}
#region Native Implementation
internal override ClrAppDomain GetAppDomainByAddress(Address addr)
{
return _domain;
}
internal override ulong GetFirstThread()
{
IThreadStoreData tsData = GetThreadStoreData();
if (tsData == null)
return 0;
return tsData.FirstThread;
}
internal override IThreadData GetThread(ulong addr)
{
if (addr == 0)
return null;
NativeThreadData data;
if (_sos.GetThreadData(addr, out data) < 0)
return null;
return data;
}
internal override IHeapDetails GetSvrHeapDetails(ulong addr)
{
NativeHeapDetails data;
if (_sos.GetGCHeapDetails(addr, out data) < 0)
return null;
return data;
}
internal override IHeapDetails GetWksHeapDetails()
{
NativeHeapDetails data;
if (_sos.GetGCHeapStaticData(out data) < 0)
return null;
return data;
}
internal override ulong[] GetServerHeapList()
{
int count = 0;
if (_sos.GetGCHeapList(0, null, out count) < 0)
return null;
ulong[] items = new ulong[count];
if (_sos.GetGCHeapList(items.Length, items, out count) < 0)
return null;
return items;
}
internal override IThreadStoreData GetThreadStoreData()
{
NativeThreadStoreData data;
if (_sos.GetThreadStoreData(out data) < 0)
return null;
return data;
}
internal override ISegmentData GetSegmentData(ulong addr)
{
if (addr == 0)
return null;
NativeSegementData data;
if (_sos.GetGCHeapSegment(addr, out data) < 0)
return null;
return data;
}
internal override IMethodTableData GetMethodTableData(ulong eetype)
{
NativeMethodTableData data;
if (_sos.GetEETypeData(eetype, out data) < 0)
return null;
return data;
}
internal ulong GetFreeType()
{
// Can't return 0 on error here, as that would make values of 0 look like a
// valid method table. Instead, return something that won't likely be the value
// in the methodtable.
ulong free;
if (_sos.GetFreeEEType(out free) < 0)
return ulong.MaxValue - 42;
return free;
}
internal override IGCInfo GetGCInfo()
{
LegacyGCInfo info;
if (_sos.GetGCHeapData(out info) < 0)
return null;
return info;
}
#endregion
internal override uint GetTlsSlot()
{
throw new NotImplementedException();
}
internal override uint GetThreadTypeIndex()
{
throw new NotImplementedException();
}
public override IEnumerable<int> EnumerateGCThreads()
{
throw new NotImplementedException();
}
public override IList<ClrModule> Modules
{
get
{
throw new NotImplementedException();
}
}
public override CcwData GetCcwDataByAddress(Address addr)
{
throw new NotImplementedException();
}
}
}

Просмотреть файл

@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using Microsoft.Diagnostics.Runtime.Desktop;
namespace Microsoft.Diagnostics.Runtime.Native
{
class NativeThread : ThreadBase
{
private NativeRuntime _runtime;
public NativeThread(NativeRuntime runtime, IThreadData thread, ulong address, bool finalizer) : base(thread, address, finalizer)
{
_runtime = runtime;
}
public override IList<BlockingObject> BlockingObjects
{
get
{
throw new NotImplementedException();
}
}
public override ClrException CurrentException
{
get
{
throw new NotImplementedException();
}
}
public override ClrRuntime Runtime
{
get
{
return _runtime;
}
}
public override ulong StackBase
{
get
{
throw new NotImplementedException();
}
}
public override ulong StackLimit
{
get
{
throw new NotImplementedException();
}
}
public override IList<ClrStackFrame> StackTrace
{
get
{
throw new NotImplementedException();
}
}
public override IEnumerable<ClrRoot> EnumerateStackObjects()
{
throw new NotImplementedException();
}
public override IEnumerable<ClrRoot> EnumerateStackObjects(bool includePossiblyDead)
{
throw new NotImplementedException();
}
public override IEnumerable<ClrStackFrame> EnumerateStackTrace()
{
throw new NotImplementedException();
}
}
}

Просмотреть файл

@ -0,0 +1,244 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
namespace Microsoft.Diagnostics.Runtime.Native
{
internal class NativeType : ClrType
{
private string _name;
private ulong _eeType;
private NativeHeap _heap;
private NativeModule _module;
private uint _baseSize;
private uint _componentSize;
private GCDesc _gcDesc;
private bool _containsPointers;
private int _index;
public NativeType(NativeHeap heap, int index, NativeModule module, string name, ulong eeType, Microsoft.Diagnostics.Runtime.Desktop.IMethodTableData mtData)
{
_heap = heap;
_module = module;
_name = name;
_eeType = eeType;
_index = index;
_baseSize = mtData.BaseSize;
_componentSize = mtData.ComponentSize;
_containsPointers = mtData.ContainsPointers;
}
internal override ClrMethod GetMethod(uint token)
{
return null;
}
public override ulong MethodTable
{
get
{
return _eeType;
}
}
public override IEnumerable<ulong> EnumerateMethodTables()
{
return new ulong[] { _eeType };
}
public override ClrModule Module
{
get
{
return _module;
}
}
public override string Name
{
get { return _name; }
}
public override ulong GetSize(ulong objRef)
{
ulong size;
uint pointerSize = (uint)_heap.PointerSize;
if (_componentSize == 0)
{
size = _baseSize;
}
else
{
uint count = 0;
uint countOffset = pointerSize;
ulong loc = objRef + countOffset;
var cache = _heap.MemoryReader;
if (!cache.Contains(loc))
cache = _heap.NativeRuntime.MemoryReader;
if (!cache.ReadDword(loc, out count))
throw new Exception("Could not read from heap at " + objRef.ToString("x"));
// TODO: Strings in v4+ contain a trailing null terminator not accounted for.
size = count * (ulong)_componentSize + _baseSize;
}
uint minSize = pointerSize * 3;
if (size < minSize)
size = minSize;
return size;
}
public override void EnumerateRefsOfObject(ulong objRef, Action<ulong, int> action)
{
if (!_containsPointers)
return;
if (_gcDesc == null)
if (!FillGCDesc() || _gcDesc == null)
return;
var size = GetSize(objRef);
var cache = _heap.MemoryReader;
if (!cache.Contains(objRef))
cache = _heap.NativeRuntime.MemoryReader;
_gcDesc.WalkObject(objRef, (ulong)size, cache, action);
}
private bool FillGCDesc()
{
NativeRuntime runtime = _heap.NativeRuntime;
int entries;
if (!runtime.MemoryReader.TryReadDword(_eeType - (ulong)IntPtr.Size, out entries))
return false;
// Get entries in map
if (entries < 0)
entries = -entries;
int read;
int slots = 1 + entries * 2;
byte[] buffer = new byte[slots * IntPtr.Size];
if (!runtime.ReadMemory(_eeType - (ulong)(slots * IntPtr.Size), buffer, buffer.Length, out read) || read != buffer.Length)
return false;
// Construct the gc desc
_gcDesc = new GCDesc(buffer);
return true;
}
public override ClrHeap Heap
{
get { throw new NotImplementedException(); }
}
public override IList<ClrInterface> Interfaces
{
get { throw new NotImplementedException(); }
}
public override bool IsFinalizable
{
get { throw new NotImplementedException(); }
}
public override bool IsPublic
{
get { throw new NotImplementedException(); }
}
public override bool IsPrivate
{
get { throw new NotImplementedException(); }
}
public override bool IsInternal
{
get { throw new NotImplementedException(); }
}
public override bool IsProtected
{
get { throw new NotImplementedException(); }
}
public override bool IsAbstract
{
get { throw new NotImplementedException(); }
}
public override bool IsSealed
{
get { throw new NotImplementedException(); }
}
public override bool IsInterface
{
get { throw new NotImplementedException(); }
}
public override bool GetFieldForOffset(int fieldOffset, bool inner, out ClrInstanceField childField, out int childFieldOffset)
{
throw new NotImplementedException();
}
public override ClrInstanceField GetFieldByName(string name)
{
throw new NotImplementedException();
}
public override ClrType BaseType
{
get { throw new NotImplementedException(); }
}
public override int GetArrayLength(ulong objRef)
{
throw new NotImplementedException();
}
public override ulong GetArrayElementAddress(ulong objRef, int index)
{
throw new NotImplementedException();
}
public override object GetArrayElementValue(ulong objRef, int index)
{
throw new NotImplementedException();
}
public override int ElementSize
{
get { throw new NotImplementedException(); }
}
public override int BaseSize
{
get { throw new NotImplementedException(); }
}
public override ClrStaticField GetStaticFieldByName(string name)
{
throw new NotImplementedException();
}
public override void EnumerateRefsOfObjectCarefully(ulong objRef, Action<ulong, int> action)
{
EnumerateRefsOfObject(objRef, action);
}
public override uint MetadataToken
{
get { throw new NotImplementedException(); }
}
}
}

Просмотреть файл

@ -0,0 +1,26 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Diagnostics.Runtime")]
[assembly: AssemblyDescription("(modified for DbgShell)")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft.Diagnostics.Runtime")]
[assembly: AssemblyCopyright("Copyright \u00A9 Microsoft")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("94432a8e-3e06-4776-b9b2-3684a62bb96a")]
[assembly: AssemblyVersion("0.8.31.0")]
[assembly: AssemblyFileVersion("0.8.31.0")]

3
ClrMemDiag/ReadMe.txt Normal file
Просмотреть файл

@ -0,0 +1,3 @@
This is a modified copy of the source from https://github.com/Microsoft/clrmd.
The LICENSE file is included, as per the license.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,253 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Text;
using System.IO;
namespace Microsoft.Diagnostics.Runtime.Utilities.Pdb
{
internal class BitAccess
{
internal BitAccess(int capacity)
{
_buffer = new byte[capacity];
}
internal byte[] Buffer
{
get { return _buffer; }
}
private byte[] _buffer;
internal void FillBuffer(Stream stream, int capacity)
{
MinCapacity(capacity);
stream.Read(_buffer, 0, capacity);
_offset = 0;
}
internal void Append(Stream stream, int count)
{
int newCapacity = _offset + count;
if (_buffer.Length < newCapacity)
{
byte[] newBuffer = new byte[newCapacity];
Array.Copy(_buffer, newBuffer, _buffer.Length);
_buffer = newBuffer;
}
stream.Read(_buffer, _offset, count);
_offset += count;
}
internal int Position
{
get { return _offset; }
set { _offset = value; }
}
private int _offset;
internal void MinCapacity(int capacity)
{
if (_buffer.Length < capacity)
{
_buffer = new byte[capacity];
}
_offset = 0;
}
internal void Align(int alignment)
{
while ((_offset % alignment) != 0)
{
_offset++;
}
}
internal void ReadInt16(out short value)
{
value = (short)((_buffer[_offset + 0] & 0xFF) |
(_buffer[_offset + 1] << 8));
_offset += 2;
}
internal void ReadInt8(out sbyte value)
{
value = (sbyte)_buffer[_offset];
_offset += 1;
}
internal void ReadInt32(out int value)
{
value = (int)((_buffer[_offset + 0] & 0xFF) |
(_buffer[_offset + 1] << 8) |
(_buffer[_offset + 2] << 16) |
(_buffer[_offset + 3] << 24));
_offset += 4;
}
internal void ReadInt64(out long value)
{
value = (long)(((ulong)_buffer[_offset + 0] & 0xFF) |
((ulong)_buffer[_offset + 1] << 8) |
((ulong)_buffer[_offset + 2] << 16) |
((ulong)_buffer[_offset + 3] << 24) |
((ulong)_buffer[_offset + 4] << 32) |
((ulong)_buffer[_offset + 5] << 40) |
((ulong)_buffer[_offset + 6] << 48) |
((ulong)_buffer[_offset + 7] << 56));
_offset += 8;
}
internal void ReadUInt16(out ushort value)
{
value = (ushort)((_buffer[_offset + 0] & 0xFF) |
(_buffer[_offset + 1] << 8));
_offset += 2;
}
internal void ReadUInt8(out byte value)
{
value = (byte)((_buffer[_offset + 0] & 0xFF));
_offset += 1;
}
internal void ReadUInt32(out uint value)
{
value = (uint)((_buffer[_offset + 0] & 0xFF) |
(_buffer[_offset + 1] << 8) |
(_buffer[_offset + 2] << 16) |
(_buffer[_offset + 3] << 24));
_offset += 4;
}
internal void ReadUInt64(out ulong value)
{
value = (ulong)(((ulong)_buffer[_offset + 0] & 0xFF) |
((ulong)_buffer[_offset + 1] << 8) |
((ulong)_buffer[_offset + 2] << 16) |
((ulong)_buffer[_offset + 3] << 24) |
((ulong)_buffer[_offset + 4] << 32) |
((ulong)_buffer[_offset + 5] << 40) |
((ulong)_buffer[_offset + 6] << 48) |
((ulong)_buffer[_offset + 7] << 56));
_offset += 8;
}
internal void ReadInt32(int[] values)
{
for (int i = 0; i < values.Length; i++)
{
ReadInt32(out values[i]);
}
}
internal void ReadUInt32(uint[] values)
{
for (int i = 0; i < values.Length; i++)
{
ReadUInt32(out values[i]);
}
}
internal void ReadBytes(byte[] bytes)
{
for (int i = 0; i < bytes.Length; i++)
{
bytes[i] = _buffer[_offset++];
}
}
internal float ReadFloat()
{
float result = BitConverter.ToSingle(_buffer, _offset);
_offset += 4;
return result;
}
internal double ReadDouble()
{
double result = BitConverter.ToDouble(_buffer, _offset);
_offset += 8;
return result;
}
internal decimal ReadDecimal()
{
int[] bits = new int[4];
this.ReadInt32(bits);
return new decimal(bits[2], bits[3], bits[1], bits[0] < 0, (byte)((bits[0] & 0x00FF0000) >> 16));
}
internal void ReadBString(out string value)
{
ushort len;
this.ReadUInt16(out len);
value = Encoding.UTF8.GetString(_buffer, _offset, len);
_offset += len;
}
internal void ReadCString(out string value)
{
int len = 0;
while (_offset + len < _buffer.Length && _buffer[_offset + len] != 0)
{
len++;
}
value = Encoding.UTF8.GetString(_buffer, _offset, len);
_offset += len + 1;
}
internal void SkipCString(out string value)
{
int len = 0;
while (_offset + len < _buffer.Length && _buffer[_offset + len] != 0)
{
len++;
}
_offset += len + 1;
value = null;
}
internal void ReadGuid(out Guid guid)
{
uint a;
ushort b;
ushort c;
byte d;
byte e;
byte f;
byte g;
byte h;
byte i;
byte j;
byte k;
ReadUInt32(out a);
ReadUInt16(out b);
ReadUInt16(out c);
ReadUInt8(out d);
ReadUInt8(out e);
ReadUInt8(out f);
ReadUInt8(out g);
ReadUInt8(out h);
ReadUInt8(out i);
ReadUInt8(out j);
ReadUInt8(out k);
guid = new Guid(a, b, c, d, e, f, g, h, i, j, k);
}
internal string ReadString()
{
int len = 0;
while (_offset + len < _buffer.Length && _buffer[_offset + len] != 0)
{
len += 2;
}
string result = Encoding.Unicode.GetString(_buffer, _offset, len);
_offset += len + 2;
return result;
}
}
}

Просмотреть файл

@ -0,0 +1,38 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace Microsoft.Diagnostics.Runtime.Utilities.Pdb
{
internal struct BitSet
{
internal BitSet(BitAccess bits)
{
bits.ReadInt32(out _size); // 0..3 : Number of words
_words = new uint[_size];
bits.ReadUInt32(_words);
}
internal bool IsSet(int index)
{
int word = index / 32;
if (word >= _size) return false;
return ((_words[word] & GetBit(index)) != 0);
}
private static uint GetBit(int index)
{
return ((uint)1 << (index % 32));
}
internal bool IsEmpty
{
get { return _size == 0; }
}
private int _size;
private uint[] _words;
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,93 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
namespace Microsoft.Diagnostics.Runtime.Utilities.Pdb
{
internal class DataStream
{
internal DataStream()
{
}
internal DataStream(int contentSize, BitAccess bits, int count)
{
this._contentSize = contentSize;
if (count > 0)
{
this._pages = new int[count];
bits.ReadInt32(this._pages);
}
}
internal void Read(PdbStreamHelper reader, BitAccess bits)
{
bits.MinCapacity(_contentSize);
Read(reader, 0, bits.Buffer, 0, _contentSize);
}
internal void Read(PdbStreamHelper reader, int position,
byte[] bytes, int offset, int data)
{
if (position + data > _contentSize)
{
throw new PdbException("DataStream can't read off end of stream. " +
"(pos={0},siz={1})",
position, data);
}
if (position == _contentSize)
{
return;
}
int left = data;
int page = position / reader.PageSize;
int rema = position % reader.PageSize;
// First get remained of first page.
if (rema != 0)
{
int todo = reader.PageSize - rema;
if (todo > left)
{
todo = left;
}
reader.Seek(_pages[page], rema);
reader.Read(bytes, offset, todo);
offset += todo;
left -= todo;
page++;
}
// Now get the remaining pages.
while (left > 0)
{
int todo = reader.PageSize;
if (todo > left)
{
todo = left;
}
reader.Seek(_pages[page], 0);
reader.Read(bytes, offset, todo);
offset += todo;
left -= todo;
page++;
}
}
internal int Length
{
get { return _contentSize; }
}
internal int _contentSize;
internal int[] _pages;
}
}

Просмотреть файл

@ -0,0 +1,37 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace Microsoft.Diagnostics.Runtime.Utilities.Pdb
{
internal struct DbiDbgHdr
{
internal DbiDbgHdr(BitAccess bits)
{
bits.ReadUInt16(out snFPO);
bits.ReadUInt16(out snException);
bits.ReadUInt16(out snFixup);
bits.ReadUInt16(out snOmapToSrc);
bits.ReadUInt16(out snOmapFromSrc);
bits.ReadUInt16(out snSectionHdr);
bits.ReadUInt16(out snTokenRidMap);
bits.ReadUInt16(out snXdata);
bits.ReadUInt16(out snPdata);
bits.ReadUInt16(out snNewFPO);
bits.ReadUInt16(out snSectionHdrOrig);
}
internal ushort snFPO; // 0..1
internal ushort snException; // 2..3 (deprecated)
internal ushort snFixup; // 4..5
internal ushort snOmapToSrc; // 6..7
internal ushort snOmapFromSrc; // 8..9
internal ushort snSectionHdr; // 10..11
internal ushort snTokenRidMap; // 12..13
internal ushort snXdata; // 14..15
internal ushort snPdata; // 16..17
internal ushort snNewFPO; // 18..19
internal ushort snSectionHdrOrig; // 20..21
}
}

Просмотреть файл

@ -0,0 +1,55 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace Microsoft.Diagnostics.Runtime.Utilities.Pdb
{
internal struct DbiHeader
{
internal DbiHeader(BitAccess bits)
{
bits.ReadInt32(out sig);
bits.ReadInt32(out ver);
bits.ReadInt32(out age);
bits.ReadInt16(out gssymStream);
bits.ReadUInt16(out vers);
bits.ReadInt16(out pssymStream);
bits.ReadUInt16(out pdbver);
bits.ReadInt16(out symrecStream);
bits.ReadUInt16(out pdbver2);
bits.ReadInt32(out gpmodiSize);
bits.ReadInt32(out secconSize);
bits.ReadInt32(out secmapSize);
bits.ReadInt32(out filinfSize);
bits.ReadInt32(out tsmapSize);
bits.ReadInt32(out mfcIndex);
bits.ReadInt32(out dbghdrSize);
bits.ReadInt32(out ecinfoSize);
bits.ReadUInt16(out flags);
bits.ReadUInt16(out machine);
bits.ReadInt32(out reserved);
}
internal int sig; // 0..3
internal int ver; // 4..7
internal int age; // 8..11
internal short gssymStream; // 12..13
internal ushort vers; // 14..15
internal short pssymStream; // 16..17
internal ushort pdbver; // 18..19
internal short symrecStream; // 20..21
internal ushort pdbver2; // 22..23
internal int gpmodiSize; // 24..27
internal int secconSize; // 28..31
internal int secmapSize; // 32..35
internal int filinfSize; // 36..39
internal int tsmapSize; // 40..43
internal int mfcIndex; // 44..47
internal int dbghdrSize; // 48..51
internal int ecinfoSize; // 52..55
internal ushort flags; // 56..57
internal ushort machine; // 58..59
internal int reserved; // 60..63
}
}

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
namespace Microsoft.Diagnostics.Runtime.Utilities.Pdb
{
internal class DbiModuleInfo
{
internal DbiModuleInfo(BitAccess bits, bool readStrings)
{
bits.ReadInt32(out opened);
new DbiSecCon(bits);
bits.ReadUInt16(out flags);
bits.ReadInt16(out stream);
bits.ReadInt32(out cbSyms);
bits.ReadInt32(out cbOldLines);
bits.ReadInt32(out cbLines);
bits.ReadInt16(out files);
bits.ReadInt16(out pad1);
bits.ReadUInt32(out offsets);
bits.ReadInt32(out niSource);
bits.ReadInt32(out niCompiler);
if (readStrings)
{
bits.ReadCString(out moduleName);
bits.ReadCString(out objectName);
}
else
{
bits.SkipCString(out moduleName);
bits.SkipCString(out objectName);
}
bits.Align(4);
//if (opened != 0 || pad1 != 0) {
// throw new PdbException("Invalid DBI module. "+
// "(opened={0}, pad={1})", opened, pad1);
//}
}
public override string ToString()
{
return Path.GetFileName(moduleName);
}
internal int opened; // 0..3
//internal DbiSecCon section; // 4..31
internal ushort flags; // 32..33
internal short stream; // 34..35
internal int cbSyms; // 36..39
internal int cbOldLines; // 40..43
internal int cbLines; // 44..57
internal short files; // 48..49
internal short pad1; // 50..51
internal uint offsets;
internal int niSource;
internal int niCompiler;
internal string moduleName;
internal string objectName;
}
}

Просмотреть файл

@ -0,0 +1,38 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace Microsoft.Diagnostics.Runtime.Utilities.Pdb
{
internal struct DbiSecCon
{
internal DbiSecCon(BitAccess bits)
{
bits.ReadInt16(out section);
bits.ReadInt16(out pad1);
bits.ReadInt32(out offset);
bits.ReadInt32(out size);
bits.ReadUInt32(out flags);
bits.ReadInt16(out module);
bits.ReadInt16(out pad2);
bits.ReadUInt32(out dataCrc);
bits.ReadUInt32(out relocCrc);
//if (pad1 != 0 || pad2 != 0) {
// throw new PdbException("Invalid DBI section. "+
// "(pad1={0}, pad2={1})",
// pad1, pad2);
//}
}
internal short section; // 0..1
internal short pad1; // 2..3
internal int offset; // 4..7
internal int size; // 8..11
internal uint flags; // 12..15
internal short module; // 16..17
internal short pad2; // 18..19
internal uint dataCrc; // 20..23
internal uint relocCrc; // 24..27
}
}

Просмотреть файл

@ -0,0 +1,58 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace Microsoft.Diagnostics.Runtime.Utilities.Pdb
{
internal class MsfDirectory
{
internal MsfDirectory(PdbStreamHelper reader, PdbFileHeader head, BitAccess bits)
{
int pages = reader.PagesFromSize(head.DirectorySize);
// 0..n in page of directory pages.
bits.MinCapacity(head.DirectorySize);
int directoryRootPages = head.DirectoryRoot.Length;
int pagesPerPage = head.PageSize / 4;
int pagesToGo = pages;
for (int i = 0; i < directoryRootPages; i++)
{
int pagesInThisPage = pagesToGo <= pagesPerPage ? pagesToGo : pagesPerPage;
reader.Seek(head.DirectoryRoot[i], 0);
bits.Append(reader.Reader, pagesInThisPage * 4);
pagesToGo -= pagesInThisPage;
}
bits.Position = 0;
DataStream stream = new DataStream(head.DirectorySize, bits, pages);
bits.MinCapacity(head.DirectorySize);
stream.Read(reader, bits);
// 0..3 in directory pages
int count;
bits.ReadInt32(out count);
// 4..n
int[] sizes = new int[count];
bits.ReadInt32(sizes);
// n..m
_streams = new DataStream[count];
for (int i = 0; i < count; i++)
{
if (sizes[i] <= 0)
{
_streams[i] = new DataStream();
}
else
{
_streams[i] = new DataStream(sizes[i], bits,
reader.PagesFromSize(sizes[i]));
}
}
}
internal DataStream[] _streams;
}
}

Просмотреть файл

@ -0,0 +1,110 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace Microsoft.Diagnostics.Runtime.Utilities.Pdb
{
/// <summary>
/// This class represents a constant value in source code, such as:
/// const int Foo = 3;
/// </summary>
public class PdbConstant
{
/// <summary>
/// The variable name of the constant.
/// </summary>
public string Name { get; private set; }
/// <summary>
/// The metadata token of this constant.
/// </summary>
public uint Token { get; private set; }
/// <summary>
/// The value of this constant.
/// </summary>
public object Value { get; private set; }
internal PdbConstant(BitAccess bits)
{
uint token;
bits.ReadUInt32(out token);
this.Token = token;
byte tag1;
bits.ReadUInt8(out tag1);
byte tag2;
bits.ReadUInt8(out tag2);
if (tag2 == 0)
{
this.Value = tag1;
}
else if (tag2 == 0x80)
{
switch (tag1)
{
case 0x00: //sbyte
sbyte sb;
bits.ReadInt8(out sb);
this.Value = sb;
break;
case 0x01: //short
short s;
bits.ReadInt16(out s);
this.Value = s;
break;
case 0x02: //ushort
ushort us;
bits.ReadUInt16(out us);
this.Value = us;
break;
case 0x03: //int
int i;
bits.ReadInt32(out i);
this.Value = i;
break;
case 0x04: //uint
uint ui;
bits.ReadUInt32(out ui);
this.Value = ui;
break;
case 0x05: //float
this.Value = bits.ReadFloat();
break;
case 0x06: //double
this.Value = bits.ReadDouble();
break;
case 0x09: //long
long sl;
bits.ReadInt64(out sl);
this.Value = sl;
break;
case 0x0a: //ulong
ulong ul;
bits.ReadUInt64(out ul);
this.Value = ul;
break;
case 0x10: //string
string str;
bits.ReadBString(out str);
this.Value = str;
break;
case 0x19: //decimal
this.Value = bits.ReadDecimal();
break;
default:
//TODO: error
break;
}
}
else
{
//TODO: error
}
string name;
bits.ReadCString(out name);
Name = name;
}
}
}

Просмотреть файл

@ -0,0 +1,16 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
namespace Microsoft.Diagnostics.Runtime.Utilities.Pdb
{
internal class PdbDebugException : IOException
{
internal PdbDebugException(String format, params object[] args)
: base(String.Format(format, args))
{
}
}
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше