本文整理汇总了C#中Debugger.Process.GetModule方法的典型用法代码示例。如果您正苦于以下问题:C# Process.GetModule方法的具体用法?C# Process.GetModule怎么用?C# Process.GetModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debugger.Process
的用法示例。
在下文中一共展示了Process.GetModule方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
static public DebugType Create(Process process, ICorDebugClass corClass, params ICorDebugType[] typeArguments)
{
MetaData metaData = process.GetModule(corClass.Module).MetaData;
bool isValueType = false;
uint superClassToken = metaData.GetTypeDefProps(corClass.Token).SuperClassToken;
if ((superClassToken & 0xFF000000) == 0x02000000) { // TypeDef
if (metaData.GetTypeDefProps(superClassToken).Name == "System.ValueType") {
isValueType = true;
}
}
if ((superClassToken & 0xFF000000) == 0x01000000) { // TypeRef
if (metaData.GetTypeRefProps(superClassToken).Name == "System.ValueType") {
isValueType = true;
}
}
int getArgsCount = metaData.GetGenericParamCount(corClass.Token);
Array.Resize(ref typeArguments, getArgsCount);
ICorDebugType corType = corClass.CastTo<ICorDebugClass2>().GetParameterizedType(
isValueType ? (uint)CorElementType.VALUETYPE : (uint)CorElementType.CLASS,
typeArguments
);
return Create(process, corType);
}
示例2: DebugType
DebugType(Process process, ICorDebugType corType)
{
if (corType == null) throw new ArgumentNullException("corType");
this.process = process;
this.corType = corType;
this.corElementType = (CorElementType)corType.Type;
if (this.IsClass || this.IsValueType) {
this.corClass = corType.Class;
this.module = process.GetModule(corClass.Module);
this.classProps = module.MetaData.GetTypeDefProps(corClass.Token);
}
if (this.IsClass || this.IsValueType || this.IsArray || this.IsPointer) {
foreach(ICorDebugType t in corType.EnumerateTypeParameters().Enumerator) {
typeArguments.Add(DebugType.Create(process, t));
}
}
this.fullName = GetFullName();
}
示例3: Function
internal Function(Thread thread, FrameID frameID, ICorDebugILFrame corILFrame)
{
this.process = thread.Process;
this.thread = thread;
this.frameID = frameID;
this.CorILFrame = corILFrame;
corFunction = corILFrame.Function;
module = process.GetModule(corFunction.Module);
methodProps = module.MetaData.GetMethodProps(corFunction.Token);
// Force some callback when function steps out so that we can expire it
stepOutStepper = new Stepper(this, "Function Tracker");
stepOutStepper.StepOut();
stepOutStepper.PauseWhenComplete = false;
process.TraceMessage("Function " + this.ToString() + " created");
}
示例4: GetUsesTypes
public static List<DebugType> GetUsesTypes(Process p, DebugType dt)
{
if (unit_debug_types == null)
{
unit_debug_types = new List<DebugType>();
foreach (Type t in unit_types)
unit_debug_types.Add(DebugType.Create(p.GetModule(t.Assembly.ManifestModule.ScopeName),(uint)t.MetadataToken));
}
return unit_debug_types;
}
示例5: ToTypeReference
public static ITypeReference ToTypeReference(this ICorDebugType corType, Process process)
{
switch ((CorElementType)corType.GetTheType()) {
case CorElementType.VOID:
return KnownTypeReference.Void;
case CorElementType.BOOLEAN:
return KnownTypeReference.Boolean;
case CorElementType.CHAR:
return KnownTypeReference.Char;
case CorElementType.I1:
return KnownTypeReference.SByte;
case CorElementType.U1:
return KnownTypeReference.Byte;
case CorElementType.I2:
return KnownTypeReference.Int16;
case CorElementType.U2:
return KnownTypeReference.UInt16;
case CorElementType.I4:
return KnownTypeReference.Int32;
case CorElementType.U4:
return KnownTypeReference.UInt32;
case CorElementType.I8:
return KnownTypeReference.Int64;
case CorElementType.U8:
return KnownTypeReference.UInt64;
case CorElementType.R4:
return KnownTypeReference.Single;
case CorElementType.R8:
return KnownTypeReference.Double;
case CorElementType.STRING:
return KnownTypeReference.String;
case CorElementType.PTR:
return new PointerTypeReference(corType.GetFirstTypeParameter().ToTypeReference(process));
case CorElementType.BYREF:
return new ByReferenceTypeReference(corType.GetFirstTypeParameter().ToTypeReference(process));
case CorElementType.VALUETYPE:
case CorElementType.CLASS:
// Get generic arguments
List<ITypeReference> genericArguments = new List<ITypeReference>();
foreach (ICorDebugType t in corType.EnumerateTypeParameters().GetEnumerator()) {
genericArguments.Add(t.ToTypeReference(process));
}
var module = process.GetModule(corType.GetClass().GetModule());
ITypeReference typeDefinitionReference = ToTypeDefinitionReference(module, corType.GetClass().GetToken());
if (genericArguments.Count > 0)
return new ParameterizedTypeReference(typeDefinitionReference, genericArguments);
else
return typeDefinitionReference;
case CorElementType.ARRAY:
return new ArrayTypeReference(corType.GetFirstTypeParameter().ToTypeReference(process),
(int)corType.GetRank());
case CorElementType.GENERICINST:
throw new NotSupportedException();
case CorElementType.I:
return KnownTypeReference.IntPtr;
case CorElementType.U:
return KnownTypeReference.UIntPtr;
case CorElementType.OBJECT:
return KnownTypeReference.Object;
case CorElementType.SZARRAY:
return new ArrayTypeReference(corType.GetFirstTypeParameter().ToTypeReference(process));
case CorElementType.CMOD_REQD:
case CorElementType.CMOD_OPT:
return corType.GetFirstTypeParameter().ToTypeReference(process);
default:
throw new InvalidOperationException("Invalid value for CorElementType");
}
}