c# - 我可以为 C# 制作自己的 JIT\Interpreter\Compiler 并在 Visual Studio 中使用它吗?

标签 c# c++ visual-studio compiler-construction visual-studio-debugging

我目前正在编写一个编译器,它可以从 C# 生成类似 JIT 的 EXE(重写自身),是否可以使 Visual Studio 及其调试器识别我想要构建它的方式(使用我的编译器)并调试输出?

我的编译器输出的是EXE,但是里面没有MSIL,里面有我的中间语言,剩下的内容就是用C++写的JIT。 (C++读取自身\EXE并执行)

我很清楚让它兼容并不神奇;我来这里是为了尽可能得到一个直接的答案和开始的提示;例如使用此类函数和参数编写一个 C++ DLL,并将 DLL 路径提供给 Visual Studio 的调试器参数,或者只是指向我在 MSDN 上的引用。 (我从 Google 得到的有希望的结果为零)

最佳答案

看起来你想做的事是可能的。 MSDN 的相关部分是:

The Visual Studio integrated development environment (IDE) provides the user interface (UI) for standard components, such as compilers, editors, and debuggers. Features like Visual C++ and Visual Basic that are included with Visual Studio are themselves extensions of the IDE. The Visual Studio SDK provides tools, samples, wizards, designers, and documentation that helps you develop your own applications that extend the IDE and integrate seamlessly with it.

特别注意:

Visual Studio includes a fully interactive source code debugger, providing a powerful and easy-to-use tool for tracking down bugs in your program. The debugger has complete support Visual Basic, C#, C/C++, and JavaScript. However, with the Visual Studio SDK, that is available from the Microsoft Download Center,, other programming languages can be supported in the debugger with the same rich features.

另请注意 Language Services 部分 - 这描述了向 visual studio 添加对新语言的支持的方法。特别是,您还可以为该语言添加调试支持。

参见:Language Service Support For Debugging

The type of compiler determines what you need to do to implement debugging for your language. If your compiler targets the Windows operating system and writes a .pdb file, you can debug programs with the native code debugging engine that is integrated into Visual Studio. If your compiler produces Microsoft intermediate language (MSIL), you can debug programs with the managed code debugging engine, which is also integrated into Visual Studio. If your compiler targets a proprietary operating system or a different runtime environment, you need to write your own debugging engine.

强调我的 - 即:您可以调试任何您想要的东西,但您需要自己编写调试器。

您可能想要下载 Visual Studio SDK .

关于c# - 我可以为 C# 制作自己的 JIT\Interpreter\Compiler 并在 Visual Studio 中使用它吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33351626/

相关文章:

c# - 如何在asp.net core 2+中增加上传大小?请求的实体太大

c# - 第二台显示器/电视下的 WPF 主窗口的屏幕截图

c++ - 为什么 std::exception 在 std::bad_alloc 之前捕获我的异常?

c++ - 继承和派生类

更改 const 对象 - 没有警告?另外,在什么情况下是 UB?

c# - 排序列表<int>

c# - 使用 Windows Phone 8 发送 SOAP 请求

c++ - 因为一行不相关的代码,速度差别这么大

visual-studio - 您可以将文档和电子表格添加到 Visual Studio 项目吗?

c# - Resharper Ctrl-T 映射丢失