AlexAltea / capstone.js

Capstone disassembler framework for JavaScript
https://alexaltea.github.io/capstone.js/
BSD 3-Clause "New" or "Revised" License
172 stars 28 forks source link

detail.op isn't given on X86 #8

Closed darkf closed 5 years ago

darkf commented 5 years ago

Take the homepage's example code and add d.option(cs.OPT_DETAIL, cs.OPT_ON);

Now try to print instr.detail.op, it should be an array, but it's not given. op_count from here is also 0, but shouldn't it be a real value if detail mode is on?

AlexAltea commented 5 years ago

Hey @darkf! Not sure what's causing this, it's very likely that I failed writing the parser for those structures. I'm a bit busy these days, but I'll try to fix this issue (and update to Capstone 4.0.1!) in early May.

AlexAltea commented 5 years ago

I've just updated to Capstone 4.0.1 and fixed a bug in cs_close that corrupted the memory (no idea how that didn't cause issues earlier). Regarding your issue, it turns out the way I computed offsets in for the cs_detail members was wrong. This is now fixed and works fine with CS_ARCH_X86, as of 8f488ca.

The cs_detail members for the remaining architectures still need to be fixed (and the architectures added in Capstone 4.x need to be added to the wrapper as well). Other than that, regular decoding works fine.