(String argv[])
| 190 | } |
| 191 | |
| 192 | public static void main(String argv[]) { |
| 193 | |
| 194 | final TestBasic.platform[] all_tests = { |
| 195 | new TestBasic.platform(Capstone.CS_ARCH_X86, Capstone.CS_MODE_16, hexString2Byte(X86_CODE16), "X86 16bit (Intel syntax)"), |
| 196 | new TestBasic.platform(Capstone.CS_ARCH_X86, Capstone.CS_MODE_32, Capstone.CS_OPT_SYNTAX_ATT, hexString2Byte(X86_CODE32), "X86 32 (AT&T syntax)"), |
| 197 | new TestBasic.platform(Capstone.CS_ARCH_X86, Capstone.CS_MODE_32, hexString2Byte(X86_CODE32), "X86 32 (Intel syntax)"), |
| 198 | new TestBasic.platform(Capstone.CS_ARCH_X86, Capstone.CS_MODE_64, hexString2Byte(X86_CODE64), "X86 64 (Intel syntax)"), |
| 199 | }; |
| 200 | |
| 201 | for (int i=0; i<all_tests.length; i++) { |
| 202 | TestBasic.platform test = all_tests[i]; |
| 203 | System.out.println(new String(new char[16]).replace("\0", "*")); |
| 204 | System.out.println("Platform: " + test.comment); |
| 205 | System.out.println("Code: " + TestBasic.stringToHex(test.code)); |
| 206 | System.out.println("Disasm:"); |
| 207 | |
| 208 | cs = new Capstone(test.arch, test.mode); |
| 209 | cs.setDetail(Capstone.CS_OPT_ON); |
| 210 | if (test.syntax != 0) { |
| 211 | cs.setSyntax(test.syntax); |
| 212 | } |
| 213 | Capstone.CsInsn[] all_ins = cs.disasm(test.code, 0x1000); |
| 214 | |
| 215 | for (int j = 0; j < all_ins.length; j++) { |
| 216 | print_ins_detail(all_ins[j]); |
| 217 | System.out.println(); |
| 218 | } |
| 219 | |
| 220 | System.out.printf("0x%x:\n\n", all_ins[all_ins.length-1].address + all_ins[all_ins.length-1].size); |
| 221 | |
| 222 | // Close when done |
| 223 | cs.close(); |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | } |
no test coverage detected