Can I create my own JIT \ Interpreter \ Compiler for C # and use it in Visual Studio?

I'm currently writing a compiler that creates a JIT-like EXE from C # (rewrites itself), I still need to make Visual Studio, and does the debugger recognize the way I want to build it (with my compiler) and debug the output?

My compiler output is EXE, but it does not contain MSIL, it contains my intermediate language, and the rest of the content is JIT written in C ++. (C ++ reads itself \ EXE and executes)

I well know that it is not magic to make it compatible; I am here to receive a direct answer, whatever it is possible, and allusions to it; for example, write a C ++ DLL with such functions and parameters and give the DLL path to the parameters of the Visual Studio debugger or just give me a link to MSDN. (I got zero results from Google)

+5
source share
1 answer

It seems that what you want to do is possible. Relevant MSDN sections will be:

The Visual Studio Integrated Development Environment (IDE) provides a user interface (UI) for standard components such as compilers, editors, and debuggers. Features such as Visual C ++ and Visual Basic that are included with Visual Studio themselves are extensions to the IDE. The Visual Studio SDK provides tools, samples, wizards, designers and documentation to help you develop your own applications that extend the IDE and integrate easily with it.

Pay particular attention to:

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

Also pay attention to the Language Services section - this description means adding support for a new language in the visual studio. In particular, you can also add debugging support for the language.

see Language Services 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 using the native code debugging engine built into Visual Studio. If your compiler creates the Microsoft Intermediate Language (MSIL), you can debug programs using the managed code debugging engine, which is also integrated into Visual Studio. If your compiler targets a proprietary operating system or other runtime, you need to write your own debugging engine.

My emphasis is i.e. you can debug whatever you want, but you will need to write a debugger yourself.

You probably want to download the Visual Studio SDK .

+7
source

Source: https://habr.com/ru/post/1234542/


All Articles