On 30 Jun 2003 01:24:25 -0700, tupolev wrote:
> I am using JNI and I am receiving an error here and there. I would
> like to interpret the message that JNI launches when this error
> happens. In particular it would be good to understand this part:
>
> An unexpected exception has been detected in native code outside the
> VM.
> Unexpected Signal : 11 occurred at PC=0x4D03B46E
> Function=_ZN7MyLibrary5mysock6SelectEiP6fd_setS2_S 2_P7timeval+0x278
>
> 1) What is the unexpected signal number 11?
>
> 2) I have understood that the function that crashes is situated in
> MyLibrary, class mysock, function Select and that an object fd_set is
> crashing within the function. But where? and what are all those
> numbers in the function? and what does that timeval mean?
The error is otherwise known as segmentation fault. It occurrs when
you attempt to access (read or write) a memory location that you do
not have permission for. The kernel has sent a signal (number 11) to
kill the process.
The PC number is the value of the program counter at the time the
error occurred. The other thing is the name of the function that was
executing and a byte offset (0x27

within the function.
It indicates an error in your native code involving pointers. That
could mean many different things, but here are some typical examples:
- you have used the value of an uninitialized variable.
- you have failed to check the return value of a function, and assumed
that it succeeded.
- you have written beyond the bounds of something, thereby changing
the value of a neighbouring structure, which now contains nonsense.
- you have used some type X as though it were some other type Y.
There are tools like Mpatrol, Valgrind and Purify that can help you
debug this.
If you are new to JNI or C this kind of error is quite common. If
there isn't very much code, post it here and someone might look
through it for you.
/gordon
--
[ do not send me private copies of your followups ]
g o r d o n . b e a t o n @ e r i c s s o n . c o m