Skip to main content

CVM PhoneME crashes with signal 11 on MIPS platform

6 replies [Last post]
rohanp_java
Offline
Joined: 2010-11-09
Points: 0

Hi,

I have used the latest tree from the trunk to build the cvm library for MIPS platform.
the library gets build properly but when I try to invoke it from an external application it crashes at
CVMprivateClassInit() function.
please help..

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Hinkmond Wong Guest
Offline
Joined: 2010-11-03
Points: 0

On 11/30/2010 9:38 PM, forums@java.net wrote:
> Hi,
>
>
>
> I have used the latest tree from the trunk to build the cvm library
> for MIPS
> platform.
>
> the library gets build properly but when I try to invoke it from an
> external
> application it crashes at
>
> CVMprivateClassInit() function.
>
> please help..

Hi Rohan,

I agree with Chris. See: forum link

It looks like you are trying to call ansiJavaMain() multiple times from
inside your main which is not supported. Just change your code to only
call ansiJavaMain() once and it should solve your problem.

Thanks,
Hinkmond

cjplummer
Offline
Joined: 2006-10-16
Points: 0

Which version? Hopefully you are using the svn trunk. I know building as a shared library on MIPS won't work for MR1. It will probably work with the trunk, but isn't really officialy supported. If you are using the trunk, you'll need to debug with GDB and start posting backtraces and any other useful info you can find using GDB.

rohanp_java
Offline
Joined: 2010-11-09
Points: 0

hi,

I am using the svn trunk only.
When i try to trigger this library from an external application it crashes at CVMprivateClassInit().
I tried using the gdb this is what I could find out.

(gdb) c
Continuing.
[New Thread 1024]
[New Thread 49201]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 49201]
0x2ac1c530 in CVMprivateClassInit (ee=0x2af44e44, cb=0x2aeeffcc, p_mb=0x0)
at ../../src/share/javavm/runtime/classinitialize.c:186
186 ../../src/share/javavm/runtime/classinitialize.c: No such file or directory.
in ../../src/share/javavm/runtime/classinitialize.c
(gdb) bt
#0 0x2ac1c530 in CVMprivateClassInit (ee=0x2af44e44, cb=0x2aeeffcc, p_mb=0x0)
at ../../src/share/javavm/runtime/classinitialize.c:186
#1 0x2ac1bdb4 in CVMclassInit (ee=0x2af44e44, cb=0x2aeeffcc) at ../../src/share/javavm/runtime/classinitialize.c:48
#2 0x2ac5eb70 in initializeClassList (ee=0x2af44e44, errorStrBuf=0x795ff8f8 "", sizeofErrorStrBuf=256,
classList=0x2af3fda0, numClasses=8) at ../../src/share/javavm/runtime/jni_impl.c:3514
#3 0x2ac5f4a0 in initializeSystemClasses (env=0x2af44e70, errorStrBuf=0x795ff8f8 "", sizeofErrorStrBuf=256,
initArgs=0x2c25fe0, numUnrecognizedOptions=1) at ../../src/share/javavm/runtime/jni_impl.c:3956
#4 0x2ac608b0 in JNI_CreateJavaVM (p_jvm=0x795ffa70, p_env=0x795ffa90, args=0x2c25fe0)
at ../../src/share/javavm/runtime/jni_impl.c:4579
#5 0x2ad00fe0 in ansiJavaMain (argc=2, argv=0x2c25e10, JNI_CreateJavaVMFunc=0x2ac5f630 <JNI_CreateJavaVM>)
at ../../src/portlibs/ansi_c/ansi_java_md.c:338

Going further i found that is happening when it tries to call
(*env)->CallVoidMethod(env, CVMcbJavaInstance(cb), mb) at line 186 of CVMprivateClassInit.
Its because somehow " *env " is changed and doesnot look valid address ( its not correct
JNIEv for CVMExeEnv ee).

When i explictly hardcode the value *env= &CVMmainJNIfuncs before this call then above function doesnot crash
but it crash again at (*env)->CallStaticVoidMethod(env, systemClass, initMethodID) in initializeSystemClass().

