| 33 | } |
| 34 | |
| 35 | public static void print_ins_detail(Capstone.CsInsn ins) { |
| 36 | System.out.printf("0x%x:\t%s\t%s\n", ins.address, ins.mnemonic, ins.opStr); |
| 37 | |
| 38 | Mips.OpInfo operands = (Mips.OpInfo) ins.operands; |
| 39 | |
| 40 | if (operands.op.length != 0) { |
| 41 | System.out.printf("\top_count: %d\n", operands.op.length); |
| 42 | for (int c=0; c<operands.op.length; c++) { |
| 43 | Mips.Operand i = (Mips.Operand) operands.op[c]; |
| 44 | String imm = hex(i.value.imm); |
| 45 | if (i.type == MIPS_OP_REG) |
| 46 | System.out.printf("\t\toperands[%d].type: REG = %s\n", c, ins.regName(i.value.reg)); |
| 47 | if (i.type == MIPS_OP_IMM) |
| 48 | System.out.printf("\t\toperands[%d].type: IMM = 0x%x\n", c, i.value.imm); |
| 49 | if (i.type == MIPS_OP_MEM) { |
| 50 | System.out.printf("\t\toperands[%d].type: MEM\n",c); |
| 51 | String base = ins.regName(i.value.mem.base); |
| 52 | if (base != null) |
| 53 | System.out.printf("\t\t\toperands[%d].mem.base: REG = %s\n", c, base); |
| 54 | if (i.value.mem.disp != 0) |
| 55 | System.out.printf("\t\t\toperands[%d].mem.disp: %s\n", c, hex(i.value.mem.disp)); |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | public static void main(String argv[]) { |
| 62 | |