Created
October 7, 2010 11:27
-
-
Save ArtemGr/614979 to your computer and use it in GitHub Desktop.
gdb and JNI SIGSEGV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Suppose we have a following stack trace: | |
Stack: [...,...], sp=..., free space=... | |
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) | |
C [libcpp_mem_i_40.so+0xAAAA] _ZN3Mem10setCounterExii+0xBBB | |
--- Using the first offset (0xAAAA) ------- | |
Open the gdb: | |
> /usr/local/gdb72/bin/gdb /.../libcpp_mem_i_40.so | |
See where it crashed: | |
> list *0xAAAA | |
--- Using the second offset (0xBBB) ------- | |
Convert the second offset into decimals: | |
> perl -e 'print 0xBBB."\n"' | |
3003 | |
And examine the given function (looking for the 3003th opcode): | |
> disassemble _ZN3Mem10setCounterExii | |
> disassemble /m _ZN3Mem10setCounterExii | |
To obtain the line number we might try: | |
> print _ZN3Mem10setCounterExii+3003 | |
or | |
> x/i _ZN3Mem10setCounterExii+3003 | |
then use the given address to learn the line | |
> info line *0xAAAA | |
> list *0xAAAA | |
Line ... of "..." | |
------------------------------------ | |
If stack trace is not available (usually when "abort" was called), then | |
> /usr/local/gdb72/bin/gdb /usr/local/openjdk7/bin/java -c java.core | |
might help. | |
------------------------------------ | |
Alternative, if stack trace is available, is to use | |
> objdump -S lib....so | less |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment