StarCrossPortal / ghidracraft

Ghidracraft is part of the bincraft project collections, a forked version of Ghidra which mixes in our flavor. Checkout ghidracraft-book for more!
https://starcrossportal.github.io/ghidracraft-book/
Apache License 2.0
85 stars 10 forks source link

Decompiler Refactor 101 #12

Open Escapingbug opened 3 years ago

Escapingbug commented 3 years ago

This is a requirement for decompiler refactor. Current decompiler suffers a lot from leaky abstraction and not enough abstraction.

Anti-patterns such as "using namespace std" is used everywhere.

Upstream does not currently has any idea on refactor the code. This might be on our own. My thought is to write down notes on how the refactor could happen and people interested in this might gradually submit commits on making the code enjoyful to read.

Some of the refactors could be:

Escapingbug commented 3 years ago

Update:

Refactor is more likely to be in Rust. Initial work has already be done in #21 .

Escapingbug commented 2 years ago

Update:

I'm changing my mind about some previous decisions. Especially the Rust language one.

Rewrite the whole project into Rust can be a really large work, and may not be so beneficial during such time. What's more, this could take a lot of man power to do so.

Since currently the project is already running well, and we do not have such man power to rewrite anything in fact (quite sad, but true). I'm reconsidering this, as even after rewrite, the coding style may never come to Rust-style, it will follow C++ style most of the time as the current schema of C++ is not that "modern" style that could be transferred to Rust in a elegant way.

As for the experience, the #21 does not, till now, introduce anything really useful to us. Instead, it makes the compilation process even harder. We will have to keep an eye on the building process as it is using Rust building system instead of pure C++ one.

I will shortly try to deprecate the Rust try-out. Our rewrite should, sadly speaking, be in C++. Maybe more modern style C++ and more DSL rewrites, but in C++.