Creating assembly code from C # code?

Is there a way to generate assembly code from C # code? I know this is possible with C code with GAS, but does anyone know if this is possible with C #?

+4
source share
3 answers

C # is usually compiled into .NET bytecode (called CIL or MSIL ) and then JIT ("Just In Time"), compiled into native code when the program is actually running. There are early compilers for C #, for example Mono AOT , so you can compile a C # program through one of them and then parse it. The result is likely to be very difficult.

Most likely, you can look at bytecodes, which are slightly higher than the processor assembly code that you can do using ILdasm on a compiled .exe program in C #.

+2
source

C # code compiles to MSIL (MS Intermediate Language), which is actually not an asm code that you get from C compiler. Learn more about how .NET Framework applications work.

If you want to see the generated IL code, see this question .

+2
source

You can do this a bit indirectly using the NGEN tool, and then parse the generated binary. Alternatively, you can use the debugger to check the JIT code created from MSIL, Ollydbg 2 is one such debugger that can do this.

+2
source

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


All Articles