This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
gcj crasches on JvCreateJavaVM(NULL)
- From: Fabian Sturm <sturmf at informatik dot tu-muenchen dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 19 Feb 2004 10:38:16 +0100
- Subject: gcj crasches on JvCreateJavaVM(NULL)
Hi!
I am a little bit stuck with gcj. I got a Java program running from
a C++ program without problems. But when I know incorporate this
into a bigger program I get only a SIGSEGV.
The biggest changes between the two versions are that the new program
is linked with omniorb (using threads) and coin (an inventor implementation).
I would appreciate any suggestions to track this down!
Here the gdb output when run:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 49156 (LWP 28701)]
0x415d4520 in GC_push_all_eager () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
(gdb) bt
#0 0x415d4520 in GC_push_all_eager () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
#1 0x415d459c in GC_push_all_stack () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
#2 0x415d0d58 in GC_push_all_stacks () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
#3 0x415d7019 in GC_default_push_other_roots () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
#4 0x415d5632 in GC_push_roots () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
#5 0x415d3326 in GC_mark_some () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
#6 0x415cb605 in GC_stopped_mark () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
#7 0x415cb2f5 in GC_try_to_collect_inner () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
#8 0x415d5ea4 in GC_init_inner () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
#9 0x415d5b6e in GC_init () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
#10 0x415cf279 in GC_init_gcj_malloc () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
#11 0x41400418 in _Jv_InitGC() () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
#12 0x414028df in _Jv_CreateJavaVM(void*) () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libgcj.so.4
#13 0x080d42f0 in SpaceManagerLayoutStrategy (this=0x820fb80, layoutArea=@0x8224780) at cni.h:124
#14 0x080d19a0 in LayoutManager (this=0x8224758) at ../../../../src/services/Viewer/LayoutManager.cpp:53
#15 0x080cc32a in SoDwarfViewerFactory::createSoDwarfViewer(bool, bool, int, int, StereoMode, char const*, float, float, bool) (this=0x0, fullscreen=false, sizex=640, sizey=480, stereomode=LINE_INTERLEAVED, scene=0x0, fov=90, eyeangle=0,
backgroundColor=false) at ../../../../src/services/Viewer/SoDwarfViewerFactory.cpp:117
#16 0x080ab97f in ViewerFacade::guiThread() (this=0x812c100) at ../../../../src/services/Viewer/ViewerFacade.cpp:123
#17 0x080ab9c1 in ViewerFacade::guiThreadStartRoutine(void*) (data=0x0)
at ../../../../src/services/Viewer/ViewerFacade.cpp:139
#18 0x41ed3e18 in omni_thread_wrapper () from /usr/lib/libomnithread.so.3
#19 0x420eaf60 in pthread_start_thread () from /lib/libpthread.so.0
#20 0x420eb062 in pthread_start_thread_event () from /lib/libpthread.so.0
#21 0x422b347a in clone () from /lib/libc.so.6
The cni code looks like:
try
{
//java VM already initialized?
if (!javaVM)
{
JvCreateJavaVM(NULL); <---------Crashs here already
javaVM = true;
DEBUGSTREAM(10, "Java VM initialized. (needed to use space-manager.)");
}
// attach current thread to java. should have no sideeffects if already attached
#if 0 <--- uncommented for testing
JvAttachCurrentThread(NULL, NULL);
// create space-manager calls new on a java class inside
m_jLayoutArea = SpaceManagerUtils::toRectangle2i(m_layoutArea);
DEBUGSTREAM(10, "SpaceManagerLayoutStrategy was created.");
#endif
}
catch (java::lang::Throwable *t)
{
DEBUGSTREAM(0, "Could not create SpaceManagerLayoutStrategy!");
throw t;
}
Thanks Fabian