如何建立一个自定义的调试器附加到.NET的过程并监听到一个特定类型的事件?自定义、建立一个、过程、类型

由网友(大王叫我来巡山i)分享简介:我打算做一个非常具体的分析工具,它侦听特定类型的事件,那就是,我有一个类型T,有它的事件。我想知道每个T的任何实例触发事件的时间。I intend to make a very specific profiling tool that listens to events of a specific type, tha...

我打算做一个非常具体的分析工具,它侦听特定类型的事件,那就是,我有一个类型T,有它的事件。我想知道每个T的任何实例触发事件的时间。

I intend to make a very specific profiling tool that listens to events of a specific type, that is, I have a type T that has it's events. I want to know every time any instance of T triggers events.

用户运行仿形应用,连接到一个进程和应用程序开始生成日志。

The user runs the profiling application, attaches to a process and the app starts generating the logs.

这可能吗?如果属实,我该如何开始?

Is it possible? If true, how do I start?

推荐答案

几年前,我曾在类似的东西,但不完全分析。我开始的方式是通过查看源$ C ​​$的 CLR分析器这是MSDN上,然后弄清楚它是如何连接到正在运行的应用程序,还有为c你一个小的非托管$ C $不得不做的,但它可以直接拿起从CLR探查;)

Few years back I worked on something similar, but not exactly profiling. The way I started was by looking at source code of CLR Profiler which is available on MSDN, and then figure out how it attaches to a running application, there is a little unmanaged code you'd have to do, but it can be directly picked up from CLR Profiler ;)

以下是一些地方,你可以开始寻找。

Following are some places where you could start looking at.

ICorDebug - 提供方法,允许开发人员在调试应用程序CLR。

ICorDebug - Provides methods that allow developers to debug applications in the CLR.

附加调试接口 - 所有你可以挂接到CLR的方式用于调试和分析。

Additional Debugging Interfaces - All the ways you could hook into CLR for debugging and profiling.

ICorProfilerCallback - 第一个界面来看待的分析执行。

ICorProfilerCallback - First interface to look at for profiling implementation.

分析接口 - 对于任何分析事件,要实现。

Profiling interfaces - For any profiling events you want to implement.

CLR探查 - 我想看看这个源头,它做一切你想做的事。

CLR Profiler - I'd look at the source of this, it does everything you want to do.

阅读全文

相关推荐

最新文章