开发者

I want to make my own c# debugger - how would one do that? What tools should I be using?

I'm interested in making a program that will take c# code and allow me to step through the execution of that code line by line - a debugger.

How would I go about this project without having to write a whole c# compiler? I'm using Microsoft Visual Studio, but I want my software to be as independent of their debugger implementatio开发者_如何学Gon as possible.


You're looking for ICorDebug, the managed debugging API.
You can use csc.exe to compile the code (this is included in a standard .Net Framework installation and wrapped by the CSharpCodeProvider class), then execute the assembly, attach the debugger, and step through the code.

Note that you would probably still need a C# parser to figure out where you are in the source.
The PDB file will contain some of this information; I'm not sure how much.

Note that most of the features in VS's debugger which we take for granted (especially the Watch window and variable tooltips) will require painful re-implementation. (Func-evals)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