我有一个JNI dll,如果我使用调试VC ++ 2010 Express,它运行正常。如果我使用Release版本,它会崩溃JVM。 这个cmd:java -Djava.library.path = D:\ charlie \ tmp \ SendKeys \ x64 \ Debug SendKeys 工作。 这个cmd:> java -Djava.library.path = D:\ charlie \ tmp \ SendKeys \ x64 \ Release -Dsun.java2d.d3d = false SendKeys 和cmd:> java -Djava.library.path = D:\ charlie \ tmp \ SendKeys \ x64 \ Release SendKeys失败。请帮忙。
C++ native code(MS VC++ 2010 express), & in 64bits OS:
BOOL __stdcall InitializeWinIo()
{
BOOL bResult = false;
DWORD dwBytesReturned;
g_Is64BitOS = Is64BitOS();
hDriver = CreateFile(L"\\\\.\\WINIO",GENERIC_READ | GENERIC_WRITE,
0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL);
// If the driver is not running, install it
if (hDriver == INVALID_HANDLE_VALUE)
{
printf("WINIO driver is not running!\n");
GetDriverPath();
bResult = InstallWinIoDriver(szWinIoDriverPath, true);
if (!bResult)
return FALSE;
bResult = StartWinIoDriver();
if (!bResult)
{
printf("ERROR: WINIO driver can not be started!\n");
return FALSE;
}
else
{
printf("OK: WINIO driver has been started!\n");
}
hDriver = CreateFile(L"\\\\.\\WINIO",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hDriver == INVALID_HANDLE_VALUE)
{
printf("ERROR: WINIO driver running status can not be confirmed!\n");
return FALSE;
}
else
{
printf("ERROR: WINIO driver running status has been confirmed!\n");
}
}
else
{
printf("WINIO driver is happily running!\n");
}
// Enable I/O port access for this process if running on a 32 bit OS
if (!g_Is64BitOS)
{
printf("CRITICAL not a 64 bits system\n");
if (!DeviceIoControl(hDriver, IOCTL_WINIO_ENABLEDIRECTIO, NULL,
0, NULL, 0, &dwBytesReturned, NULL))
{
printf("ERROR: can not enable I/O access in 32 bits system\n");
return FALSE;
}
}
else
{
printf("OK a perfect 64 bits system\n");
}
IsWinIoInitialized = TRUE;
return TRUE;
}
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000000055b6, pid=4396, tid=9552
#
# JRE version: Java(TM) SE Runtime Environment (7.0_80-b15) (build 1.7.0_80-b15)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.80-b11 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C 0x00000000000055b6
#
# 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 (0x00000000034c0800): JavaThread "main" [_thread_in_native, id=9552, stack(0x00000000033a0000,0x00000000034a0000)]
siginfo: ExceptionCode=0xc0000005, ExceptionInformation=0x0000000000000008 0x00000000000055b6
Registers:
RAX=0x00007ff6457b1780, RBX=0x000000077c8686e8, RCX=0x00007ff6457b43e0, RDX=0x000000000349f760
RSP=0x000000000349f6b8, RBP=0x000000000349f750, RSI=0x00000000ef8eccd3, RDI=0x00000000035c60f8
R8 =0x0000000000000000, R9 =0x0000000003508ec0, R10=0x00000000035d3124, R11=0x0000000072ba4b50
R12=0x0000000000000000, R13=0x000000077c8686e8, R14=0x000000000349f768, R15=0x00000000034c0800
RIP=0x00000000000055b6, EFLAGS=0x0000000000010206
Top of Stack: (sp=0x000000000349f6b8)
0x000000000349f6b8: 00007ff6457b1791 00000000ffffff00
0x000000000349f6c8: 00000000034c0800 000000077c8686e8
0x000000000349f6d8: 0000000000000000 00000007d5d598a8
0x000000000349f6e8: 00000000035d3150 0000000000000001
0x000000000349f6f8: 0000000000000000 00000000034c0800
0x000000000349f708: 000000000349f7c0 000000000349f710
0x000000000349f718: 000000077c8686e8 000000000349f768
0x000000000349f728: 000000077c869518 0000000000000000
0x000000000349f738: 000000077c8686e8 0000000000000000
0x000000000349f748: 000000000349f770 000000000349f7b0
0x000000000349f758: 00000000035c63f0 00000007d5d962b8
0x000000000349f768: 00000000035cf0c0 000000000349f770
0x000000000349f778: 000000077c8688b3 000000000349f7c0
0x000000000349f788: 000000077c869518 0000000000000000
0x000000000349f798: 000000077c868978 000000000349f770
0x000000000349f7a8: 000000000349f7c8 000000000349f808
Instructions: (pc=0x00000000000055b6)
0x0000000000005596:
[error occurred during error reporting (printing registers, top of stack, instructions near pc), id 0xc0000005]
Register to memory mapping:
RAX=0x00007ff6457b1780 is an unknown value
RBX=0x000000077c8686e8 is an oop
{method}
- klass: {other class}
RCX=0x00007ff6457b43e0 is an unknown value
RDX=0x000000000349f760 is pointing into the stack for thread: 0x00000000034c0800
RSP=0x000000000349f6b8 is pointing into the stack for thread: 0x00000000034c0800
RBP=0x000000000349f750 is pointing into the stack for thread: 0x00000000034c0800
RSI=0x00000000ef8eccd3 is an unknown value
RDI=0x00000000035c60f8 is at code_begin+2520 in an Interpreter codelet
return entry points [0x00000000035c5720, 0x00000000035c7520] 7680 bytes
R8 =0x0000000000000000 is an unknown value
R9 =0x0000000003508ec0 is an unknown value
R10=0x00000000035d3124 is at code_begin+644 in an Interpreter codelet
method entry point (kind = native) [0x00000000035d2ea0, 0x00000000035d3740] 2208 bytes
R11=0x0000000072ba4b50 is an unknown value
R12=0x0000000000000000 is an unknown value
R13=0x000000077c8686e8 is an oop
{method}
- klass: {other class}
R14=0x000000000349f768 is pointing into the stack for thread: 0x00000000034c0800
R15=0x00000000034c0800 is a thread
Stack: [0x00000000033a0000,0x00000000034a0000], sp=0x000000000349f6b8, free space=1021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C 0x00000000000055b6
j SendKeys.init()Z+19
j SendKeys.main([Ljava/lang/String;)V+27
v ~StubRoutines::call_stub
V [jvm.dll+0x1d03d3]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j SendKeys.initializeWinIO()Z+0
j SendKeys.init()Z+19
j SendKeys.main([Ljava/lang/String;)V+27
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x000000000b94b800 JavaThread "Service Thread" daemon [_thread_blocked, id=5812, stack(0x000000000d0a0000,0x000000000d1a0000)]
0x000000000b941800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=7764, stack(0x000000000cfa0000,0x000000000d0a0000)]
0x000000000b93f000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=9736, stack(0x000000000cea0000,0x000000000cfa0000)]
0x000000000b93e000 JavaThread "Attach Listener" daemon [_thread_blocked, id=6772, stack(0x000000000cda0000,0x000000000cea0000)]
0x000000000b93b000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=10512, stack(0x000000000cca0000,0x000000000cda0000)]
0x000000000b8ee000 JavaThread "Finalizer" daemon [_thread_blocked, id=9768, stack(0x000000000cba0000,0x000000000cca0000)]
0x000000000b8e5000 JavaThread "Reference Handler" daemon [_thread_blocked, id=7876, stack(0x000000000caa0000,0x000000000cba0000)]
=>0x00000000034c0800 JavaThread "main" [_thread_in_native, id=9552, stack(0x00000000033a0000,0x00000000034a0000)]
Other Threads:
0x000000000b8e0000 VMThread [stack: 0x000000000c9a0000,0x000000000caa0000] [id=11044]
0x000000000b964800 WatcherThread [stack: 0x000000000d1a0000,0x000000000d2a0000] [id=8160]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
PSYoungGen total 38400K, used 1331K [0x00000007d5d00000, 0x00000007d8780000, 0x0000000800000000)
eden space 33280K, 4% used [0x00000007d5d00000,0x00000007d5e4cdb8,0x00000007d7d80000)
from space 5120K, 0% used [0x00000007d8280000,0x00000007d8280000,0x00000007d8780000)
to space 5120K, 0% used [0x00000007d7d80000,0x00000007d7d80000,0x00000007d8280000)
ParOldGen total 86016K, used 0K [0x0000000781800000, 0x0000000786c00000, 0x00000007d5d00000)
object space 86016K, 0% used [0x0000000781800000,0x0000000781800000,0x0000000786c00000)
PSPermGen total 21504K, used 2473K [0x000000077c600000, 0x000000077db00000, 0x0000000781800000)
object space 21504K, 11% used [0x000000077c600000,0x000000077c86a618,0x000000077db00000)
Card table byte_map: [0x0000000006680000,0x0000000006aa0000] byte_map_base: 0x0000000002a9d000
Polling page: 0x0000000001aa0000
Code Cache [0x00000000035c0000, 0x0000000003830000, 0x00000000065c0000)
total_blobs=169 nmethods=0 adapters=137 free_code_cache=48771Kb largest_free_block=49942400
Compilation events (0 events):
No events
GC Heap History (0 events):
No events
Deoptimization events (0 events):
No events
Internal exceptions (2 events):
Event: 0.085 Thread 0x00000000034c0800 Threw 0x00000007d5d0f620 at C:\re\jdk7u80\2329\hotspot\src\share\vm\prims\jni.cpp:3991
Event: 0.365 Thread 0x00000000034c0800 Threw 0x00000007d5d91630 at C:\re\jdk7u80\2329\hotspot\src\share\vm\prims\jvm.cpp:1319
Events (10 events):
Event: 0.369 loading class 0x00000000034c9380
Event: 0.369 loading class 0x00000000034c9380 done
Event: 0.369 loading class 0x000000000352a970
Event: 0.369 loading class 0x000000000352a970 done
Event: 0.369 loading class 0x0000000003506550
Event: 0.369 loading class 0x0000000003506550 done
Event: 0.370 loading class 0x00000000035121b0
Event: 0.370 loading class 0x00000000035121b0 done
Event: 0.370 loading class 0x0000000003512150
Event: 0.370 loading class 0x0000000003512150 done
Dynamic libraries:
0x00007ff6fef00000 - 0x00007ff6fef33000 C:\WINDOWS\system32\java.exe
0x00007ff9ef7d0000 - 0x00007ff9ef9a1000 C:\WINDOWS\SYSTEM32\ntdll.dll
0x00007ff9ef640000 - 0x00007ff9ef6eb000 C:\WINDOWS\System32\KERNEL32.DLL
0x00007ff9ec0c0000 - 0x00007ff9ec2dd000 C:\WINDOWS\System32\KERNELBASE.dll
0x00007ff9eee60000 - 0x00007ff9eef02000 C:\WINDOWS\System32\ADVAPI32.dll
0x00007ff9ecd60000 - 0x00007ff9ecdfe000 C:\WINDOWS\System32\msvcrt.dll
0x00007ff9ee3d0000 - 0x00007ff9ee429000 C:\WINDOWS\System32\sechost.dll
0x00007ff9eeb60000 - 0x00007ff9eec81000 C:\WINDOWS\System32\RPCRT4.dll
0x00007ff9ee8b0000 - 0x00007ff9eea15000 C:\WINDOWS\System32\USER32.dll
0x00007ff9ec030000 - 0x00007ff9ec04e000 C:\WINDOWS\System32\win32u.dll
0x00007ff9ece10000 - 0x00007ff9ece44000 C:\WINDOWS\System32\GDI32.dll
0x00007ff9ecbd0000 - 0x00007ff9ecd52000 C:\WINDOWS\System32\gdi32full.dll
0x00007ff9dcc70000 - 0x00007ff9dceea000 C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.14393.953_none_42151e83c686086b\COMCTL32.dll
0x00007ff9ee550000 - 0x00007ff9ee818000 C:\WINDOWS\System32\combase.dll
0x00007ff9ecad0000 - 0x00007ff9ecbc5000 C:\WINDOWS\System32\ucrtbase.dll
0x00007ff9ec050000 - 0x00007ff9ec0ba000 C:\WINDOWS\System32\bcryptPrimitives.dll
0x00007ff9ef7a0000 - 0x00007ff9ef7ce000 C:\WINDOWS\System32\IMM32.DLL
0x0000000073670000 - 0x0000000073742000 C:\charlie\Java\jre7\bin\msvcr100.dll
0x00000000729c0000 - 0x0000000073199000 C:\charlie\Java\jre7\bin\server\jvm.dll
0x00007ff9eec90000 - 0x00007ff9eec98000 C:\WINDOWS\System32\PSAPI.DLL
0x00007ff9e8590000 - 0x00007ff9e8599000 C:\WINDOWS\system32\WSOCK32.dll
0x00007ff9ee360000 - 0x00007ff9ee3ca000 C:\WINDOWS\System32\WS2_32.dll
0x00007ff9e9eb0000 - 0x00007ff9e9ed3000 C:\WINDOWS\system32\WINMM.dll
0x00007ff9e9e70000 - 0x00007ff9e9e9b000 C:\WINDOWS\system32\WINMMBASE.dll
0x00007ff9ebcc0000 - 0x00007ff9ebd02000 C:\WINDOWS\System32\cfgmgr32.dll
0x0000000073660000 - 0x000000007366f000 C:\charlie\Java\jre7\bin\verify.dll
0x0000000073630000 - 0x0000000073658000 C:\charlie\Java\jre7\bin\java.dll
0x0000000073610000 - 0x0000000073626000 C:\charlie\Java\jre7\bin\zip.dll
0x00007ff6457b0000 - 0x00007ff6457ca000 D:\charlie\tmp\SendKeys\x64\Release\SendKeys.dll
0x00007ff9e7150000 - 0x00007ff9e72e2000 C:\WINDOWS\system32\dbghelp.dll
VM Arguments:
jvm_args: -Djava.library.path=D:\charlie\tmp\SendKeys\x64\Release
java_command: SendKeys
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\charlie\Java\jdk1.7.0_80
PATH=C:\Python27\;C:\Python27\Scripts;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;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 (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\MATLAB\MATLAB Runtime\v85\runtime\win64;C:\Program Files (x86)\PuTTY\;C:\Program Files\OpenVPN\bin;C:\Program Files (x86)\WinMerge;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;D:\charlie\tmp\SendKeys\x64\Debug\;C:\charlie\Java\jdk1.7.0_80\bin;C:\charlie\eclipse4.5.1\plugins\org.apache.ant_1.9.4.v201504302020\bin;C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin;;C:\Users\charlie\AppData\Local\Microsoft\WindowsApps;C:\charlie\apache-maven-3.3.3\bin
USERNAME=charlie
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows 8.1 , 64 bit Build 9600
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, erms, ht, tsc, tscinvbit
Memory: 4k page, physical 8289204k(3876444k free), swap 9599924k(3279704k free)
vm_info: Java HotSpot(TM) 64-Bit Server VM (24.80-b11) for windows-amd64 JRE (1.7.0_80-b15), built on Apr 10 2015 11:26:34 by "java_re" with unknown MS VC++:1600
time: Tue Apr 18 18:01:32 2017
elapsed time: 0 seconds