2 releases
0.1.4 | Oct 31, 2024 |
---|---|
0.1.3 | Oct 23, 2024 |
0.1.2 |
|
0.1.1 |
|
0.1.0 |
|
#467 in Data structures
72KB
1K
SLoC
Components of a decompilation pipeline.
This library is a Rust reimplementation of The decomp project.
The original decomp project is licensed under The Unlicense. In an effort to keep this resource accessible, this library is also licensed under The Unlicense.
Getting Started:
Add decomp
as a dependency to your Cargo.toml
.
Make sure to replace the version and llvm version with valid versions.
[dependencies]
decomp = { version = "X.X.X", features = [ "llvm-X" ] }
Load an LLVM Module:
use decomp::prelude::*;
// From a textual LLVM IR file.
let module = Module::from_ir_path("/path/to/file.ll").unwrap();
// From a bitcode LLVM IR file.
let module = Module::from_bc_path("/path/to/file.bc").unwrap();
Generate a Control Flow Graph:
See cfg
.
use decomp::prelude::*;
for function in &module.functions {
let cfg = ControlFlowGraph::new(function);
println!("{}", cfg);
}
Analyse the Control Flow Graph:
See cfa
.
use decomp::prelude::*;
for function in &module.functions {
let cfg = ControlFlowGraph::new(function);
let prims = CFAPrim::find_all(cfg).unwrap();
println!("{}", prims);
}
Recover Control Flow Groups:
See cfr
.
use decomp::prelude::*;
for function in &module.functions {
let cfg = ControlFlowGraph::new(function);
let prims = CFAPrim::find_all(cfg).unwrap();
let groups = CFRGroups::new(&prims).unwrap();
println!("{}", groups);
}
Dependencies
~1MB
~14K SLoC