Switching mode to thumb and reverse(to ARM) on the go.
I want to place this code to my project:
if(p_ib->flags&INSTR_BLOCK_ARCH_THUMB)
{
cs_struct * cs_struct = handle;
cs_struct->mode |= CS_MODE_THUMB;
}
else
{
cs_struct * cs_struct = handle;
cs_struct->mode &= ~CS_MODE_THUMB;
}
cs_disasm_iter(handle,
(const uint8_t **)&abs_addr,
&size,
(uint64_t *)&rel_addr,
p_instr);
How to use the private structure(cs_struct) in my own project?
no, you should not refer to private struct, but just rely on whatever you have in capstone.h.
a simple solution is to have another cs_struct handle for ARM mode.
no, you should not refer to private struct, but just rely on whatever you have in capstone.h.
To elaborate, if you rely on a private parts of any library, your code can break silently/unexpectedly. Library authors hide implementation details so that the details can be changed without breaking the interface.
If you think the library does not have a feature you want, feel free to open a feature request issue. :wink: