change cs_insn struct to follow the commit 18103e4a. fixed Python & Java bindings accordingly. attn: bindings

This commit is contained in:
Nguyen Anh Quynh 2013-12-20 22:02:20 +08:00
parent 5f0c6869ca
commit 7008356bc5
4 changed files with 28 additions and 28 deletions

View File

@ -42,20 +42,20 @@ public class Capstone {
public byte[] bytes;
public byte[] mnemonic;
public byte[] operands;
public int[] regs_read;
public int regs_read_count;
public int[] regs_write;
public int regs_write_count;
public int[] groups;
public int groups_count;
public byte[] regs_read;
public byte regs_read_count;
public byte[] regs_write;
public byte regs_write_count;
public byte[] groups;
public byte groups_count;
public _cs_insn(Pointer p) {
bytes = new byte[16];
mnemonic = new byte[32];
operands = new byte[96];
regs_read = new int[32];
regs_write = new int[32];
groups = new int[8];
regs_read = new byte[12];
regs_write = new byte[20];
groups = new byte[8];
useMemory(p);
read();
}
@ -81,9 +81,9 @@ public class Capstone {
public short size;
public String mnemonic;
public String opStr;
public int[] regsRead;
public int[] regsWrite;
public int[] groups;
public byte[] regsRead;
public byte[] regsWrite;
public byte[] groups;
public CsInsn (_cs_insn struct, Pointer _ptr_origin, NativeLong _csh, CS _cs, OpInfo _op_info) {
id = struct.id;
@ -92,13 +92,13 @@ public class Capstone {
mnemonic = new String(struct.mnemonic).replace("\u0000","");
opStr = new String(struct.operands).replace("\u0000","");
regsRead = new int[struct.regs_read_count];
regsRead = new byte[struct.regs_read_count];
for (int i=0; i<regsRead.length; i++)
regsRead[i] = struct.regs_read[i];
regsWrite = new int[struct.regs_write_count];
regsWrite = new byte[struct.regs_write_count];
for (int i=0; i<regsWrite.length; i++)
regsWrite[i] = struct.regs_write[i];
groups = new int[struct.groups_count];
groups = new byte[struct.groups_count];
for (int i=0; i<groups.length; i++)
groups[i] = struct.groups[i];
operands = _op_info;

View File

@ -151,12 +151,12 @@ class _cs_insn(ctypes.Structure):
('bytes', ctypes.c_ubyte * 16),
('mnemonic', ctypes.c_char * 32),
('op_str', ctypes.c_char * 96),
('regs_read', ctypes.c_uint * 32),
('regs_read_count', ctypes.c_uint),
('regs_write', ctypes.c_uint * 32),
('regs_write_count', ctypes.c_uint),
('groups', ctypes.c_uint * 8),
('groups_count', ctypes.c_uint),
('regs_read', ctypes.c_ubyte * 12),
('regs_read_count', ctypes.c_ubyte),
('regs_write', ctypes.c_ubyte * 20),
('regs_write_count', ctypes.c_ubyte),
('groups', ctypes.c_ubyte * 8),
('groups_count', ctypes.c_ubyte),
('arch', _cs_arch),
)

2
cs.c
View File

@ -454,7 +454,7 @@ const char *cs_insn_name(csh ud, unsigned int insn)
return handle->insn_name(ud, insn);
}
static bool arr_exist(unsigned int *arr, int max, unsigned int id)
static bool arr_exist(unsigned char *arr, unsigned char max, unsigned int id)
{
int i;

View File

@ -91,14 +91,14 @@ typedef struct cs_insn {
// NOTE: All information below is not available when CS_OPT_DETAIL = CS_OPT_OFF
unsigned int regs_read[32]; // list of implicit registers read by this insn
unsigned int regs_read_count; // number of implicit registers read by this insn
uint8_t regs_read[12]; // list of implicit registers read by this insn
uint8_t regs_read_count; // number of implicit registers read by this insn
unsigned int regs_write[32]; // list of implicit registers modified by this insn
unsigned int regs_write_count; // number of implicit registers modified by this insn
uint8_t regs_write[20]; // list of implicit registers modified by this insn
uint8_t regs_write_count; // number of implicit registers modified by this insn
unsigned int groups[8]; // list of group this instruction belong to
unsigned int groups_count; // number of groups this insn belongs to
uint8_t groups[8]; // list of group this instruction belong to
uint8_t groups_count; // number of groups this insn belongs to
// Architecture-specific instruction info
union {