MCPcopy Create free account
hub / github.com/capstone-engine/capstone / main

Method main

bindings/java/TestX86.java:192–225  ·  view source on GitHub ↗
(String argv[])

Source from the content-addressed store, hash-verified

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}

Callers 5

test_arm64_bra.pyFile · 0.45
mainFunction · 0.45
test_arm64_pac.pyFile · 0.45
test_arm64_mov.pyFile · 0.45

Calls 7

hexString2ByteMethod · 0.95
stringToHexMethod · 0.95
print_ins_detailMethod · 0.95
setDetailMethod · 0.80
setSyntaxMethod · 0.80
closeMethod · 0.80
disasmMethod · 0.45

Tested by

no test coverage detected