2011-07-11 87 views
0

我通過System.LoadLibrary()調用在Linux上加載庫。 (此前被問及hereLinux上的Java LoadLibrary問題

一個新的轉折是,我發現gstack,這樣我就可以看到它實際上是凍結。其中紅旗我看到的是這樣的:

Thread 15 (Thread 0xb73feb90 (LWP 12892)): 
#0 0xb7f57402 in __kernel_vsyscall() 
#1 0x0075ebc5 in [email protected]@GLIBC_2.3.2() from /lib/libpthread.so.0 
#2 0x7fd2416c in system__task_primitives__operations(short, long,...)(...)(*)() from /app/gnatpro6.2.2-linux/lib/gcc/i686-pc-linux-gnu/4.3.3/adalib/libgnarl-6.2.so 
#3 0x7fd2cd13 in system__tasking__stages__activate_tasks() from /app/gnatpro6.2.2-linux/lib/gcc/i686-pc-linux-gnu/4.3.3/adalib/libgnarl-6.2.so 
#4 0x7fd2272c in system__interrupts___elabb() from /app/gnatpro6.2.2-linux/lib/gcc/i686-pc-linux-gnu/4.3.3/adalib/libgnarl-6.2.so 
#5 0xb7377e37 in loadinit() from /home/user1/workspace/javaLinux/lib/libload.so 
#6 0xb7377ecd in __do_global_ctors_aux() from /home/user1/workspace/javaLinux/lib/libload.so 
#7 0xb7377579 in _init() from /home/user1/workspace/javaLinux/lib/libload.so 
#8 0x005b73f3 in call_init() from /lib/ld-linux.so.2 
#9 0x005b7503 in _dl_init_internal() from /lib/ld-linux.so.2 
#10 0x005baeab in dl_open_worker() from /lib/ld-linux.so.2 
#11 0x005b7036 in _dl_catch_error() from /lib/ld-linux.so.2 
#12 0x005ba652 in _dl_open() from /lib/ld-linux.so.2 
#13 0x0074ec6d in dlopen_doit() from /lib/libdl.so.2 
#14 0x005b7036 in _dl_catch_error() from /lib/ld-linux.so.2 
#15 0x0074f2ec in _dlerror_run() from /lib/libdl.so.2 
#16 0x0074eba4 in [email protected]@GLIBC_2.1() from /lib/libdl.so.2 
#17 0xb792c099 in os::dll_load(char const*, char*, int)() from /home/user1/tools/Linux/jdk1.6.0_17/jre/lib/i386/server/libjvm.so 
#18 0xb77e0cd9 in JVM_LoadLibrary() from /home/user1/tools/Linux/jdk1.6.0_17/jre/lib/i386/server/libjvm.so 
#19 0xb7394cac in Java_java_lang_ClassLoader_00024NativeLibrary_load() from /home/user1/tools/Linux/jdk1.6.0_17/jre/lib/i386/libjava.so 
#20 0xb43554aa in ??() 
#21 0x086a9510 in ??() 
#22 0xb73fdf34 in ??() 
#23 0xb73fdf30 in ??() 
#24 0xb434e08d in ??() 
#25 0xb73fdf00 in ??() 
#26 0x00000000 in ??() 

具體如下:# 17 0xb792c099 in os :: dll_load

不應該這樣調用Linux負載庫調用,而不是調用dll嗎?任何想法爲什麼它會造成錯誤的電話?

+0

不用擔心對'dll_load()的調用 - 你可以從堆棧跟蹤中看到正在調用'dlopen()'。您是否嘗試過直接使用'dlopen()'從C/C++程序加載該庫來查看會發生什麼? – trojanfoe

回答

2

我想,這只是一個命名事情的問題。看來,JVM作者傾向於命名他們的封裝器dll_load而不是so_load。如果你看一下堆棧跟蹤(尤其是幀立即在上面的列表),你看到

[email protected]@GLIBC_2.1() from /lib/libdl.so.2 

這實際上的Linux相當於LoadLibrary窗戶下。