From 53bbee32f927459fd5b429effa52b3c0a7c99e7b Mon Sep 17 00:00:00 2001 From: danghvu Date: Sat, 27 Sep 2014 15:41:45 -0500 Subject: [PATCH 1/3] Fix java binding tests --- bindings/java/Makefile | 10 +- bindings/java/Test.java | 2 +- bindings/java/TestX86.java | 4 +- bindings/java/TestXcore.java | 2 +- bindings/java/capstone/Capstone.java | 3 +- bindings/java/hs_err_pid17060.log | 402 +++++++++++++++++++++++++++ bindings/java/run.sh | 1 + 7 files changed, 416 insertions(+), 8 deletions(-) create mode 100644 bindings/java/hs_err_pid17060.log diff --git a/bindings/java/Makefile b/bindings/java/Makefile index c805694d..bec8f308 100644 --- a/bindings/java/Makefile +++ b/bindings/java/Makefile @@ -21,8 +21,10 @@ else endif CAPSTONE_JAVA = Capstone.java Arm_const.java Arm64_const.java Mips_const.java \ - X86_const.java Ppc_const.java Sparc_const.java Sysz_const.java \ - Arm.java Arm64.java Mips.java X86.java Ppc.java Sparc.java Systemz.java + X86_const.java Xcore_const.java Ppc_const.java Sparc_const.java\ + Sysz_const.java \ + Arm.java Arm64.java Mips.java X86.java Xcore.java Ppc.java\ + Sparc.java Systemz.java all: gen_const capstone tests @@ -40,7 +42,9 @@ endif tests: jna @mkdir -p $(OBJDIR) - javac -d $(OBJDIR) -classpath "$(JNA):$(BLDIR)/capstone.jar" Test.java TestArm.java TestArm64.java TestMips.java TestX86.java TestPpc.java TestSparc.java TestSystemz.java + javac -d $(OBJDIR) -classpath "$(JNA):$(BLDIR)/capstone.jar" Test.java\ + TestArm.java TestArm64.java TestMips.java TestX86.java TestXcore.java\ + TestPpc.java TestSparc.java TestSystemz.java gen_const: cd ../ && python const_generator.py java diff --git a/bindings/java/Test.java b/bindings/java/Test.java index 1c3d7d30..ecfac088 100644 --- a/bindings/java/Test.java +++ b/bindings/java/Test.java @@ -42,7 +42,7 @@ public class Test { public static final byte[] SPARC_CODE = new byte[] { (byte)0x80, (byte)0xa0, (byte)0x40, (byte)0x02, (byte)0x85, (byte)0xc2, (byte)0x60, (byte)0x08, (byte)0x85, (byte)0xe8, (byte)0x20, (byte)0x01, (byte)0x81, (byte)0xe8, (byte)0x00, (byte)0x00, (byte)0x90, (byte)0x10, (byte)0x20, (byte)0x01, (byte)0xd5, (byte)0xf6, (byte)0x10, (byte)0x16, (byte)0x21, (byte)0x00, (byte)0x00, (byte)0x0a, (byte)0x86, (byte)0x00, (byte)0x40, (byte)0x02, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x12, (byte)0xbf, (byte)0xff, (byte)0xff, (byte)0x10, (byte)0xbf, (byte)0xff, (byte)0xff, (byte)0xa0, (byte)0x02, (byte)0x00, (byte)0x09, (byte)0x0d, (byte)0xbf, (byte)0xff, (byte)0xff, (byte)0xd4, (byte)0x20, (byte)0x60, (byte)0x00, (byte)0xd4, (byte)0x4e, (byte)0x00, (byte)0x16, (byte)0x2a, (byte)0xc2, (byte)0x80, (byte)0x03 }; public static final byte[] SYSZ_CODE = new byte[] { (byte)0xed, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x1a, (byte)0x5a, (byte)0x0f, (byte)0x1f, (byte)0xff, (byte)0xc2, (byte)0x09, (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x07, (byte)0xf7, (byte)0xeb, (byte)0x2a, (byte)0xff, (byte)0xff, (byte)0x7f, (byte)0x57, (byte)0xe3, (byte)0x01, (byte)0xff, (byte)0xff, (byte)0x7f, (byte)0x57, (byte)0xeb, (byte)0x00, (byte)0xf0, (byte)0x00, (byte)0x00, (byte)0x24, (byte)0xb2, (byte)0x4f, (byte)0x00, (byte)0x78 }; public static final byte[] SPARCV9_CODE = new byte[] { (byte)0x81, (byte)0xa8, (byte)0x0a, (byte)0x24, (byte)0x89, (byte)0xa0, (byte)0x10, (byte)0x20, (byte)0x89, (byte)0xa0, (byte)0x1a, (byte)0x60, (byte)0x89, (byte)0xa0, (byte)0x00, (byte)0xe0 }; - public static final byte[] XCORE_CODE = new byte[] { (byte)0xfe, (byte)0x0f, (byte)0xfe, (byte)0x17, (byte)0x13, (byte)0x17, (byte)0xc6, (byte)0xfe, (byte)0xec, (byte)0x17, (byte)0x97, (byte)0xf8, (byte)0xec, (byte)0x4f, (byte)0x1f, (byte)0xfd, (byte)0xec, (byte)0x37, (byte)0x0f, (byte)0xf2, (byte)0x45, (byte)0x5b, (byte)0xf9, (byte)0xfa, (byte)0x02, (byte)0x06, (byte)0x1b, (byte)0x10 }; + public static final byte[] XCORE_CODE = new byte[] { (byte)0xfe, (byte)0x0f, (byte)0xfe, (byte)0x17, (byte)0x13, (byte)0x17, (byte)0xc6, (byte)0xfe, (byte)0xec, (byte)0x17, (byte)0x97, (byte)0xf8, (byte)0xec, (byte)0x4f, (byte)0x1f, (byte)0xfd, (byte)0xec, (byte)0x37, (byte)0x07, (byte)0xf2, (byte)0x45, (byte)0x5b, (byte)0xf9, (byte)0xfa, (byte)0x02, (byte)0x06, (byte)0x1b, (byte)0x10 }; static public void main(String argv[]) { platform[] platforms = { diff --git a/bindings/java/TestX86.java b/bindings/java/TestX86.java index 1c17038a..15ff8196 100644 --- a/bindings/java/TestX86.java +++ b/bindings/java/TestX86.java @@ -66,8 +66,8 @@ public class TestX86 { // print SIB byte System.out.printf("\tsib: 0x%x\n", operands.sib); if (operands.sib != 0) - System.out.printf("\tsib_index: %s, sib_scale: %d, sib_base: %s\n", - ins.regName(operands.sibIndex), operands.sibScale, ins.regName(operands.sibBase)); + System.out.printf("\t\tsib_base: %s\n\t\tsib_index: %s\n\t\tsib_scale: %d\n", + ins.regName(operands.sibBase), ins.regName(operands.sibIndex), operands.sibScale); } if (operands.sseCC != 0) diff --git a/bindings/java/TestXcore.java b/bindings/java/TestXcore.java index 6ad6f785..e736bb20 100644 --- a/bindings/java/TestXcore.java +++ b/bindings/java/TestXcore.java @@ -61,7 +61,7 @@ public class TestXcore { public static void main(String argv[]) { final Test.platform[] all_tests = { - new Test.platform(Capstone.CS_ARCH_XCORE, Capstone.CS_MODE_BIG_ENDIAN, hexString2Byte(XCORE_CODE), "Xcore"), + new Test.platform(Capstone.CS_ARCH_XCORE, Capstone.CS_MODE_BIG_ENDIAN, hexString2Byte(XCORE_CODE), "XCore"), }; for (int i=0; i current thread ) + 0x00007faf85801000 JavaThread "Service Thread" daemon [_thread_blocked, id=21251, stack(0x000000011d573000,0x000000011d673000)] + 0x00007faf85800000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=20739, stack(0x000000011d470000,0x000000011d570000)] + 0x00007faf83027000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=20227, stack(0x000000011d36d000,0x000000011d46d000)] + 0x00007faf83026000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=19715, stack(0x000000011d26a000,0x000000011d36a000)] + 0x00007faf83021000 JavaThread "Finalizer" daemon [_thread_blocked, id=14595, stack(0x000000011d01e000,0x000000011d11e000)] + 0x00007faf85000000 JavaThread "Reference Handler" daemon [_thread_blocked, id=14083, stack(0x000000011cf1b000,0x000000011d01b000)] +=>0x00007faf8300f000 JavaThread "main" [_thread_in_native, id=3335, stack(0x000000010dc54000,0x000000010dd54000)] + +Other Threads: + 0x00007faf84041800 VMThread [stack: 0x000000011ce18000,0x000000011cf18000] [id=13571] + 0x00007faf85809800 WatcherThread [stack: 0x000000011d676000,0x000000011d776000] [id=21763] + +VM state:not at safepoint (normal execution) + +VM Mutex/Monitor currently owned by a thread: None + +Heap + PSYoungGen total 76800K, used 14563K [0x00000007aaa80000, 0x00000007b0000000, 0x0000000800000000) + eden space 66048K, 22% used [0x00000007aaa80000,0x00000007ab8b8f28,0x00000007aeb00000) + from space 10752K, 0% used [0x00000007af580000,0x00000007af580000,0x00000007b0000000) + to space 10752K, 0% used [0x00000007aeb00000,0x00000007aeb00000,0x00000007af580000) + ParOldGen total 174592K, used 0K [0x0000000700000000, 0x000000070aa80000, 0x00000007aaa80000) + object space 174592K, 0% used [0x0000000700000000,0x0000000700000000,0x000000070aa80000) + PSPermGen total 21504K, used 4307K [0x00000006fae00000, 0x00000006fc300000, 0x0000000700000000) + object space 21504K, 20% used [0x00000006fae00000,0x00000006fb234de0,0x00000006fc300000) + +Card table byte_map: [0x0000000110e16000,0x0000000111640000] byte_map_base: 0x000000010d63f000 + +Polling page: 0x000000010c1e7000 + +Code Cache [0x000000010dd56000, 0x000000010dfc6000, 0x0000000110d56000) + total_blobs=321 nmethods=106 adapters=169 free_code_cache=48564Kb largest_free_block=49703744 + +Compilation events (10 events): +Event: 0.639 Thread 0x00007faf83027000 102 java.util.regex.Pattern$Single::isSatisfiedBy (14 bytes) +Event: 0.639 Thread 0x00007faf83027000 nmethod 102 0x000000010dde1250 code [0x000000010dde1380, 0x000000010dde13f8] +Event: 0.640 Thread 0x00007faf85800000 nmethod 101 0x000000010dde2450 code [0x000000010dde25c0, 0x000000010dde2908] +Event: 0.642 Thread 0x00007faf83027000 103 java.util.Formatter::checkText (58 bytes) +Event: 0.645 Thread 0x00007faf83027000 nmethod 103 0x000000010dde0d90 code [0x000000010dde0ee0, 0x000000010dde1108] +Event: 0.646 Thread 0x00007faf85800000 104 java.lang.Class::privateGetDeclaredFields (113 bytes) +Event: 0.650 Thread 0x00007faf85800000 nmethod 104 0x000000010dde1a50 code [0x000000010dde1c20, 0x000000010dde2090] +Event: 0.651 Thread 0x00007faf83027000 105 java.util.WeakHashMap::containsKey (14 bytes) +Event: 0.655 Thread 0x00007faf83027000 nmethod 105 0x000000010ddeb690 code [0x000000010ddeb800, 0x000000010ddeba88] +Event: 0.657 Thread 0x00007faf85800000 106 java.lang.Class::searchMethods (90 bytes) + +GC Heap History (0 events): +No events + +Deoptimization events (6 events): +Event: 0.462 Thread 0x00007faf8300f000 Uncommon trap: reason=bimorphic action=maybe_recompile pc=0x000000010ddcc504 method=java.util.HashMap.getEntry(Ljava/lang/Object;)Ljava/util/HashMap$Entry; @ 68 +Event: 0.492 Thread 0x00007faf8300f000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x000000010ddd5cd4 method=com.sun.jna.Native.getNativeSize(Ljava/lang/Class;Ljava/lang/Object;)I @ 64 +Event: 0.515 Thread 0x00007faf8300f000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x000000010ddd2c6c method=com.sun.jna.Native.getNativeSize(Ljava/lang/Class;)I @ 4 +Event: 0.558 Thread 0x00007faf8300f000 Uncommon trap: reason=bimorphic action=maybe_recompile pc=0x000000010ddcc504 method=java.util.HashMap.getEntry(Ljava/lang/Object;)Ljava/util/HashMap$Entry; @ 68 +Event: 0.578 Thread 0x00007faf8300f000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x000000010dddd3ac method=com.sun.jna.Structure.size(Ljava/lang/Class;Lcom/sun/jna/Structure;)I @ 15 +Event: 0.587 Thread 0x00007faf8300f000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x000000010dde3eb0 method=com.sun.jna.Structure.size(Ljava/lang/Class;Lcom/sun/jna/Structure;)I @ 15 + +Internal exceptions (10 events): +Event: 0.213 Thread 0x00007faf8300f000 Threw 0x00000007aad807a0 at /HUDSON/workspace/7u-2-build-macosx-x86_64/jdk7u45/229/hotspot/src/share/vm/prims/jvm.cpp:1244 +Event: 0.215 Thread 0x00007faf8300f000 Threw 0x00000007aad8dbe8 at /HUDSON/workspace/7u-2-build-macosx-x86_64/jdk7u45/229/hotspot/src/share/vm/prims/jvm.cpp:1244 +Event: 0.216 Thread 0x00007faf8300f000 Threw 0x00000007aad8f9c8 at /HUDSON/workspace/7u-2-build-macosx-x86_64/jdk7u45/229/hotspot/src/share/vm/prims/jvm.cpp:1244 +Event: 0.216 Thread 0x00007faf8300f000 Threw 0x00000007aad91960 at /HUDSON/workspace/7u-2-build-macosx-x86_64/jdk7u45/229/hotspot/src/share/vm/prims/jvm.cpp:1244 +Event: 0.217 Thread 0x00007faf8300f000 Threw 0x00000007aad95178 at /HUDSON/workspace/7u-2-build-macosx-x86_64/jdk7u45/229/hotspot/src/share/vm/prims/jvm.cpp:1244 +Event: 0.217 Thread 0x00007faf8300f000 Threw 0x00000007aad98ba8 at /HUDSON/workspace/7u-2-build-macosx-x86_64/jdk7u45/229/hotspot/src/share/vm/prims/jvm.cpp:1244 +Event: 0.492 Thread 0x00007faf8300f000 Implicit null exception at 0x000000010ddd513b to 0x000000010ddd5cc1 +Event: 0.515 Thread 0x00007faf8300f000 Implicit null exception at 0x000000010ddd2913 to 0x000000010ddd2c5d +Event: 0.578 Thread 0x00007faf8300f000 Implicit null exception at 0x000000010dddca63 to 0x000000010dddd3a1 +Event: 0.587 Thread 0x00007faf8300f000 Implicit null exception at 0x000000010dde3563 to 0x000000010dde3ea5 + +Events (10 events): +Event: 0.515 Thread 0x00007faf8300f000 DEOPT UNPACKING pc=0x000000010dd8f045 sp=0x000000010dd52be0 mode 2 +Event: 0.558 Thread 0x00007faf8300f000 Uncommon trap: trap_request=0xffffffc6 fr.pc=0x000000010ddcc504 +Event: 0.558 Thread 0x00007faf8300f000 DEOPT PACKING pc=0x000000010ddcc504 sp=0x000000010dd53600 +Event: 0.558 Thread 0x00007faf8300f000 DEOPT UNPACKING pc=0x000000010dd8f045 sp=0x000000010dd535c8 mode 2 +Event: 0.578 Thread 0x00007faf8300f000 Uncommon trap: trap_request=0xfffffff4 fr.pc=0x000000010dddd3ac +Event: 0.578 Thread 0x00007faf8300f000 DEOPT PACKING pc=0x000000010dddd3ac sp=0x000000010dd527a0 +Event: 0.578 Thread 0x00007faf8300f000 DEOPT UNPACKING pc=0x000000010dd8f045 sp=0x000000010dd52680 mode 2 +Event: 0.587 Thread 0x00007faf8300f000 Uncommon trap: trap_request=0xfffffff4 fr.pc=0x000000010dde3eb0 +Event: 0.587 Thread 0x00007faf8300f000 DEOPT PACKING pc=0x000000010dde3eb0 sp=0x000000010dd52740 +Event: 0.587 Thread 0x00007faf8300f000 DEOPT UNPACKING pc=0x000000010dd8f045 sp=0x000000010dd52680 mode 2 + + +Dynamic libraries: +0x000000000adb7000 /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa +0x000000000adb7000 /System/Library/Frameworks/Security.framework/Versions/A/Security +0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices +0x000000000adb7000 /usr/lib/libz.1.dylib +0x000000000adb7000 /usr/lib/libSystem.B.dylib +0x000000000adb7000 /usr/lib/libobjc.A.dylib +0x000000000adb7000 /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0x000000000adb7000 /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation +0x000000000adb7000 /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x000000000adb7000 /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData +0x000000000adb7000 /System/Library/PrivateFrameworks/RemoteViewServices.framework/Versions/A/RemoteViewServices +0x000000000adb7000 /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox +0x000000000adb7000 /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit +0x000000000adb7000 /System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/DataDetectorsCore +0x000000000adb7000 /System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv +0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox +0x000000000adb7000 /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore +0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SpeechRecognition.framework/Versions/A/SpeechRecognition +0x000000000adb7000 /usr/lib/libauto.dylib +0x000000000adb7000 /usr/lib/libicucore.A.dylib +0x000000000adb7000 /usr/lib/libxml2.2.dylib +0x000000000adb7000 /System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI +0x000000000adb7000 /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio +0x000000000adb7000 /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration +0x000000000adb7000 /usr/lib/liblangid.dylib +0x000000000adb7000 /System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport +0x000000000adb7000 /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit +0x000000000adb7000 /usr/lib/libDiagnosticMessagesClient.dylib +0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices +0x000000000adb7000 /System/Library/PrivateFrameworks/PerformanceAnalysis.framework/Versions/A/PerformanceAnalysis +0x000000000adb7000 /System/Library/PrivateFrameworks/GenerationalStorage.framework/Versions/A/GenerationalStorage +0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL +0x000000000adb7000 /System/Library/PrivateFrameworks/Sharing.framework/Versions/A/Sharing +0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO +0x000000000adb7000 /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText +0x000000000adb7000 /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics +0x000000000adb7000 /System/Library/PrivateFrameworks/Backup.framework/Versions/A/Backup +0x000000000adb7000 /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork +0x000000000adb7000 /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration +0x000000000adb7000 /usr/lib/libCRFSuite.dylib +0x000000000adb7000 /usr/lib/libc++.1.dylib +0x000000000adb7000 /usr/lib/libc++abi.dylib +0x000000000adb7000 /usr/lib/system/libcache.dylib +0x000000000adb7000 /usr/lib/system/libcommonCrypto.dylib +0x000000000adb7000 /usr/lib/system/libcompiler_rt.dylib +0x000000000adb7000 /usr/lib/system/libcopyfile.dylib +0x000000000adb7000 /usr/lib/system/libcorecrypto.dylib +0x000000000adb7000 /usr/lib/system/libdispatch.dylib +0x000000000adb7000 /usr/lib/system/libdyld.dylib +0x000000000adb7000 /usr/lib/system/libkeymgr.dylib +0x000000000adb7000 /usr/lib/system/liblaunch.dylib +0x000000000adb7000 /usr/lib/system/libmacho.dylib +0x000000000adb7000 /usr/lib/system/libquarantine.dylib +0x000000000adb7000 /usr/lib/system/libremovefile.dylib +0x000000000adb7000 /usr/lib/system/libsystem_asl.dylib +0x000000000adb7000 /usr/lib/system/libsystem_blocks.dylib +0x000000000adb7000 /usr/lib/system/libsystem_c.dylib +0x000000000adb7000 /usr/lib/system/libsystem_configuration.dylib +0x000000000adb7000 /usr/lib/system/libsystem_dnssd.dylib +0x000000000adb7000 /usr/lib/system/libsystem_info.dylib +0x000000000adb7000 /usr/lib/system/libsystem_kernel.dylib +0x000000000adb7000 /usr/lib/system/libsystem_m.dylib +0x000000000adb7000 /usr/lib/system/libsystem_malloc.dylib +0x000000000adb7000 /usr/lib/system/libsystem_network.dylib +0x000000000adb7000 /usr/lib/system/libsystem_notify.dylib +0x000000000adb7000 /usr/lib/system/libsystem_platform.dylib +0x000000000adb7000 /usr/lib/system/libsystem_pthread.dylib +0x000000000adb7000 /usr/lib/system/libsystem_sandbox.dylib +0x000000000adb7000 /usr/lib/system/libsystem_stats.dylib +0x000000000adb7000 /usr/lib/system/libunc.dylib +0x000000000adb7000 /usr/lib/system/libunwind.dylib +0x000000000adb7000 /usr/lib/system/libxpc.dylib +0x000000000adb7000 /usr/lib/libbsm.0.dylib +0x000000000adb7000 /usr/lib/libsqlite3.dylib +0x000000000adb7000 /usr/lib/libxar.1.dylib +0x000000000adb7000 /usr/lib/libpam.2.dylib +0x000000000adb7000 /usr/lib/libOpenScriptingUtil.dylib +0x000000000adb7000 /usr/lib/libbz2.1.0.dylib +0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore +0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata +0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices +0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit +0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE +0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices +0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices +0x000000000adb7000 /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS +0x000000000adb7000 /usr/lib/system/libkxld.dylib +0x000000000adb7000 /System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth +0x000000000adb7000 /System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC +0x000000000adb7000 /System/Library/Frameworks/OpenDirectory.framework/Versions/A/Frameworks/CFOpenDirectory.framework/Versions/A/CFOpenDirectory +0x000000000adb7000 /System/Library/Frameworks/ServiceManagement.framework/Versions/A/ServiceManagement +0x000000000adb7000 /usr/lib/libxslt.1.dylib +0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Ink.framework/Versions/A/Ink +0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS +0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ColorSync.framework/Versions/A/ColorSync +0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices +0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis +0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/PrintCore +0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/QD +0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis +0x000000000adb7000 /System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface +0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate +0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage +0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib +0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib +0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib +0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib +0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib +0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Resources/libFontParser.dylib +0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Resources/libFontRegistry.dylib +0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib +0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib +0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib +0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libGIF.dylib +0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJP2.dylib +0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libRadiance.dylib +0x000000000adb7000 /usr/lib/libcups.2.dylib +0x000000000adb7000 /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos +0x000000000adb7000 /System/Library/Frameworks/GSS.framework/Versions/A/GSS +0x000000000adb7000 /usr/lib/libresolv.9.dylib +0x000000000adb7000 /usr/lib/libiconv.2.dylib +0x000000000adb7000 /System/Library/PrivateFrameworks/Heimdal.framework/Versions/A/Heimdal +0x000000000adb7000 /System/Library/PrivateFrameworks/TrustEvaluationAgent.framework/Versions/A/TrustEvaluationAgent +0x000000000adb7000 /usr/lib/libheimdal-asn1.dylib +0x000000000adb7000 /System/Library/Frameworks/OpenDirectory.framework/Versions/A/OpenDirectory +0x000000000adb7000 /System/Library/PrivateFrameworks/CommonAuth.framework/Versions/A/CommonAuth +0x000000000adb7000 /System/Library/Frameworks/SecurityFoundation.framework/Versions/A/SecurityFoundation +0x000000000adb7000 /System/Library/PrivateFrameworks/Bom.framework/Versions/A/Bom +0x000000000adb7000 /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo +0x000000000adb7000 /System/Library/Frameworks/QuartzCore.framework/Versions/A/Frameworks/CoreImage.framework/Versions/A/CoreImage +0x000000000adb7000 /System/Library/Frameworks/QuartzCore.framework/Versions/A/Frameworks/ScalableUserInterface.framework/Versions/A/ScalableUserInterface +0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib +0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGFXShared.dylib +0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib +0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLImage.dylib +0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCVMSPluginSupport.dylib +0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCoreVMClient.dylib +0x000000000adb7000 /System/Library/PrivateFrameworks/FaceCore.framework/Versions/A/FaceCore +0x000000000adb7000 /System/Library/PrivateFrameworks/CrashReporterSupport.framework/Versions/A/CrashReporterSupport +0x000000000adb7000 /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL +0x000000000adb7000 /System/Library/PrivateFrameworks/AppleFSCompression.framework/Versions/A/AppleFSCompression +0x000000000adb7000 /System/Library/PrivateFrameworks/Ubiquity.framework/Versions/A/Ubiquity +0x000000000adb7000 /System/Library/PrivateFrameworks/IconServices.framework/Versions/A/IconServices +0x000000000adb7000 /System/Library/PrivateFrameworks/ChunkingLibrary.framework/Versions/A/ChunkingLibrary +0x000000000adb7000 /System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/CoreSymbolication +0x000000000adb7000 /System/Library/PrivateFrameworks/Symbolication.framework/Versions/A/Symbolication +0x000000000adb7000 /System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols +0x000000010d200000 /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/server/libjvm.dylib +0x000000000adb7000 /usr/lib/libstdc++.6.dylib +0x000000010c1aa000 /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/libverify.dylib +0x000000010c1b7000 /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/libjava.dylib +0x000000010c1f1000 /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/libzip.dylib +0x000000011d120000 /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/JavaRuntimeSupport +0x000000011d138000 /System/Library/Frameworks/JavaVM.framework/Versions/A/Frameworks/JavaNativeFoundation.framework/Versions/A/JavaNativeFoundation +0x000000011d14c000 /System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM +0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon +0x000000011d158000 /System/Library/PrivateFrameworks/JavaLaunching.framework/Versions/A/JavaLaunching +0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CommonPanels.framework/Versions/A/CommonPanels +0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Help.framework/Versions/A/Help +0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/ImageCapture.framework/Versions/A/ImageCapture +0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/OpenScripting.framework/Versions/A/OpenScripting +0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Print.framework/Versions/A/Print +0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SecurityHI.framework/Versions/A/SecurityHI +0x000000011d7a7000 /private/var/folders/l0/y303fs4d2y793wwykskdtcc80000gn/T/jna-1437842033/jna6952186334369576447.tmp +0x000000011d7bc000 /usr/lib/libcapstone.dylib + +VM Arguments: +java_command: TestX86 +Launcher Type: SUN_STANDARD + +Environment Variables: +PATH=/Users/danghvu/.rvm/gems/ruby-1.8.7-p374/bin:/Users/danghvu/.rvm/gems/ruby-1.8.7-p374@global/bin:/Users/danghvu/.rvm/rubies/ruby-1.8.7-p374/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/usr/texbin:/usr/local/homebrew/bin/:/Users/danghvu/opt/bin:/Users/danghvu/.rvm/bin:/Users/danghvu/.rvm/bin +LD_LIBRARY_PATH=:/Users/danghvu/opt/lib +SHELL=/bin/bash +DISPLAY=/tmp/launch-LKpOvb/org.macosforge.xquartz:0 + +Signal Handlers: +SIGSEGV: [libjvm.dylib+0x525415], sa_mask[0]=0xfffefeff, sa_flags=0x00000043 +SIGBUS: [libjvm.dylib+0x525415], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 +SIGFPE: [libjvm.dylib+0x41891a], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 +SIGPIPE: [libjvm.dylib+0x41891a], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 +SIGXFSZ: [libjvm.dylib+0x41891a], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 +SIGILL: [libjvm.dylib+0x41891a], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 +SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000 +SIGUSR2: [libjvm.dylib+0x41840c], sa_mask[0]=0x00000000, sa_flags=0x00000042 +SIGHUP: [libjvm.dylib+0x41669b], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 +SIGINT: [libjvm.dylib+0x41669b], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 +SIGTERM: [libjvm.dylib+0x41669b], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 +SIGQUIT: [libjvm.dylib+0x41669b], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 + + +--------------- S Y S T E M --------------- + +OS:Bsduname:Darwin 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64 +rlimit: STACK 65532k, CORE 0k, NPROC 709, NOFILE 10240, AS infinity +load average:1.31 1.45 1.60 + +CPU:total 8 (4 cores per cpu, 2 threads per core) family 6 model 42 stepping 7, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, aes, ht, tsc, tscinvbit + +Memory: 4k page, physical 16777216k(4194304k free) + +/proc/meminfo: + + +vm_info: Java HotSpot(TM) 64-Bit Server VM (24.45-b08) for bsd-amd64 JRE (1.7.0_45-b18), built on Oct 8 2013 05:54:16 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) + +time: Sat Sep 27 14:53:38 2014 +elapsed time: 0 seconds + diff --git a/bindings/java/run.sh b/bindings/java/run.sh index 954af978..18b0b25b 100755 --- a/bindings/java/run.sh +++ b/bindings/java/run.sh @@ -16,6 +16,7 @@ case "$1" in "arm64") java -classpath ${JNA}:. TestArm64 ;; "mips") java -classpath ${JNA}:. TestMips ;; "x86") java -classpath ${JNA}:. TestX86 ;; + "xcore") java -classpath ${JNA}:. TestXcore; ;; "ppc") java -classpath ${JNA}:. TestPpc ;; "sparc") java -classpath ${JNA}:. TestSparc ;; "systemz") java -classpath ${JNA}:. TestSystemz ;; From ef92cdb9183aed81001b63b5baa0ed39435f4dea Mon Sep 17 00:00:00 2001 From: danghvu Date: Sat, 27 Sep 2014 17:53:49 -0500 Subject: [PATCH 2/3] Update java binding to v3 --- bindings/java/TestArm.java | 43 ++- bindings/java/TestArm64.java | 20 +- bindings/java/TestPpc.java | 2 +- bindings/java/capstone/Arm.java | 42 ++- bindings/java/capstone/Capstone.java | 16 +- bindings/java/capstone/X86.java | 11 +- bindings/java/hs_err_pid17060.log | 402 --------------------------- 7 files changed, 102 insertions(+), 434 deletions(-) delete mode 100644 bindings/java/hs_err_pid17060.log diff --git a/bindings/java/TestArm.java b/bindings/java/TestArm.java index a43b9a3c..711828c0 100644 --- a/bindings/java/TestArm.java +++ b/bindings/java/TestArm.java @@ -19,10 +19,10 @@ public class TestArm { return data; } - static final String ARM_CODE = "EDFFFFEB04e02de500000000e08322e5f102030e0000a0e30230c1e7000053e3"; + static final String ARM_CODE = "EDFFFFEB04e02de500000000e08322e5f102030e0000a0e30230c1e7000053e3000201f10540d0e8"; static final String ARM_CODE2 = "d1e800f0f02404071f3cf2c000004ff00001466c"; - static final String THUMB_CODE2 = "4ff00001bde80088d1e800f0"; - static final String THUMB_CODE = "7047eb4683b0c9681fb1"; + static final String THUMB_CODE2 = "4ff00001bde80088d1e800f018bfadbff3ff0b0c86f3008980f3008c4ffa99f6d0ffa201"; + static final String THUMB_CODE = "7047eb4683b0c9681fb130bfaff32084"; public static Capstone cs; @@ -44,6 +44,8 @@ public class TestArm { for (int c=0; c 0) + System.out.printf("\t\t\toperands[%d].vector_index = %d\n", c, (i.vector_index)); if (i.shift.type != ARM_SFT_INVALID && i.shift.value > 0) - System.out.printf("\t\t\tShift: type = %d, value = %d\n", i.shift.type, i.shift.value); + System.out.printf("\t\t\tShift: %d = %d\n", i.shift.type, i.shift.value); } - if (operands.writeback) - System.out.println("\tWrite-back: True"); + } + if (operands.writeback) + System.out.println("\tWrite-back: True"); - if (operands.updateFlags) - System.out.println("\tUpdate-flags: True"); + if (operands.updateFlags) + System.out.println("\tUpdate-flags: True"); - if (operands.cc != ARM_CC_AL && operands.cc != ARM_CC_INVALID) - System.out.printf("\tCode condition: %d\n", operands.cc); - } + if (operands.cc != ARM_CC_AL && operands.cc != ARM_CC_INVALID) + System.out.printf("\tCode condition: %d\n", operands.cc); + + if (operands.cpsMode > 0) + System.out.printf("\tCPSI-mode: %d\n", operands.cpsMode); + + if (operands.cpsFlag > 0) + System.out.printf("\tCPSI-flag: %d\n", operands.cpsFlag); + + if (operands.vectorData > 0) + System.out.printf("\tVector-data: %d\n", operands.vectorData); + + if (operands.vectorSize > 0) + System.out.printf("\tVector-size: %d\n", operands.vectorSize); + + if (operands.usermode) + System.out.printf("\tUser-mode: True\n"); } public static void main(String argv[]) { diff --git a/bindings/java/TestArm64.java b/bindings/java/TestArm64.java index b81f3d3d..be9eb872 100644 --- a/bindings/java/TestArm64.java +++ b/bindings/java/TestArm64.java @@ -19,7 +19,7 @@ public class TestArm64 { return data; } - static final String ARM64_CODE = "217c029b217c00530040214be10b40b9200481da2008028b"; + static final String ARM64_CODE = "090038d5bf4000d50c0513d52050020e20e43d0f0018a05fa200ae9e9f3703d5bf3303d5df3f03d5217c029b217c00530040214be10b40b9200481da2008028b105be83c"; public static Capstone cs; @@ -43,6 +43,15 @@ public class TestArm64 { String imm = hex(i.value.imm); if (i.type == ARM64_OP_REG) System.out.printf("\t\toperands[%d].type: REG = %s\n", c, ins.regName(i.value.reg)); + if (i.type == ARM64_OP_REG_MRS) + System.out.printf("\t\toperands[%d].type: REG_MRS = 0x%x\n", c, i.value.reg); + if (i.type == ARM64_OP_REG_MSR) + System.out.printf("\t\toperands[%d].type: REG_MSR = 0x%x\n", c, i.value.reg); + if (i.type == ARM64_OP_PSTATE) + System.out.printf("\t\toperands[%d].type: PSTATE = 0x%x\n", c, i.value.imm); + if (i.type == ARM64_OP_BARRIER) + System.out.printf("\t\toperands[%d].type: BARRIER = 0x%x\n", c, i.value.imm); + if (i.type == ARM64_OP_IMM) System.out.printf("\t\toperands[%d].type: IMM = 0x%x\n", c, i.value.imm); if (i.type == ARM64_OP_CIMM) @@ -64,6 +73,13 @@ public class TestArm64 { System.out.printf("\t\t\tShift: type = %d, value = %d\n", i.shift.type, i.shift.value); if (i.ext != ARM64_EXT_INVALID) System.out.printf("\t\t\tExt: %d\n", i.ext); + if (i.vas != ARM64_VAS_INVALID) + System.out.printf("\t\t\tVector Arrangement Specifier: 0x%x\n", i.vas); + if (i.vess != ARM64_VESS_INVALID) + System.out.printf("\t\t\tVector Element Size Specifier: %d\n", i.vess); + if (i.vector_index != -1) + System.out.printf("\t\t\tVector Index: %d\n", i.vector_index); + } } @@ -74,7 +90,7 @@ public class TestArm64 { System.out.println("\tUpdate-flags: True"); if (operands.cc != ARM64_CC_AL && operands.cc != ARM64_CC_INVALID) - System.out.printf("\tCode condition: %d\n", operands.cc); + System.out.printf("\tCode-condition: %d\n", operands.cc); } diff --git a/bindings/java/TestPpc.java b/bindings/java/TestPpc.java index 48432a07..2bec2dce 100644 --- a/bindings/java/TestPpc.java +++ b/bindings/java/TestPpc.java @@ -19,7 +19,7 @@ public class TestPpc { return data; } - static final String PPC_CODE = "80200000803f00001043230ed04400804c4322022d0300807c4320147c4320934f2000214cc80021"; + static final String PPC_CODE = "80200000803f00001043230ed04400804c4322022d0300807c4320147c4320934f2000214cc8002140820014"; public static Capstone cs; diff --git a/bindings/java/capstone/Arm.java b/bindings/java/capstone/Arm.java index bca536e1..bf30853a 100644 --- a/bindings/java/capstone/Arm.java +++ b/bindings/java/capstone/Arm.java @@ -30,10 +30,11 @@ public class Arm { public int imm; public double fp; public MemType mem; + public int setend; @Override public List getFieldOrder() { - return Arrays.asList("reg", "imm", "fp", "mem"); + return Arrays.asList("reg", "imm", "fp", "mem", "setend"); } } @@ -48,11 +49,13 @@ public class Arm { } public static class Operand extends Structure { + public int vector_index; public OpShift shift; public int type; public OpValue value; public void read() { + readField("vector_index"); readField("type"); if (type == ARM_OP_MEM) value.setType(MemType.class); @@ -70,14 +73,19 @@ public class Arm { @Override public List getFieldOrder() { - return Arrays.asList("shift", "type", "value"); + return Arrays.asList("vector_index", "shift", "type", "value"); } } public static class UnionOpInfo extends Capstone.UnionOpInfo { + public boolean usermode; + public int vector_size; + public int vector_data; + public int cps_mode; + public int cps_flag; public int cc; - public byte _update_flags; - public byte _writeback; + public byte update_flags; + public byte writeback; public byte op_count; public Operand [] op; @@ -87,9 +95,14 @@ public class Arm { } public void read() { + readField("usermode"); + readField("vector_size"); + readField("vector_data"); + readField("cps_mode"); + readField("cps_flag"); readField("cc"); - readField("_update_flags"); - readField("_writeback"); + readField("update_flags"); + readField("writeback"); readField("op_count"); op = new Operand[op_count]; if (op_count != 0) @@ -98,20 +111,31 @@ public class Arm { @Override public List getFieldOrder() { - return Arrays.asList("cc", "_update_flags", "_writeback", "op_count", "op"); + return Arrays.asList("usermode", "vector_size", "vector_data", + "cps_mode", "cps_flag", "cc", "update_flags", "writeback", "op_count", "op"); } } public static class OpInfo extends Capstone.OpInfo { + public boolean usermode; + public int vectorSize; + public int vectorData; + public int cpsMode; + public int cpsFlag; public int cc; public boolean updateFlags; public boolean writeback; public Operand [] op = null; public OpInfo(UnionOpInfo op_info) { + usermode = op_info.usermode; + vectorSize = op_info.vector_size; + vectorData = op_info.vector_data; + cpsMode = op_info.cps_mode; + cpsFlag = op_info.cps_flag; cc = op_info.cc; - updateFlags = (op_info._update_flags > 0); - writeback = (op_info._writeback > 0); + updateFlags = (op_info.update_flags > 0); + writeback = (op_info.writeback > 0); op = op_info.op; } } diff --git a/bindings/java/capstone/Capstone.java b/bindings/java/capstone/Capstone.java index b940c098..aeb3d436 100644 --- a/bindings/java/capstone/Capstone.java +++ b/bindings/java/capstone/Capstone.java @@ -47,14 +47,16 @@ public class Capstone { // instruction mnemonic. NOTE: irrelevant for diet engine. public byte[] mnemonic; // instruction operands. NOTE: irrelevant for diet engine. - public byte[] operands; + public byte[] op_str; // detail information of instruction. public _cs_detail.ByReference cs_detail; public _cs_insn() { bytes = new byte[16]; mnemonic = new byte[32]; - operands = new byte[160]; + op_str = new byte[160]; + java.util.Arrays.fill(mnemonic, (byte) 0); + java.util.Arrays.fill(op_str, (byte) 0); } public _cs_insn(Pointer p) { @@ -65,7 +67,7 @@ public class Capstone { @Override public List getFieldOrder() { - return Arrays.asList("id", "address", "size", "bytes", "mnemonic", "operands", "cs_detail"); + return Arrays.asList("id", "address", "size", "bytes", "mnemonic", "op_str", "cs_detail"); } } @@ -120,8 +122,12 @@ public class Capstone { size = insn.size; if (!diet) { - mnemonic = new String(insn.mnemonic).replace("\u0000",""); - opStr = new String(insn.operands).replace("\u0000",""); + int lm = 0; + while (insn.mnemonic[lm++] != 0); + int lo = 0; + while (insn.op_str[lo++] != 0); + mnemonic = new String(insn.mnemonic, 0, lm-1); + opStr = new String(insn.op_str, 0, lo-1); } cs = _cs; diff --git a/bindings/java/capstone/X86.java b/bindings/java/capstone/X86.java index 2ed15454..8f69ee1f 100644 --- a/bindings/java/capstone/X86.java +++ b/bindings/java/capstone/X86.java @@ -41,7 +41,7 @@ public class X86 { public static class Operand extends Structure { public int type; public OpValue value; - public int size; + public byte size; public int avx_bcast; public boolean avx_zero_opmask; @@ -79,10 +79,10 @@ public class X86 { public int sib_base; public int sse_cc; public int avx_cc; - public boolean avx_sae; + public byte avx_sae; public int avx_rm; - public char op_count; + public byte op_count; public Operand [] op; @@ -103,6 +103,7 @@ public class X86 { public byte [] prefix; public byte [] opcode; public byte opSize; + public byte rex; public byte addrSize; public byte dispSize; public byte immSize; @@ -114,6 +115,8 @@ public class X86 { public int sibBase; public int sseCC; public int avxCC; + public boolean avxSae; + public int avxRm; public Operand[] op; @@ -130,7 +133,7 @@ public class X86 { sibBase = e.sib_base; sseCC = e.sse_cc; avxCC = e.avx_cc; - avxSae = e.avx_sae; + avxSae = e.avx_sae > 0; avxRm = e.avx_rm; op = new Operand[e.op_count]; for (int i=0; i current thread ) - 0x00007faf85801000 JavaThread "Service Thread" daemon [_thread_blocked, id=21251, stack(0x000000011d573000,0x000000011d673000)] - 0x00007faf85800000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=20739, stack(0x000000011d470000,0x000000011d570000)] - 0x00007faf83027000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=20227, stack(0x000000011d36d000,0x000000011d46d000)] - 0x00007faf83026000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=19715, stack(0x000000011d26a000,0x000000011d36a000)] - 0x00007faf83021000 JavaThread "Finalizer" daemon [_thread_blocked, id=14595, stack(0x000000011d01e000,0x000000011d11e000)] - 0x00007faf85000000 JavaThread "Reference Handler" daemon [_thread_blocked, id=14083, stack(0x000000011cf1b000,0x000000011d01b000)] -=>0x00007faf8300f000 JavaThread "main" [_thread_in_native, id=3335, stack(0x000000010dc54000,0x000000010dd54000)] - -Other Threads: - 0x00007faf84041800 VMThread [stack: 0x000000011ce18000,0x000000011cf18000] [id=13571] - 0x00007faf85809800 WatcherThread [stack: 0x000000011d676000,0x000000011d776000] [id=21763] - -VM state:not at safepoint (normal execution) - -VM Mutex/Monitor currently owned by a thread: None - -Heap - PSYoungGen total 76800K, used 14563K [0x00000007aaa80000, 0x00000007b0000000, 0x0000000800000000) - eden space 66048K, 22% used [0x00000007aaa80000,0x00000007ab8b8f28,0x00000007aeb00000) - from space 10752K, 0% used [0x00000007af580000,0x00000007af580000,0x00000007b0000000) - to space 10752K, 0% used [0x00000007aeb00000,0x00000007aeb00000,0x00000007af580000) - ParOldGen total 174592K, used 0K [0x0000000700000000, 0x000000070aa80000, 0x00000007aaa80000) - object space 174592K, 0% used [0x0000000700000000,0x0000000700000000,0x000000070aa80000) - PSPermGen total 21504K, used 4307K [0x00000006fae00000, 0x00000006fc300000, 0x0000000700000000) - object space 21504K, 20% used [0x00000006fae00000,0x00000006fb234de0,0x00000006fc300000) - -Card table byte_map: [0x0000000110e16000,0x0000000111640000] byte_map_base: 0x000000010d63f000 - -Polling page: 0x000000010c1e7000 - -Code Cache [0x000000010dd56000, 0x000000010dfc6000, 0x0000000110d56000) - total_blobs=321 nmethods=106 adapters=169 free_code_cache=48564Kb largest_free_block=49703744 - -Compilation events (10 events): -Event: 0.639 Thread 0x00007faf83027000 102 java.util.regex.Pattern$Single::isSatisfiedBy (14 bytes) -Event: 0.639 Thread 0x00007faf83027000 nmethod 102 0x000000010dde1250 code [0x000000010dde1380, 0x000000010dde13f8] -Event: 0.640 Thread 0x00007faf85800000 nmethod 101 0x000000010dde2450 code [0x000000010dde25c0, 0x000000010dde2908] -Event: 0.642 Thread 0x00007faf83027000 103 java.util.Formatter::checkText (58 bytes) -Event: 0.645 Thread 0x00007faf83027000 nmethod 103 0x000000010dde0d90 code [0x000000010dde0ee0, 0x000000010dde1108] -Event: 0.646 Thread 0x00007faf85800000 104 java.lang.Class::privateGetDeclaredFields (113 bytes) -Event: 0.650 Thread 0x00007faf85800000 nmethod 104 0x000000010dde1a50 code [0x000000010dde1c20, 0x000000010dde2090] -Event: 0.651 Thread 0x00007faf83027000 105 java.util.WeakHashMap::containsKey (14 bytes) -Event: 0.655 Thread 0x00007faf83027000 nmethod 105 0x000000010ddeb690 code [0x000000010ddeb800, 0x000000010ddeba88] -Event: 0.657 Thread 0x00007faf85800000 106 java.lang.Class::searchMethods (90 bytes) - -GC Heap History (0 events): -No events - -Deoptimization events (6 events): -Event: 0.462 Thread 0x00007faf8300f000 Uncommon trap: reason=bimorphic action=maybe_recompile pc=0x000000010ddcc504 method=java.util.HashMap.getEntry(Ljava/lang/Object;)Ljava/util/HashMap$Entry; @ 68 -Event: 0.492 Thread 0x00007faf8300f000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x000000010ddd5cd4 method=com.sun.jna.Native.getNativeSize(Ljava/lang/Class;Ljava/lang/Object;)I @ 64 -Event: 0.515 Thread 0x00007faf8300f000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x000000010ddd2c6c method=com.sun.jna.Native.getNativeSize(Ljava/lang/Class;)I @ 4 -Event: 0.558 Thread 0x00007faf8300f000 Uncommon trap: reason=bimorphic action=maybe_recompile pc=0x000000010ddcc504 method=java.util.HashMap.getEntry(Ljava/lang/Object;)Ljava/util/HashMap$Entry; @ 68 -Event: 0.578 Thread 0x00007faf8300f000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x000000010dddd3ac method=com.sun.jna.Structure.size(Ljava/lang/Class;Lcom/sun/jna/Structure;)I @ 15 -Event: 0.587 Thread 0x00007faf8300f000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x000000010dde3eb0 method=com.sun.jna.Structure.size(Ljava/lang/Class;Lcom/sun/jna/Structure;)I @ 15 - -Internal exceptions (10 events): -Event: 0.213 Thread 0x00007faf8300f000 Threw 0x00000007aad807a0 at /HUDSON/workspace/7u-2-build-macosx-x86_64/jdk7u45/229/hotspot/src/share/vm/prims/jvm.cpp:1244 -Event: 0.215 Thread 0x00007faf8300f000 Threw 0x00000007aad8dbe8 at /HUDSON/workspace/7u-2-build-macosx-x86_64/jdk7u45/229/hotspot/src/share/vm/prims/jvm.cpp:1244 -Event: 0.216 Thread 0x00007faf8300f000 Threw 0x00000007aad8f9c8 at /HUDSON/workspace/7u-2-build-macosx-x86_64/jdk7u45/229/hotspot/src/share/vm/prims/jvm.cpp:1244 -Event: 0.216 Thread 0x00007faf8300f000 Threw 0x00000007aad91960 at /HUDSON/workspace/7u-2-build-macosx-x86_64/jdk7u45/229/hotspot/src/share/vm/prims/jvm.cpp:1244 -Event: 0.217 Thread 0x00007faf8300f000 Threw 0x00000007aad95178 at /HUDSON/workspace/7u-2-build-macosx-x86_64/jdk7u45/229/hotspot/src/share/vm/prims/jvm.cpp:1244 -Event: 0.217 Thread 0x00007faf8300f000 Threw 0x00000007aad98ba8 at /HUDSON/workspace/7u-2-build-macosx-x86_64/jdk7u45/229/hotspot/src/share/vm/prims/jvm.cpp:1244 -Event: 0.492 Thread 0x00007faf8300f000 Implicit null exception at 0x000000010ddd513b to 0x000000010ddd5cc1 -Event: 0.515 Thread 0x00007faf8300f000 Implicit null exception at 0x000000010ddd2913 to 0x000000010ddd2c5d -Event: 0.578 Thread 0x00007faf8300f000 Implicit null exception at 0x000000010dddca63 to 0x000000010dddd3a1 -Event: 0.587 Thread 0x00007faf8300f000 Implicit null exception at 0x000000010dde3563 to 0x000000010dde3ea5 - -Events (10 events): -Event: 0.515 Thread 0x00007faf8300f000 DEOPT UNPACKING pc=0x000000010dd8f045 sp=0x000000010dd52be0 mode 2 -Event: 0.558 Thread 0x00007faf8300f000 Uncommon trap: trap_request=0xffffffc6 fr.pc=0x000000010ddcc504 -Event: 0.558 Thread 0x00007faf8300f000 DEOPT PACKING pc=0x000000010ddcc504 sp=0x000000010dd53600 -Event: 0.558 Thread 0x00007faf8300f000 DEOPT UNPACKING pc=0x000000010dd8f045 sp=0x000000010dd535c8 mode 2 -Event: 0.578 Thread 0x00007faf8300f000 Uncommon trap: trap_request=0xfffffff4 fr.pc=0x000000010dddd3ac -Event: 0.578 Thread 0x00007faf8300f000 DEOPT PACKING pc=0x000000010dddd3ac sp=0x000000010dd527a0 -Event: 0.578 Thread 0x00007faf8300f000 DEOPT UNPACKING pc=0x000000010dd8f045 sp=0x000000010dd52680 mode 2 -Event: 0.587 Thread 0x00007faf8300f000 Uncommon trap: trap_request=0xfffffff4 fr.pc=0x000000010dde3eb0 -Event: 0.587 Thread 0x00007faf8300f000 DEOPT PACKING pc=0x000000010dde3eb0 sp=0x000000010dd52740 -Event: 0.587 Thread 0x00007faf8300f000 DEOPT UNPACKING pc=0x000000010dd8f045 sp=0x000000010dd52680 mode 2 - - -Dynamic libraries: -0x000000000adb7000 /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa -0x000000000adb7000 /System/Library/Frameworks/Security.framework/Versions/A/Security -0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices -0x000000000adb7000 /usr/lib/libz.1.dylib -0x000000000adb7000 /usr/lib/libSystem.B.dylib -0x000000000adb7000 /usr/lib/libobjc.A.dylib -0x000000000adb7000 /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation -0x000000000adb7000 /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation -0x000000000adb7000 /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit -0x000000000adb7000 /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData -0x000000000adb7000 /System/Library/PrivateFrameworks/RemoteViewServices.framework/Versions/A/RemoteViewServices -0x000000000adb7000 /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox -0x000000000adb7000 /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit -0x000000000adb7000 /System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/DataDetectorsCore -0x000000000adb7000 /System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv -0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox -0x000000000adb7000 /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore -0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SpeechRecognition.framework/Versions/A/SpeechRecognition -0x000000000adb7000 /usr/lib/libauto.dylib -0x000000000adb7000 /usr/lib/libicucore.A.dylib -0x000000000adb7000 /usr/lib/libxml2.2.dylib -0x000000000adb7000 /System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI -0x000000000adb7000 /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio -0x000000000adb7000 /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration -0x000000000adb7000 /usr/lib/liblangid.dylib -0x000000000adb7000 /System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport -0x000000000adb7000 /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit -0x000000000adb7000 /usr/lib/libDiagnosticMessagesClient.dylib -0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices -0x000000000adb7000 /System/Library/PrivateFrameworks/PerformanceAnalysis.framework/Versions/A/PerformanceAnalysis -0x000000000adb7000 /System/Library/PrivateFrameworks/GenerationalStorage.framework/Versions/A/GenerationalStorage -0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL -0x000000000adb7000 /System/Library/PrivateFrameworks/Sharing.framework/Versions/A/Sharing -0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO -0x000000000adb7000 /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText -0x000000000adb7000 /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics -0x000000000adb7000 /System/Library/PrivateFrameworks/Backup.framework/Versions/A/Backup -0x000000000adb7000 /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork -0x000000000adb7000 /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration -0x000000000adb7000 /usr/lib/libCRFSuite.dylib -0x000000000adb7000 /usr/lib/libc++.1.dylib -0x000000000adb7000 /usr/lib/libc++abi.dylib -0x000000000adb7000 /usr/lib/system/libcache.dylib -0x000000000adb7000 /usr/lib/system/libcommonCrypto.dylib -0x000000000adb7000 /usr/lib/system/libcompiler_rt.dylib -0x000000000adb7000 /usr/lib/system/libcopyfile.dylib -0x000000000adb7000 /usr/lib/system/libcorecrypto.dylib -0x000000000adb7000 /usr/lib/system/libdispatch.dylib -0x000000000adb7000 /usr/lib/system/libdyld.dylib -0x000000000adb7000 /usr/lib/system/libkeymgr.dylib -0x000000000adb7000 /usr/lib/system/liblaunch.dylib -0x000000000adb7000 /usr/lib/system/libmacho.dylib -0x000000000adb7000 /usr/lib/system/libquarantine.dylib -0x000000000adb7000 /usr/lib/system/libremovefile.dylib -0x000000000adb7000 /usr/lib/system/libsystem_asl.dylib -0x000000000adb7000 /usr/lib/system/libsystem_blocks.dylib -0x000000000adb7000 /usr/lib/system/libsystem_c.dylib -0x000000000adb7000 /usr/lib/system/libsystem_configuration.dylib -0x000000000adb7000 /usr/lib/system/libsystem_dnssd.dylib -0x000000000adb7000 /usr/lib/system/libsystem_info.dylib -0x000000000adb7000 /usr/lib/system/libsystem_kernel.dylib -0x000000000adb7000 /usr/lib/system/libsystem_m.dylib -0x000000000adb7000 /usr/lib/system/libsystem_malloc.dylib -0x000000000adb7000 /usr/lib/system/libsystem_network.dylib -0x000000000adb7000 /usr/lib/system/libsystem_notify.dylib -0x000000000adb7000 /usr/lib/system/libsystem_platform.dylib -0x000000000adb7000 /usr/lib/system/libsystem_pthread.dylib -0x000000000adb7000 /usr/lib/system/libsystem_sandbox.dylib -0x000000000adb7000 /usr/lib/system/libsystem_stats.dylib -0x000000000adb7000 /usr/lib/system/libunc.dylib -0x000000000adb7000 /usr/lib/system/libunwind.dylib -0x000000000adb7000 /usr/lib/system/libxpc.dylib -0x000000000adb7000 /usr/lib/libbsm.0.dylib -0x000000000adb7000 /usr/lib/libsqlite3.dylib -0x000000000adb7000 /usr/lib/libxar.1.dylib -0x000000000adb7000 /usr/lib/libpam.2.dylib -0x000000000adb7000 /usr/lib/libOpenScriptingUtil.dylib -0x000000000adb7000 /usr/lib/libbz2.1.0.dylib -0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore -0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata -0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices -0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit -0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE -0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices -0x000000000adb7000 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices -0x000000000adb7000 /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS -0x000000000adb7000 /usr/lib/system/libkxld.dylib -0x000000000adb7000 /System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth -0x000000000adb7000 /System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC -0x000000000adb7000 /System/Library/Frameworks/OpenDirectory.framework/Versions/A/Frameworks/CFOpenDirectory.framework/Versions/A/CFOpenDirectory -0x000000000adb7000 /System/Library/Frameworks/ServiceManagement.framework/Versions/A/ServiceManagement -0x000000000adb7000 /usr/lib/libxslt.1.dylib -0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Ink.framework/Versions/A/Ink -0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS -0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ColorSync.framework/Versions/A/ColorSync -0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices -0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis -0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/PrintCore -0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/QD -0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis -0x000000000adb7000 /System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface -0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate -0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage -0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib -0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib -0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib -0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib -0x000000000adb7000 /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib -0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Resources/libFontParser.dylib -0x000000000adb7000 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Resources/libFontRegistry.dylib -0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib -0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib -0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib -0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libGIF.dylib -0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJP2.dylib -0x000000000adb7000 /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libRadiance.dylib -0x000000000adb7000 /usr/lib/libcups.2.dylib -0x000000000adb7000 /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos -0x000000000adb7000 /System/Library/Frameworks/GSS.framework/Versions/A/GSS -0x000000000adb7000 /usr/lib/libresolv.9.dylib -0x000000000adb7000 /usr/lib/libiconv.2.dylib -0x000000000adb7000 /System/Library/PrivateFrameworks/Heimdal.framework/Versions/A/Heimdal -0x000000000adb7000 /System/Library/PrivateFrameworks/TrustEvaluationAgent.framework/Versions/A/TrustEvaluationAgent -0x000000000adb7000 /usr/lib/libheimdal-asn1.dylib -0x000000000adb7000 /System/Library/Frameworks/OpenDirectory.framework/Versions/A/OpenDirectory -0x000000000adb7000 /System/Library/PrivateFrameworks/CommonAuth.framework/Versions/A/CommonAuth -0x000000000adb7000 /System/Library/Frameworks/SecurityFoundation.framework/Versions/A/SecurityFoundation -0x000000000adb7000 /System/Library/PrivateFrameworks/Bom.framework/Versions/A/Bom -0x000000000adb7000 /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo -0x000000000adb7000 /System/Library/Frameworks/QuartzCore.framework/Versions/A/Frameworks/CoreImage.framework/Versions/A/CoreImage -0x000000000adb7000 /System/Library/Frameworks/QuartzCore.framework/Versions/A/Frameworks/ScalableUserInterface.framework/Versions/A/ScalableUserInterface -0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib -0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGFXShared.dylib -0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib -0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLImage.dylib -0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCVMSPluginSupport.dylib -0x000000000adb7000 /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCoreVMClient.dylib -0x000000000adb7000 /System/Library/PrivateFrameworks/FaceCore.framework/Versions/A/FaceCore -0x000000000adb7000 /System/Library/PrivateFrameworks/CrashReporterSupport.framework/Versions/A/CrashReporterSupport -0x000000000adb7000 /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL -0x000000000adb7000 /System/Library/PrivateFrameworks/AppleFSCompression.framework/Versions/A/AppleFSCompression -0x000000000adb7000 /System/Library/PrivateFrameworks/Ubiquity.framework/Versions/A/Ubiquity -0x000000000adb7000 /System/Library/PrivateFrameworks/IconServices.framework/Versions/A/IconServices -0x000000000adb7000 /System/Library/PrivateFrameworks/ChunkingLibrary.framework/Versions/A/ChunkingLibrary -0x000000000adb7000 /System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/CoreSymbolication -0x000000000adb7000 /System/Library/PrivateFrameworks/Symbolication.framework/Versions/A/Symbolication -0x000000000adb7000 /System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols -0x000000010d200000 /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/server/libjvm.dylib -0x000000000adb7000 /usr/lib/libstdc++.6.dylib -0x000000010c1aa000 /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/libverify.dylib -0x000000010c1b7000 /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/libjava.dylib -0x000000010c1f1000 /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/libzip.dylib -0x000000011d120000 /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/JavaRuntimeSupport -0x000000011d138000 /System/Library/Frameworks/JavaVM.framework/Versions/A/Frameworks/JavaNativeFoundation.framework/Versions/A/JavaNativeFoundation -0x000000011d14c000 /System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM -0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon -0x000000011d158000 /System/Library/PrivateFrameworks/JavaLaunching.framework/Versions/A/JavaLaunching -0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CommonPanels.framework/Versions/A/CommonPanels -0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Help.framework/Versions/A/Help -0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/ImageCapture.framework/Versions/A/ImageCapture -0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/OpenScripting.framework/Versions/A/OpenScripting -0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Print.framework/Versions/A/Print -0x000000000adb7000 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SecurityHI.framework/Versions/A/SecurityHI -0x000000011d7a7000 /private/var/folders/l0/y303fs4d2y793wwykskdtcc80000gn/T/jna-1437842033/jna6952186334369576447.tmp -0x000000011d7bc000 /usr/lib/libcapstone.dylib - -VM Arguments: -java_command: TestX86 -Launcher Type: SUN_STANDARD - -Environment Variables: -PATH=/Users/danghvu/.rvm/gems/ruby-1.8.7-p374/bin:/Users/danghvu/.rvm/gems/ruby-1.8.7-p374@global/bin:/Users/danghvu/.rvm/rubies/ruby-1.8.7-p374/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/usr/texbin:/usr/local/homebrew/bin/:/Users/danghvu/opt/bin:/Users/danghvu/.rvm/bin:/Users/danghvu/.rvm/bin -LD_LIBRARY_PATH=:/Users/danghvu/opt/lib -SHELL=/bin/bash -DISPLAY=/tmp/launch-LKpOvb/org.macosforge.xquartz:0 - -Signal Handlers: -SIGSEGV: [libjvm.dylib+0x525415], sa_mask[0]=0xfffefeff, sa_flags=0x00000043 -SIGBUS: [libjvm.dylib+0x525415], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 -SIGFPE: [libjvm.dylib+0x41891a], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 -SIGPIPE: [libjvm.dylib+0x41891a], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 -SIGXFSZ: [libjvm.dylib+0x41891a], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 -SIGILL: [libjvm.dylib+0x41891a], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 -SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000 -SIGUSR2: [libjvm.dylib+0x41840c], sa_mask[0]=0x00000000, sa_flags=0x00000042 -SIGHUP: [libjvm.dylib+0x41669b], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 -SIGINT: [libjvm.dylib+0x41669b], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 -SIGTERM: [libjvm.dylib+0x41669b], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 -SIGQUIT: [libjvm.dylib+0x41669b], sa_mask[0]=0xfffefeff, sa_flags=0x00000042 - - ---------------- S Y S T E M --------------- - -OS:Bsduname:Darwin 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64 -rlimit: STACK 65532k, CORE 0k, NPROC 709, NOFILE 10240, AS infinity -load average:1.31 1.45 1.60 - -CPU:total 8 (4 cores per cpu, 2 threads per core) family 6 model 42 stepping 7, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, aes, ht, tsc, tscinvbit - -Memory: 4k page, physical 16777216k(4194304k free) - -/proc/meminfo: - - -vm_info: Java HotSpot(TM) 64-Bit Server VM (24.45-b08) for bsd-amd64 JRE (1.7.0_45-b18), built on Oct 8 2013 05:54:16 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) - -time: Sat Sep 27 14:53:38 2014 -elapsed time: 0 seconds - From 24120694535a7eaf9cb435e4315cf338c72464b1 Mon Sep 17 00:00:00 2001 From: danghvu Date: Sat, 27 Sep 2014 17:59:42 -0500 Subject: [PATCH 3/3] Fix python binding tests --- bindings/python/test_arm.py | 6 +++--- bindings/python/test_arm64.py | 2 +- bindings/python/test_ppc.py | 2 +- bindings/python/test_sparc.py | 5 ++++- bindings/python/test_xcore.py | 2 +- bindings/python/xprint.py | 18 +++++++++--------- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/bindings/python/test_arm.py b/bindings/python/test_arm.py index 9066ee6b..c3d91dd6 100755 --- a/bindings/python/test_arm.py +++ b/bindings/python/test_arm.py @@ -47,9 +47,9 @@ def print_insn_detail(insn): print("\t\toperands[%u].type: SYSREG = %u" % (c, i.reg)) if i.type == ARM_OP_SETEND: if i.setend == ARM_SETEND_BE: - print("\t\toperands[%u].type: SETEND = be") + print("\t\toperands[%u].type: SETEND = be" % c) else: - print("\t\toperands[%u].type: SETEND = le") + print("\t\toperands[%u].type: SETEND = le" % c) if i.type == ARM_OP_MEM: print("\t\toperands[%u].type: MEM" % c) if i.mem.base != 0: @@ -66,7 +66,7 @@ def print_insn_detail(insn): % (c, to_x_32(i.mem.disp))) if i.shift.type != ARM_SFT_INVALID and i.shift.value: - print("\t\t\tShift: type = %u, value = %u\n" \ + print("\t\t\tShift: %u = %u" \ % (i.shift.type, i.shift.value)) if i.vector_index != -1: print("\t\t\toperands[%u].vector_index = %u" %(c, i.vector_index)) diff --git a/bindings/python/test_arm64.py b/bindings/python/test_arm64.py index 5ad9b0f6..2950a7fe 100755 --- a/bindings/python/test_arm64.py +++ b/bindings/python/test_arm64.py @@ -78,7 +78,7 @@ def print_insn_detail(insn): if insn.writeback: print("\tWrite-back: True") if not insn.cc in [ARM64_CC_AL, ARM64_CC_INVALID]: - print("\tCode condition: %u" % insn.cc) + print("\tCode-condition: %u" % insn.cc) if insn.update_flags: print("\tUpdate-flags: True") diff --git a/bindings/python/test_ppc.py b/bindings/python/test_ppc.py index 06e53c10..1844794e 100755 --- a/bindings/python/test_ppc.py +++ b/bindings/python/test_ppc.py @@ -5,7 +5,7 @@ from __future__ import print_function from capstone import * from capstone.ppc import * from xprint import to_x, to_hex, to_x_32 -PPC_CODE = b"\x80\x20\x00\x00\x80\x3f\x00\x00\x10\x43\x23\x0e\xd0\x44\x00\x80\x4c\x43\x22\x02\x2d\x03\x00\x80\x7c\x43\x20\x14\x7c\x43\x20\x93\x4f\x20\x00\x21\x4c\xc8\x00\x21" +PPC_CODE = b"\x80\x20\x00\x00\x80\x3f\x00\x00\x10\x43\x23\x0e\xd0\x44\x00\x80\x4c\x43\x22\x02\x2d\x03\x00\x80\x7c\x43\x20\x14\x7c\x43\x20\x93\x4f\x20\x00\x21\x4c\xc8\x00\x21\x40\x82\x00\x14" all_tests = ( (CS_ARCH_PPC, CS_MODE_BIG_ENDIAN, PPC_CODE, "PPC-64"), diff --git a/bindings/python/test_sparc.py b/bindings/python/test_sparc.py index c3dba831..058b4d3c 100755 --- a/bindings/python/test_sparc.py +++ b/bindings/python/test_sparc.py @@ -38,6 +38,9 @@ def print_insn_detail(insn): if i.mem.base != 0: print("\t\t\toperands[%u].mem.base: REG = %s" \ % (c, insn.reg_name(i.mem.base))) + if i.mem.index != 0: + print("\t\t\toperands[%u].mem.index: REG = %s" \ + % (c, insn.reg_name(i.mem.index))) if i.mem.disp != 0: print("\t\t\toperands[%u].mem.disp: 0x%s" \ % (c, to_x_32(i.mem.disp))) @@ -46,7 +49,7 @@ def print_insn_detail(insn): if insn.cc: print("\tCode condition: %u" % insn.cc) if insn.hint: - print("\tBranch hint: %u" % insn.hint) + print("\tHint code: %u" % insn.hint) # ## Test class Cs diff --git a/bindings/python/test_xcore.py b/bindings/python/test_xcore.py index ff1f6328..5878aecb 100755 --- a/bindings/python/test_xcore.py +++ b/bindings/python/test_xcore.py @@ -43,7 +43,7 @@ def print_insn_detail(insn): print("\t\t\toperands[%u].mem.disp: 0x%s" \ % (c, to_x(i.mem.disp))) if i.mem.direct != 1: - print("\t\t\toperands[%u].mem.direct: -1") + print("\t\t\toperands[%u].mem.direct: -1" % c) c += 1 diff --git a/bindings/python/xprint.py b/bindings/python/xprint.py index 243d66d6..e61f4de0 100755 --- a/bindings/python/xprint.py +++ b/bindings/python/xprint.py @@ -12,24 +12,24 @@ def to_hex(s): else: return " ".join("0x{0:02x}".format(ord(c)) for c in s) +def to_hex2(s): + if _python3: + r = "".join("{0:02x}".format(c) for c in s) # <-- Python 3 is OK + else: + r = "".join("{0:02x}".format(ord(c)) for c in s) + while r[0] == '0': r = r[1:] + return r def to_x(s): from struct import pack if not s: return '0' x = pack(">q", s) while x[0] in ('\0', 0): x = x[1:] - if _python3: - return "".join("{0:02x}".format(c) for c in x) # <-- Python 3 is OK - else: - return "".join("{0:02x}".format(ord(c)) for c in x) - + return to_hex2(x) def to_x_32(s): from struct import pack if not s: return '0' x = pack(">i", s) while x[0] in ('\0', 0): x = x[1:] - if _python3: - return "".join("{0:02x}".format(c) for c in x) # <-- Python 3 is OK - else: - return "".join("{0:02x}".format(ord(c)) for c in x) + return to_hex2(x)