PowerUp: IDE Decompilation and Disassembly Tools - 3 minutes read




The project features the following utilities and tools:

A watcher application that monitors source code files and IR, IL files and compiles them and later decompiles and disassembles them to produce IL,IR and X86 ASM outputs. All compilers support multiple features such as Jump Guides, X86, IR Assembly documentation, Source Maps and more.

To run the application, you need to compile Power.Up watcher and run it from the terminal by providing the correct compiler(s) and providing input and output files like so:

The application supports running multiple compilers at the same time:

C# is the only language that supports (at the moment) running code, interactive mode, benchmarking and class and struct layouts.

C# supports multiple attributes and comment-level attributes that can be used to control compilation:

Due to some limitations with C# attributes certain features will remain exclusively as comment-level attributes.

F# curently supports much of the features of the C# Watcher, the only thing that is missing is Running and Benchmarking code.

F# supports multiple comment-level attributes that can be used to control compilation:

GO Lang is not disassembled to X86 asm, but GO-specific IR is almost a 1-to-1 assembly, so most optimizations have already happened. This makes this type of IR format viable for performance analysis.

GO supports multiple comment-level attributes that can be used to control compilation:

Rust being a LLVM based language will support default compiler flags like optimization levels and source code maps. (This feature will be also added to c# and GO with time)

Rust supports multiple comment-level attributes that can be used to control compilation:

Note: IL Compilation is still a work in progress, and it will take some time before it's robust.

I use this application daily to create infographics: you would like to see more features, there's a Youtube video showing more features in detail:

To make your outputs look nice in Visual Studio Code or any other editor, you must install an X86 assembly syntax.

I use a modified version of the 13xforever X86 ASM syntax: This version is bundled with the project and can be found here:

Additionally you will need Cascadia Mono for nice guides and other features.

To disassemble JIT code, you need to extract the method info using reflection and call the extension method ToAsm(). This will get native assembly code in tier0. To get a higher Tier, you need to provide the delegate that will call the method, and over time the compiler will re-JIT it to Tier1. If you want to skip this, you can compile your project with:

There are no guarantees that Tier1 will always be available; Very short and fast methods tend not to be promoted (I'm working on a fix). Code that contains loops is always optimized so you should not bother with this method and switch back to the simpler version.

You can write IL Code as a string and compile it to a type; later, it can be fed to the JIT Decompiler. Native IL compilation is an interesting research topic since you can emit instructions that are not used or used in a completely different context.

This project uses many open source projects, like:

Additionally, some of the projects were pulled into PowerUp source code and modified:

Source: Github.com

Powered by NewsAPI.org