本文介绍了如何建立一个自定义的调试器附加到.NET的过程并监听到一个特定类型的事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算做一个非常具体的分析工具,它侦听特定类型的事件,那就是,我有一个类型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.

这篇关于如何建立一个自定义的调试器附加到.NET的过程并监听到一个特定类型的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 08:51