Again after at this point i hardcode *env=&CVMmainJNIfuncs then it doesnot crash but finally it gives error
CVMjniExceptionDescribe failed: couldn't print stack trace.
Using brute force method to print stack trace.
java.lang.NoClassDefFoundError: java.lang.ref.Reference
at java.lang.Class.runStaticInitializers()V(Class.java:1618)
at java.lang.Class.runStaticInitializers()V(Class.java:1629)
at sun.io.Converters.cache(ILjava/lang/Object;Ljava/lang/Class;)Ljava/lang/Class;(Converters.java:119)
at sun.io.Converters.getDefaultConverterClass(I)Ljava/lang/Class;(Converters.java:299)
at sun.io.Converters.newDefaultConverter(I)Ljava/lang/Object;(Converters.java:323)

What could be the wrong here ????

cjplummer
Offline
Joined: 2006-10-16
Points: 0

Have you truncated your backtrace? ansiJavaMain() should not be at the bottom.
Are you calling ansiJavaMain more than once from your main()? Currently this is not supported.
ee should be &CVMglobals.mainEE for the primordial thread, and then env would be &CVMglobals.mainEE.jniEnv.vector, which is computed using the CVMglobals.mainEE macro. You can see this being done in JNI_CreateJavaVM.

Hinkmond Wong Guest
Offline
Joined: 2010-11-03
Points: 0

On 12/2/2010 5:44 AM, forums@java.net wrote:
> hi,
>
>
>
> I am using the svn trunk only.

Hi Rohan,

Which build flavor are you using when you say that you're using the
"trunk"? What does your "make" build command line look like exactly?

Thanks,
Hinkmond

> When i try to trigger this library from an external application it
> crashes
> at CVMprivateClassInit().
>
> I tried using the gdb this is what I could find out.
>
>
>
> (gdb) c Continuing. [New Thread 1024] [New Thread 49201] Program
> received
> signal SIGSEGV, Segmentation fault. [Switching to Thread 49201]
> 0x2ac1c530 in
> CVMprivateClassInit (ee=0x2af44e44, cb=0x2aeeffcc, p_mb=0x0) at
> ../../src/share/javavm/runtime/classinitialize.c:186 186
> ../../src/share/javavm/runtime/classinitialize.c: No such file or
> directory.
> in ../../src/share/javavm/runtime/classinitialize.c (gdb) bt #0
> 0x2ac1c530 in CVMprivateClassInit (ee=0x2af44e44, cb=0x2aeeffcc,
> p_mb=0x0)
> at ../../src/share/javavm/runtime/classinitialize.c:186 #1
> 0x2ac1bdb4 in CVMclassInit (ee=0x2af44e44, cb=0x2aeeffcc) at
> ../../src/share/javavm/runtime/classinitialize.c:48 #2 0x2ac5eb70 in
> initializeClassList (ee=0x2af44e44, errorStrBuf=0x795ff8f8 "",
> sizeofErrorStrBuf=256, classList=0x2af3fda0, numClasses=8) at
> ../../src/share/javavm/runtime/jni_impl.c:3514 #3 0x2ac5f4a0 in
> initializeSystemClasses (env=0x2af44e70, errorStrBuf=0x795ff8f8 "",
> sizeofErrorStrBuf=256, initArgs=0x2c25fe0, numUnrecognizedOptions=1)
> at ../../src/share/javavm/runtime/jni_impl.c:3956 #4 0x2ac608b0 in
> JNI_CreateJavaVM (p_jvm=0x795ffa70, p_env=0x795ffa90, args=0x2c25fe0)
> at ../../src/share/javavm/runtime/jni_impl.c:4579 #5 0x2ad00fe0 in
> ansiJavaMain (argc=2, argv=0x2c25e10, JNI_CreateJavaVMFunc=0x2ac5f630
> ) at ../../src/portlibs/ansi_c/ansi_java_md.c:338
>

rohanp_java
Offline
Joined: 2010-11-09
Points: 0

Hi,

I am using the foundation profile to build the library.
the command that I am using to compile the library is

make CVM_TARGET_TOOLS_PREFIX=/bin/mips-linux-uclibc- JDK_HOME=/usr/lib/jvm/java-1.6.0 J2ME_CLASSLIB=foundation CVM_BUILD_SO=true CVM_BUILD_SUBDIR_NAME=rohan CVM_DEBUG=true CVM_TRACES=true CVM_SYMBOLS=true CVM_DEBUG_STACKTRACE=true USE_DEBUG=true CVM_DEBUG_DUMPSTACK=true

In addition to this i found that ee->jniEnv is getting corrupted some where in call initializeThreadObjects()
and any further access for the same result in crash (stack dump as posted in above msg)