decomp

Crates.iodecomp
lib.rsdecomp
version
sourcesrc
created_at2024-10-23 01:06:17.995297
updated_at2024-10-31 02:58:11.641914
descriptionComponents of a decompilation pipeline.
homepage
repositoryhttps://github.com/Totobird-Creations/decomp-rs
max_upload_size
id1419514
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Totobird (Totobird-Creations)

documentation

https://docs.rs/decomp/latest/decomp/

README

https://crates.io/crates/decomp https://docs.rs/decomp/ https://unlicense.org

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);
}
Commit count: 5

cargo fmt