-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exposing Insn::detail
to the public API
#127
Comments
I need to think about it more, but it's possible that it would be safe for As you disassemble with one thread, you can create your own structure with a copy of the information you want to save and need for analysis. Then, there will be nothing in this library that will prevent you from working in parallel. This Rust library is designed to to be safe while adding minimal (if any) overhead compared to using the C library directly. Sometimes the compromise makes it less ergonomic (like |
I did end up making my own structure with a copy, but it took me a while to sort out lifetimes because |
I found this ticket because I'm trying to access some specific members of instruction details. For example, I want to know if a "call" has an immediate operand and if so, what is the immediate value. Is it not currently possible to get access to this information with capston-rs ? |
I figured it out: fn get_call_target(&self, _my_insn: &MyInsn, cs_det: &InsnDetail) -> Result<u64, String> {
let ops = cs_det.arch_detail().operands();
let op0 = &ops[0];
let op0 = match op0 {
X86Operand(op) => { op }
_ => { return Err("Invalid operand type".to_string()) }
};
let ea: u64 = match &op0.op_type {
Imm(op) => { *op as u64 }
_ => { return Err("Invalid operand type (not immediate)".to_string()) }
};
Ok(ea)
} |
I'm writing a project which involves analysing large binaries with Capstone. I'd like to perform the disassembly in a single-thread, then parallelise the higher-level analysis of the disassembled instructions.
However,
Capstone
is notSend
/Sync
( #71 ), and as accessing thedetail
field can only be done (currently) via theCapstone
struct.Would you consider exposing the
pub(crate)
functionInsn::detail
(capstone-rs/capstone-rs/src/instruction.rs
Lines 266 to 268 in 0202ebb
Capstone
handle across threads, as long as the user ensures that theArch
is correct/the pointer is non-null.The text was updated successfully, but these errors were encountered: