ICorProfilerInfo 接口

为代码探查器提供方法,以便与公共语言运行时 (CLR) 进行通信以控制事件监视和请求信息。

注意注意

ICorProfilerInfo 接口中的每个方法都会返回一个 HRESULT,以指示成功或失败。有关可能的返回代码的列表,请参见 CorError.h。

方法

方法

说明

ICorProfilerInfo::BeginInprocDebugging 方法

初始化进程内调试支持。 此方法在 .NET Framework 2.0 版中已过时。

ICorProfilerInfo::EndInprocDebugging 方法

关闭进程内调试会话。 此方法在 .NET Framework 2.0 版中已过时。

ICorProfilerInfo::ForceGC 方法

强制在运行时内执行垃圾回收。

ICorProfilerInfo::GetAppDomainInfo 方法

获取有关指定应用程序域的信息。

ICorProfilerInfo::GetAssemblyInfo 方法

获取有关指定程序集的信息。

ICorProfilerInfo::GetClassFromObject 方法

获取具有指定 ClassID

对象的 ObjectID

ICorProfilerInfo::GetClassFromToken 方法

在给定元数据标记的情况下获取类的 ID。 此方法在 .NET Framework 2.0 版中已过时。 改用 ICorProfilerInfo2::GetClassFromTokenAndTypeArgs 方法。

ICorProfilerInfo::GetClassIDInfo 方法

获取指定类的父模块和元数据标记。

ICorProfilerInfo::GetCodeInfo 方法

获取与指定函数 ID 关联的本机代码的范围。 此方法已过时。 改用 ICorProfilerInfo2::GetCodeInfo2 方法。

ICorProfilerInfo::GetCurrentThreadID 方法

如果当前线程是托管线程,则获取当前线程的 ID。

ICorProfilerInfo::GetEventMask 方法

获取探查器要为其接收来自 CLR 的事件通知的当前事件类别。

ICorProfilerInfo::GetFunctionFromIP 方法

将托管代码指令指针映射到 FunctionID

ICorProfilerInfo::GetFunctionFromToken 方法

获取函数的 ID。 此方法在 .NET Framework 2.0 版中已过时。 改用 ICorProfilerInfo2::GetFunctionFromTokenAndTypeArgs 方法。

ICorProfilerInfo::GetFunctionInfo 方法

获取指定函数的父类和元数据标记。

ICorProfilerInfo::GetHandleFromThread 方法

将线程的 ID 映射到 Win32 线程句柄。

ICorProfilerInfo::GetILFunctionBody 方法

获取一个指向 Microsoft 中间语言 (MSIL) 代码中的方法体的指针,该指针从方法头开始。

ICorProfilerInfo::GetILFunctionBodyAllocator 方法

获取一个可提供方法的接口,该方法可以分配要用于换出 MSIL 代码中的方法体的内存。

ICorProfilerInfo::GetILToNativeMapping 方法

获取指定函数中包含的代码从 MSIL 偏移量到本机偏移量的映射。

ICorProfilerInfo::GetInprocInspectionInterface 方法

获取一个可为 ICorDebugProcess 接口查询的对象。 此方法在 .NET Framework 2.0 版中已过时。

ICorProfilerInfo::GetInprocInspectionIThisThread 方法

获取一个可为 ICorDebugThread 接口查询的对象。 此方法在 .NET Framework 2.0 版中已过时。

ICorProfilerInfo::GetModuleInfo 方法

对于给定的模块 ID,返回模块的文件名和模块的父程序集的 ID。

ICorProfilerInfo::GetModuleMetaData 方法

获取映射到指定模块的元数据接口实例。

ICorProfilerInfo::GetObjectSize 方法

获取指定对象的大小。

ICorProfilerInfo::GetThreadContext 方法

获取当前与指定的线程关联的上下文标识。

ICorProfilerInfo::GetThreadInfo 方法

获取指定线程的当前 Win32 线程标识。

ICorProfilerInfo::GetTokenAndMetadataFromFunction 方法

为指定函数获取元数据标记和元数据接口实例,可对标记使用该实例。

ICorProfilerInfo::IsArrayClass 方法

确定指定的类是否为数组类。

ICorProfilerInfo::SetEnterLeaveFunctionHooks 方法

指定要在托管函数的“enter”、“leave”和“tailcall”挂钩上调用的探查器实现的函数。

ICorProfilerInfo::SetEventMask 方法

设置一个指定事件类型的值,探查器将为该类事件接收来自 CLR 的通知。

ICorProfilerInfo::SetFunctionIDMapper 方法

指定将要调用以便将 FunctionID 值映射到替代值的探查器实现的函数,这些替代值将传递给探查器的函数入口/出口挂钩。

ICorProfilerInfo::SetFunctionReJIT 方法

未实现。 不使用。

ICorProfilerInfo::SetILFunctionBody 方法

替换指定模块中的指定函数体。

ICorProfilerInfo::SetILInstrumentedCodeMap 方法

指定指定函数的原始 MSIL 的偏移量如何映射到该函数探查器修改的 MSIL 的新偏移量。

备注

探查器通过调用 ICorProfilerInfo 接口中的方法与 CLR 通信,以此来控制事件监视和请求信息。

ICorProfilerInfo 接口的方法由 CLR 使用自由线程模型实现。 每个方法都会返回一个指示成功或失败的 HRESULT。 有关可能的返回代码的列表,请参见 CorError.h。

在初始化期间,CLR 会通过探查器的 ICorProfilerCallback::Initialize 实现向每个代码探查器传递一个 ICorProfilerInfo 接口。 这样,代码探查器便可以调用 ICorProfilerInfo 接口的方法,以获取有关要在 CLR 的控制下执行的托管代码的信息。

要求

**平台:**请参见 .NET Framework 系统要求

**头文件:**CorProf.idl、CorProf.h

**库:**CorGuids.lib

**.NET Framework 版本:**4、3.5 SP1、3.5、3.0 SP1、3.0、2.0 SP1、2.0

请参见

参考

ICorProfilerInfo2 接口

其他资源

分析接口