Make capstone optional with a feature

This commit is contained in:
Brandon Fish 2019-03-03 16:02:20 -06:00
parent aae256b407
commit c07298e58e
2 changed files with 4 additions and 2 deletions

View File

@ -13,7 +13,7 @@ smallvec = "0.6.8"
goblin = "0.0.20"
libc = "0.2.49"
nix = "0.13.0"
capstone = "0.5.0"
capstone = { version = "0.5.0", optional = true }
[build-dependencies]
cc = "1.0"
@ -25,4 +25,5 @@ semver = "0.9"
wabt = "0.7.4"
[features]
debug = ["wasmer-runtime-core/debug"]
debug = ["wasmer-runtime-core/debug"]
disasm = ["capstone"]

View File

@ -462,6 +462,7 @@ fn get_func_from_index<'a>(
(func_ptr, ctx, signature, sig_index)
}
#[cfg(feature = "disasm")]
unsafe fn disass_ptr(ptr: *const u8, size: usize, inst_count: usize) {
use capstone::arch::BuildsCapstone;
let mut cs = capstone::Capstone::new() // Call builder-pattern