Сбой в машинном коде
Я пытаюсь написать DVD RW / CD с помощью IMAPI 2.0 с C++. Созданная библиотека dll вызывается из Java-приложения.
Я получаю сбой в коде, который выглядит следующим образом :
# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007fef03f67d3, pid=10548, tid=10764 # # JRE version: Java(TM) SE Runtime Environment (8.0_66-b18) (build 1.8.0_66-b18) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.66-b18 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [libApp.dll+0x67d3] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # If you would like to submit a bug report, please visit: # http://bugreport.java.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x00000000004cf000): JavaThread "main" [_thread_in_native, id=10764, stack(0x00000000022c0000,0x00000000023c0000)] siginfo: ExceptionCode=0xc0000005, reading address 0x000007fe7040eced Registers: RAX=0x000007fe7040eced, RBX=0x0000000056d803c8, RCX=0x000007fe7040eced, RDX=0x000007fef040b730 RSP=0x00000000023beef0, RBP=0x00000000023bf688, RSI=0x0000000020200021, RDI=0x00000000023bef20 R8 =0x0000000000000490, R9 =0x0000000000000001, R10=0x00000000023bed08, R11=0x0000003e00b1000f R12=0x0000000000000000, R13=0x0000000056d803c8, R14=0x00000000023bf6a8, R15=0x00000000004cf000 RIP=0x000007fef03f67d3, EFLAGS=0x0000000000010206 Top of Stack: (sp=0x00000000023beef0) 0x00000000023beef0: cccccccccccccccc cccccccccccccccc 0x00000000023bef00: cccccccccccccccc cccccccccccccccc 0x00000000023bef10: cccccccccccccccc cccccccccccccccc 0x00000000023bef20: 00000000023bef50 000007fef03f6024 0x00000000023bef30: 000007fe7040eced 000007fef040b730 0x00000000023bef40: cccccccc00000490 cccccccccccccccc 0x00000000023bef50: 00000000023bef80 000007fef03f5112 0x00000000023bef60: 00000000023bf0f8 000007fe7040eced 0x00000000023bef70: cccccccccccccccc cccccccccccccccc 0x00000000023bef80: 00000000023bf030 000007fef03f3529 0x00000000023bef90: 00000000023bf0f8 000007fe7040eced 0x00000000023befa0: 000000000000000b 0000000000000016 0x00000000023befb0: cccccccccccccccc cccccccccccccccc 0x00000000023befc0: cccccccccccccccc cccccccccccccccc 0x00000000023befd0: cccccccccccccccc cccccccccccccccc 0x00000000023befe0: fffffffffffffffe 000007fee315bb20 Instructions: (pc=0x000007fef03f67d3) 0x000007fef03f67b3: 24 08 57 48 83 ec 30 48 8b fc b9 0c 00 00 00 b8 0x000007fef03f67c3: cc cc cc cc f3 ab 48 8b 4c 24 40 48 8b 44 24 40 0x000007fef03f67d3: 0f be 00 85 c0 75 0b 48 c7 44 24 20 00 00 00 00 0x000007fef03f67e3: eb 0f 48 8b 4c 24 40 e8 bb 83 00 00 48 89 44 24 Register to memory mapping: RAX=0x000007fe7040eced is an unknown value RBX={method} {0x0000000056d803d0} 'nativeErase' '()V' in 'jnierase/JNIErase' RCX=0x000007fe7040eced is an unknown value RDX=0x000007fef040b730 is an unknown value RSP=0x00000000023beef0 is pointing into the stack for thread: 0x00000000004cf000 RBP=0x00000000023bf688 is pointing into the stack for thread: 0x00000000004cf000 RSI=0x0000000020200021 is an unknown value RDI=0x00000000023bef20 is pointing into the stack for thread: 0x00000000004cf000 R8 =0x0000000000000490 is an unknown value R9 =0x0000000000000001 is an unknown value R10=0x00000000023bed08 is pointing into the stack for thread: 0x00000000004cf000 R11=0x0000003e00b1000f is an unknown value R12=0x0000000000000000 is an unknown value R13={method} {0x0000000056d803d0} 'nativeErase' '()V' in 'jnierase/JNIErase' R14=0x00000000023bf6a8 is pointing into the stack for thread: 0x00000000004cf000 R15=0x00000000004cf000 is a thread Stack: [0x00000000022c0000,0x00000000023c0000], sp=0x00000000023beef0, free space=1019k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [libApp.dll+0x67d3] C [libApp.dll+0x6024] C [libApp.dll+0x5112] C [libApp.dll+0x3529] C [libApp.dll+0x8a2c] C [libApp.dll+0x863f] C [libApp.dll+0x7e78] C 0x00000000026a5e14 Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j jnierase.JNIErase.nativeErase()V+0 j jnierase.JNIErase.main([Ljava/lang/String;)V+7 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) 0x0000000058916000 JavaThread "Service Thread" daemon [_thread_blocked, id=13348, stack(0x0000000059370000,0x0000000059470000)] 0x000000005889b800 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=13816, stack(0x0000000058f60000,0x0000000059060000)] 0x000000005889a000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=14480, stack(0x0000000059210000,0x0000000059310000)] 0x0000000058892800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=2156, stack(0x0000000059090000,0x0000000059190000)] 0x0000000057375800 JavaThread "Attach Listener" daemon [_thread_blocked, id=3388, stack(0x0000000058cc0000,0x0000000058dc0000)] 0x0000000057374800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=13980, stack(0x0000000058e10000,0x0000000058f10000)] 0x0000000057318000 JavaThread "Finalizer" daemon [_thread_blocked, id=9132, stack(0x0000000058790000,0x0000000058890000)] 0x0000000057311000 JavaThread "Reference Handler" daemon [_thread_blocked, id=10628, stack(0x0000000058610000,0x0000000058710000)] =>0x00000000004cf000 JavaThread "main" [_thread_in_native, id=10764, stack(0x00000000022c0000,0x00000000023c0000)] Other Threads: 0x000000005730b800 VMThread [stack: 0x00000000584a0000,0x00000000585a0000] [id=9516] 0x000000005891d000 WatcherThread [stack: 0x0000000059560000,0x0000000059660000] [id=12428] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap: PSYoungGen total 38400K, used 1996K [0x00000000d5e00000, 0x00000000d8880000, 0x0000000100000000) eden space 33280K, 6% used [0x00000000d5e00000,0x00000000d5ff33f8,0x00000000d7e80000) from space 5120K, 0% used [0x00000000d8380000,0x00000000d8380000,0x00000000d8880000) to space 5120K, 0% used [0x00000000d7e80000,0x00000000d7e80000,0x00000000d8380000) ParOldGen total 87552K, used 0K [0x0000000081a00000, 0x0000000086f80000, 0x00000000d5e00000) object space 87552K, 0% used [0x0000000081a00000,0x0000000081a00000,0x0000000086f80000) Metaspace used 2578K, capacity 4486K, committed 4864K, reserved 1056768K class space used 280K, capacity 386K, committed 512K, reserved 1048576K Card table byte_map: [0x0000000011a50000,0x0000000011e50000] byte_map_base: 0x0000000011643000 Marking Bits: (ParMarkBitMap*) 0x000000006fe4a5b0 Begin Bits: [0x0000000012650000, 0x00000000145e8000) End Bits: [0x00000000145e8000, 0x0000000016580000) Polling page: 0x0000000000230000 CodeCache: size=245760Kb used=1100Kb max_used=1109Kb free=244659Kb bounds [0x0000000002690000, 0x0000000002900000, 0x0000000011690000] total_blobs=257 nmethods=26 adapters=145 compilation: enabled Compilation events (10 events): Event: 0.113 Thread 0x000000005889b800 22 3 java.lang.String::getChars (62 bytes) Event: 0.114 Thread 0x000000005889b800 nmethod 22 0x000000000279fd50 code [0x000000000279ff00, 0x00000000027a0338] Event: 0.114 Thread 0x000000005889b800 23 3 java.util.Arrays::copyOfRange (63 bytes) Event: 0.115 Thread 0x000000005889b800 nmethod 23 0x00000000027a0550 code [0x00000000027a0760, 0x00000000027a1278] Event: 0.115 Thread 0x000000005889b800 26 3 java.lang.String::equals (81 bytes) Event: 0.115 Thread 0x0000000058892800 24 4 java.lang.String::charAt (29 bytes) Event: 0.115 Thread 0x000000005889b800 nmethod 26 0x00000000027a17d0 code [0x00000000027a1960, 0x00000000027a1eb0] Event: 0.115 Thread 0x000000005889b800 25 3 java.lang.String::<init> (82 bytes) Event: 0.116 Thread 0x000000005889b800 nmethod 25 0x00000000027a2090 code [0x00000000027a2260, 0x00000000027a2758] Event: 0.116 Thread 0x0000000058892800 nmethod 24 0x00000000027a5690 code [0x00000000027a57e0, 0x00000000027a5898] GC Heap History (0 events): No events Deoptimization events (0 events): No events Internal exceptions (2 events): Event: 0.054 Thread 0x00000000004cf000 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.defineClass(Ljava/lang/String;[BII)Ljava/lang/Class; name or signature does not match> (0x00000000d5e0cdb0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u66\5298\hotspot\sr�*��U��? Event: 0.054 Thread 0x00000000004cf000 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.prefetchRead(Ljava/lang/Object;J)V name or signature does not match> (0x00000000d5e0d098) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u66\5298\hotspot\src\share\vm\prims\j Events (10 events): Event: 0.121 loading class sun/launcher/LauncherHelper$FXHelper Event: 0.121 loading class sun/launcher/LauncherHelper$FXHelper done Event: 0.121 loading class java/lang/Class$MethodArray Event: 0.121 loading class java/lang/Class$MethodArray done Event: 0.122 loading class java/lang/Void Event: 0.122 loading class java/lang/Void done Event: 0.122 loading class java/lang/ClassLoaderHelper Event: 0.122 loading class java/lang/ClassLoaderHelper done Event: 4.197 Executing VM operation: EnableBiasedLocking Event: 4.197 Executing VM operation: EnableBiasedLocking done Dynamic libraries: 0x000000013f410000 - 0x000000013f447000 C:\Program Files\Java\jdk1.8.0_66\bin\java.exe 0x0000000076f10000 - 0x00000000770ba000 C:\windows\SYSTEM32\ntdll.dll 0x0000000076cf0000 - 0x0000000076e0f000 C:\windows\system32\kernel32.dll 0x000007fefcc90000 - 0x000007fefccfa000 C:\windows\system32\KERNELBASE.dll 0x000007fefe4e0000 - 0x000007fefe5bb000 C:\windows\system32\ADVAPI32.dll 0x000007fefde20000 - 0x000007fefdebf000 C:\windows\system32\msvcrt.dll 0x000007fefedc0000 - 0x000007fefeddf000 C:\windows\SYSTEM32\sechost.dll 0x000007fefe850000 - 0x000007fefe97d000 C:\windows\system32\RPCRT4.dll 0x0000000076e10000 - 0x0000000076f0a000 C:\windows\system32\USER32.dll 0x000007fefe5c0000 - 0x000007fefe627000 C:\windows\system32\GDI32.dll 0x000007fefe840000 - 0x000007fefe84e000 C:\windows\system32\LPK.dll 0x000007fefe190000 - 0x000007fefe25a000 C:\windows\system32\USP10.dll 0x000007fefb2c0000 - 0x000007fefb4b4000 C:\windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_fa3b1e3d17594757\COMCTL32.dll 0x000007feff190000 - 0x000007feff201000 C:\windows\system32\SHLWAPI.dll 0x000007fefe680000 - 0x000007fefe6ae000 C:\windows\system32\IMM32.DLL 0x000007fefe980000 - 0x000007fefea89000 C:\windows\system32\MSCTF.dll 0x0000000079090000 - 0x0000000079162000 C:\Program Files\Java\jdk1.8.0_66\jre\bin\msvcr100.dll 0x000000006f640000 - 0x000000006fec9000 C:\Program Files\Java\jdk1.8.0_66\jre\bin\server\jvm.dll 0x000007fefa130000 - 0x000007fefa139000 C:\windows\system32\WSOCK32.dll 0x000007fefe630000 - 0x000007fefe67d000 C:\windows\system32\WS2_32.dll 0x000007feff210000 - 0x000007feff218000 C:\windows\system32\NSI.dll 0x000007fefaae0000 - 0x000007fefab1b000 C:\windows\system32\WINMM.dll 0x000007fefbd30000 - 0x000007fefbd3c000 C:\windows\system32\VERSION.dll 0x00000000770e0000 - 0x00000000770e7000 C:\windows\system32\PSAPI.DLL 0x000000006ce10000 - 0x000000006ce1f000 C:\Program Files\Java\jdk1.8.0_66\jre\bin\verify.dll 0x000000006cd10000 - 0x000000006cd39000 C:\Program Files\Java\jdk1.8.0_66\jre\bin\java.dll 0x000000006bce0000 - 0x000000006bcf6000 C:\Program Files\Java\jdk1.8.0_66\jre\bin\zip.dll 0x000007fefd010000 - 0x000007fefdd99000 C:\windows\system32\SHELL32.dll 0x000007fefeb30000 - 0x000007fefed33000 C:\windows\system32\ole32.dll 0x000007fefcc60000 - 0x000007fefcc6f000 C:\windows\system32\profapi.dll 0x000007fef03f0000 - 0x000007fef041c000 C:\Users\XYZ\Desktop\test\libApp.dll 0x000007fefede0000 - 0x000007fefeeb8000 C:\windows\system32\OLEAUT32.dll 0x000007fee3060000 - 0x000007fee3173000 C:\windows\system32\MSVCP120D.dll 0x000007fedb760000 - 0x000007fedb971000 C:\windows\system32\MSVCR120D.dll 0x000007fefcaf0000 - 0x000007fefcaff000 C:\windows\system32\CRYPTBASE.dll 0x000007fefea90000 - 0x000007fefeb29000 C:\windows\system32\CLBCatQ.DLL 0x000007fef3e90000 - 0x000007fef3f0f000 C:\Windows\system32\imapi2.dll 0x000007fefe300000 - 0x000007fefe4d7000 C:\windows\system32\SETUPAPI.dll 0x000007fefcf10000 - 0x000007fefcf46000 C:\windows\system32\CFGMGR32.dll 0x000007fefcc70000 - 0x000007fefcc8a000 C:\windows\system32\DEVOBJ.dll 0x000007fefb240000 - 0x000007fefb296000 C:\windows\system32\uxtheme.dll 0x000007fef5330000 - 0x000007fef534d000 C:\Program Files (x86)\McAfee\SiteAdvisor Enterprise\x64\saHook.dll 0x000007fefae70000 - 0x000007fefae88000 C:\windows\system32\dwmapi.dll 0x000007fefcea0000 - 0x000007fefceda000 C:\windows\system32\WINTRUST.dll 0x000007fefcd30000 - 0x000007fefce9c000 C:\windows\system32\CRYPT32.dll 0x000007fefcc50000 - 0x000007fefcc5f000 C:\windows\system32\MSASN1.dll 0x000007fefc490000 - 0x000007fefc4a7000 C:\windows\system32\CRYPTSP.dll 0x000007fefc190000 - 0x000007fefc1d7000 C:\windows\system32\rsaenh.dll 0x000007fefcba0000 - 0x000007fefcbb4000 C:\windows\system32\RpcRtRemote.dll 0x000007fee35c0000 - 0x000007fee36f4000 C:\Windows\system32\imapi2fs.dll 0x000007fefa4d0000 - 0x000007fefa566000 C:\Windows\system32\msvcp60.dll 0x000007fefa140000 - 0x000007fefa265000 C:\windows\system32\dbghelp.dll VM Arguments: jvm_args: -Dfile.encoding=UTF-8 -Djava.library.path=C:\Users\XYZ\Desktop\test java_command: jnierase.JNIErase java_class_path (initial): C:\Users\H146130\Documents\NetBeansProjects\JNIErase\build\classes Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\Program Files\Java\jdk1.7.0_17;C:\Program Files\Java\jdk1.7.0_17\lib; PATH=C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Client\;C:\Program Files\Java\jdk1.7.0_17\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Apache Software Foundation\apache-maven-3.3.3\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\WiX Toolset v3.10\bin;C:\Program Files (x86)\Inno Setup 5;C:\MinGW_64\bin;C:\MinGW_MSYS\msys\bin;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\apache-tomcat-8.0.36\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\ USERNAME=H146130 OS=Windows_NT PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 61 Stepping 4, GenuineIntel --------------- S Y S T E M --------------- OS: Windows 7 , 64 bit Build 7601 (6.1.7601.23418) CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 61 stepping 4, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx Memory: 4k page, physical 8274372k(2951556k free), swap 16546884k(10668144k free) vm_info: Java HotSpot(TM) 64-Bit Server VM (25.66-b18) for windows-amd64 JRE (1.8.0_66-b18), built on Nov 9 2015 10:51:13 by "java_re" with MS VC++ 10.0 (VS2010) time: Mon Sep 19 11:01:20 2016 elapsed time: 446 seconds (0d 0h 7m 26s)
Пожалуйста, объясните мне, в чем может быть проблема.
Что я уже пробовал:
Пробовал проверить много блогов, но ни малейшего намека на crash id # Problematic frame:
# С [libApp.dll+0x67d3]
Garth J Lancaster
не видя ни одного вашего java JNI кода и что libApp.dll экспорт, нам немного трудно дать вам ответ - это может быть так же просто, как неправильное написание, то есть вызов функции, которая не существует в dll - как насчет использования "улучшить вопрос", чтобы добавить наименьший возможный блок кода к заданному вами вопросу, который показывает нам, как вы пытаетесь это сделать
кроме того, сделайте DumpBin /exports в dll и убедитесь, что он экспортирует необходимые вам функции
кроме того, убедитесь, что если вы должны передавать "буферы" и т. д. В библиотеку dll, то вы правильно их распределили - опять же, мы не можем вам помочь, так как не видим libApp.dll / документация
Richard MacCutchan
Нарушение доступа означает, что вы пытаетесь читать/записывать из/в адрес памяти, который не находится в адресном пространстве вашего приложения. Единственный способ найти виновника-это отладить ваш код.