sample program does not execute always after making changes to dalvik jit - android

I have made some changes to dalvik jit by changing the jit table structure from chained array to a combination of hash table and B-tree. Now when i execute a sample java program which is
public class prog {
public static void main(String args[])
{
long start=System.currentTimeMillis();
int sum=0;
for(int i=1;i<10;i++)
{
for(int j=0;j<10;j++) {
long h=getKey();
System.out.println("key : "+h);
}
}
System.out.println("time : "+(System.currentTimeMillis()-start));
}
public static long getKey()
{
Random rand=new Random();
long key = rand.nextLong();
if(key<0)
return -key;
else
return key;
}
}
using dalvikvm -cp prog.jar prog after pushing libdvm.so(built after changes made to JIT) into the android emulator. Sometimes the program runs perfectly and sometimes it results in segmentation fault. When I checked the logs this is the error shown :
Fatal signal 11 (SIGSEGV) at 0x00000020 (code=1)
I/DEBUG ( 33): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 33): Build fingerprint: 'generic/sdk/generic:4.0.3/MR1/237985:eng/test-keys'
I/DEBUG ( 33): pid: 766, tid: 766 >>> dalvikvm <<<
I/DEBUG ( 33): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000020
I/DEBUG ( 33): r0 00000020 r1 4245b32a r2 0000001f r3 00000001
I/DEBUG ( 33): r4 4245b32a r5 41af7e90 r6 0000f9a0 r7 0000063d
I/DEBUG ( 33): r8 4001edc0 r9 00000000 10 40513620 fp 00000014
I/DEBUG ( 33): ip 400bf108 sp beb6cad0 lr 00000000 pc 00000020 cpsr 20000010
I/DEBUG ( 33): d0 3f4000003f400000 d1 0000000000000000
I/DEBUG ( 33): d2 0000000000000000 d3 0000000000000000
I/DEBUG ( 33): d4 0000000000000000 d5 41ca61a4d0800000
I/DEBUG ( 33): d6 3f50624dd2f1a9fc d7 3ede5bd843b4bb5d
I/DEBUG ( 33): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 33): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 33): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 33): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 33): scr 60000010
I/DEBUG ( 33):
I/DEBUG ( 33): #00 pc 00000020
I/DEBUG ( 33): #01 lr 00000000 <unknown>
I/DEBUG ( 33):
I/DEBUG ( 33): code around pc:
I/DEBUG ( 33): 00000000 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG ( 33): 00000010 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG ( 33): 00000020 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG ( 33): 00000030 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG ( 33): 00000040 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG ( 33):
I/DEBUG ( 33): code around lr:
I/DEBUG ( 33): 00000000 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG ( 33): 00000010 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG ( 33): 00000020 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG ( 33): 00000030 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG ( 33): 00000040 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG ( 33):
I/DEBUG ( 33): stack:
I/DEBUG ( 33): beb6ca90 0000001f
I/DEBUG ( 33): beb6ca94 00000000
I/DEBUG ( 33): beb6ca98 00000000
I/DEBUG ( 33): beb6ca9c 400817ed /system/lib/libdvm.so
I/DEBUG ( 33): beb6caa0 400a4736 /system/lib/libdvm.so
I/DEBUG ( 33): beb6caa4 00000001
I/DEBUG ( 33): beb6caa8 4245b32a /system/framework/core.odex
I/DEBUG ( 33): beb6caac 0000001f
I/DEBUG ( 33): beb6cab0 00000001
I/DEBUG ( 33): beb6cab4 4245b32a /system/framework/core.odex
I/DEBUG ( 33): beb6cab8 41af7e90
I/DEBUG ( 33): beb6cabc 0000f9a0 [heap]
I/DEBUG ( 33): beb6cac0 0000063d
I/DEBUG ( 33): beb6cac4 40081841 /system/lib/libdvm.so
I/DEBUG ( 33): beb6cac8 df0027ad
I/DEBUG ( 33): beb6cacc 00000000
I/DEBUG ( 33): #00 beb6cad0 400b3f90 /system/lib/libdvm.so
I/DEBUG ( 33): beb6cad4 0000f9a0 [heap]
I/DEBUG ( 33): beb6cad8 400b3f90 /system/lib/libdvm.so
I/DEBUG ( 33): beb6cadc beb6cb08 [stack]
I/DEBUG ( 33): beb6cae0 41b40710 /dev/ashmem/dalvik-LinearAlloc (deleted)
I/DEBUG ( 33): beb6cae4 beb6cb4c [stack]
I/DEBUG ( 33): beb6cae8 00000000
I/DEBUG ( 33): beb6caec fffffe60
I/DEBUG ( 33): beb6caf0 beb6cb98 [stack]
I/DEBUG ( 33): beb6caf4 40034200 /system/lib/libdvm.so
I/DEBUG ( 33): beb6caf8 00000000
I/DEBUG ( 33): beb6cafc beb6cbc8 [stack]
I/DEBUG ( 33): beb6cb00 00000000
I/DEBUG ( 33): beb6cb04 beb6cbd0 [stack]
I/DEBUG ( 33): beb6cb08 00000000
I/DEBUG ( 33): beb6cb0c 00000000
I/DEBUG ( 33): beb6cb10 00000000
I/DEBUG ( 33): beb6cb14 00000000
I/BootReceiver( 77): Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE)
what could the possible problem be? Is it memory related problems or bug related to JIT code changed?
Thanks

Related

Advanced Android crash analysis?

Is there a way to get more useful information from an android crash? Deliberately inducing a UAF crash in android ICS I get the following output to my logcat, but is there a way to do a more complete stack dump and heap dump at the time of the crash? I can't seem to do it in ddms because as soon as the fatal signal is hit ddms abandons the process (because it doesn't exist anymore)
F/libc ( 598): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)
I/DEBUG ( 33): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEUG ( 33): Build fingerprint: 'generic/sdk/generic:4.0.2/ICS_MR0/229537:eng/test-keys'
I/DEBUG ( 33): pid: 598, tid: 621 >>> com.android.browser <<<
I/DEBUG ( 33): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I/DEBUG ( 33): r0 4b7824f0 r1 004b6da0 r2 00000000 r3 00000000
I/DEBUG ( 33): r4 00e8d7c0 r5 004b6da0 r6 00348370 r7 00000000
I/DEBUG ( 33): r8 49c61b10 r9 4afc808d 10 497df75d fp 00108698
I/DEBUG ( 33): ip 00000000 sp 4b7824f0 lr 496bf215 pc 00000000 cpsr 20000010
I/DEBUG ( 33): d0 44750000cf000000 d1 44c1000000000000
I/DEBUG ( 33): d2 0000000044c10000 d3 4475000044750000
I/DEBUG ( 33): d4 0000000000000000 d5 44c1000000000000
I/DEBUG ( 33): d6 0000000000000000 d7 0000000000000000
I/DEBUG ( 33): d8 0000000000000000 d9 3fa999999999999a
I/DEBUG ( 33): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 33): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 33): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 33): scr 60000013
I/DEBUG ( 33):
I/DEBUG ( 33): #00 pc 00000000
I/DEBUG ( 33): #01 pc 00191212 /system/lib/libwebcore.so
I/DEBUG ( 33): #02 pc 001745c8 /system/lib/libwebcore.so
I/DEBUG ( 33): #03 pc 002b1766 /system/lib/libwebcore.so
I/DEBUG ( 33): #04 pc 004dccae /system/lib/libwebcore.so
I/DEBUG ( 33): #05 pc 004e052a /system/lib/libwebcore.so
I/DEBUG ( 33): #06 pc 004c3aae /system/lib/libwebcore.so
I/DEBUG ( 33): #07 pc 004c3b34 /system/lib/libwebcore.so
I/DEBUG ( 33):
I/DEBUG ( 33): code around pc:
I/DEBUG ( 33): 00000000 ffffffff ffffffff ffffffff ffffffff
I/DEBUG ( 33): 00000010 ffffffff ffffffff ffffffff ffffffff
I/DEBUG ( 33): 00000020 ffffffff ffffffff ffffffff ffffffff
I/DEBUG ( 33): 00000030 ffffffff ffffffff ffffffff ffffffff
I/DEBUG ( 33): 00000040 ffffffff ffffffff ffffffff ffffffff
I/DEBUG ( 33):
I/DEBUG ( 33): code around lr:
I/DEBUG ( 33): 496bf1f4 47904668 bd0e9801 68c3b507 b1134601
I/DEBUG ( 33): 496bf204 fc64f004 6800e005 20b0f8d0 47904668
I/DEBUG ( 33): 496bf214 bd0e9800 68c3b510 f004b113 e001fc49
I/DEBUG ( 33): 496bf224 fd18f7fe bf00bd10 68c3b510 f004b113
I/DEBUG ( 33): 496bf234 e001fc31 fd04f7fe bf00bd10 0124f1a1
I/DEBUG ( 33):
I/DEBUG ( 33): stack:
I/DEBUG ( 33): 4b7824b0 00738f28
I/DEBUG ( 33): 4b7824b4 00348370
I/DEBUG ( 33): 4b7824b8 00000000
I/DEBUG ( 33): 4b7824bc 49c61b10
I/DEBUG ( 33): 4b7824c0 4afc808d
I/DEBUG ( 33): 4b7824c4 497df75d /system/lib/libwebcore.so
I/DEBUG ( 33): 4b7824c8 00108698
I/DEBUG ( 33): 4b7824cc 49857421 /system/lib/libwebcore.so
I/DEBUG ( 33): 4b7824d0 00e7c388
I/DEBUG ( 33): 4b7824d4 00000000
I/DEBUG ( 33): 4b7824d8 00e7c388
I/DEBUG ( 33): 4b7824dc 498573f9 /system/lib/libwebcore.so
I/DEBUG ( 33): 4b7824e0 00e7c388
I/DEBUG ( 33): 4b7824e4 00000000
I/DEBUG ( 33): 4b7824e8 df0027ad
I/DEBUG ( 33): 4b7824ec 00000000
I/DEBUG ( 33): #01 4b7824f0 004b6da0
I/DEBUG ( 33): 4b7824f4 00000001
I/DEBUG ( 33): 4b7824f8 00000000
I/DEBUG ( 33): 4b7824fc 496a25cd /system/lib/libwebcore.so
You can see the complete logs of the device by selecting All messages(no filters) option in Logcat.

EGL display not valid in Native Activity on Android

I have the following Project I am working on. I am trying to do a simple 2D TriandleFan box.
However, when I run the project the following line fails...
this->display = display;
I can't see why it is failing can anyone else see it?
F/libc ( 5178): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 5191 (gleason.gles.na)
I/ActivityManager( 278): Displayed com.gleason.gles.na/android.app.NativeActivity: +826ms
I/DEBUG ( 35): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 35): Build fingerprint: 'generic/sdk/generic:4.2.2/JB_MR1.1/576024:eng/test-keys'
I/DEBUG ( 35): Revision: '0'
I/DEBUG ( 35): pid: 5178, tid: 5191, name: UNKNOWN >>> com.gleason.gles.na <<<
I/DEBUG ( 35): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I/DEBUG ( 35): r0 00000001 r1 00000000 r2 4045e6cc r3 404608a8
I/DEBUG ( 35): r4 00003038 r5 00001f90 r6 2a027378 r7 00000000
I/DEBUG ( 35): r8 4924ae1c r9 00100000 sl 2a027378 fp 00000016
I/DEBUG ( 35): ip 00000000 sp 4924adf0 lr 40427f29 pc 491468ae cpsr 00000030
I/DEBUG ( 35): d0 3f8000003f800000 d1 3ff000003f800000
I/DEBUG ( 35): d2 3ff0000000000000 d3 bf62cda764a98eab
I/DEBUG ( 35): d4 4000000000000000 d5 3f40000000000000
I/DEBUG ( 35): d6 3fe999999999999a d7 3f8000003f800000
I/DEBUG ( 35): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 35): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 35): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 35): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 35): scr 60000010
I/DEBUG ( 35):
I/DEBUG ( 35): backtrace:
I/DEBUG ( 35): #00 pc 000018ae /data/app-lib/com.gleason.gles.na-2/libsimplena.so (Application::initWindow(android_app*)+45)
I/DEBUG ( 35): #01 pc 00001a25 /data/app-lib/com.gleason.gles.na-2/libsimplena.so (Application::handleCommand(android_app*, int)+36)
I/DEBUG ( 35): #02 pc 00001a57 /data/app-lib/com.gleason.gles.na-2/libsimplena.so
I/DEBUG ( 35): #03 pc 00001ff9 /data/app-lib/com.gleason.gles.na-2/libsimplena.so
I/DEBUG ( 35): #04 pc 00001a87 /data/app-lib/com.gleason.gles.na-2/libsimplena.so (Application::run()+42)
I/DEBUG ( 35): #05 pc 00001acf /data/app-lib/com.gleason.gles.na-2/libsimplena.so (android_main+54)
I/DEBUG ( 35): #06 pc 00001b85 /data/app-lib/com.gleason.gles.na-2/libsimplena.so
I/DEBUG ( 35): #07 pc 0000e3b8 /system/lib/libc.so (__thread_entry+72)
I/DEBUG ( 35): #08 pc 0000dab0 /system/lib/libc.so (pthread_create+160)

Using pjsua for android

Greetings to everyone!
I'm trying to compile pjsua using the following branch:
http://svn.pjsip.org/repos/pjproject/branches/projects/android/. I've
tried to do a push (adb push pjsua /data/local/) to my Android-sdk
emulator but, when I've tried to execute it via adb shell, the Android
LogCat gave me the following SIGFAULT error: where am I wrong? Thanks
in advance.
F/libc ( 464): Fatal signal 11 (SIGSEGV) at 0x000000f0 (code=1)
I/DEBUG ( 33): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 33): Build fingerprint:'generic/sdk/generic:4.0.3/MR1/237985:eng/test-keys'
I/DEBUG ( 33): pid: 464, tid: 464 >>> ./pjsua-arm-unknown-linux-androideabi <<<
I/DEBUG ( 33): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 000000f0
I/DEBUG ( 33): r0 ffffffff r1 beef7c30 r2 beef7c30 r3 ffffffff
I/DEBUG ( 33): r4 00000000 r5 00000000 r6 00000000 r7 00000000
I/DEBUG ( 33): r8 00000000 r9 00000000 10 00000000 fp 00000000
I/DEBUG ( 33): ip 4003c4b9 sp beef7c60 lr 4003c4b1 pc b000469a cpsr 00000030
I/DEBUG ( 33): d0 00000000bd6bc8e3 d1 0000000000000000
I/DEBUG ( 33): d2 0000000000000000 d3 0000000000000000
I/DEBUG ( 33): d4 0000000000000000 d5 41c8f0a46e800000
I/DEBUG ( 33): d6 3f50624dd2f1a9fc d7 c18af9670cce266f
I/DEBUG ( 33): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 33): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 33): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 33): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 33): scr 00000010
I/DEBUG ( 33):
I/DEBUG ( 33): #00 pc b000469a /system/bin/linker
I/DEBUG ( 33): #01 pc 000264ac /system/lib/libc.so (__set_errno)
I/DEBUG ( 33):
I/DEBUG ( 33): code around pc:
I/DEBUG ( 33): b0004678 95004840 44784a40 4d414b40 447b447a #H..#JxD#KAMzD{D
I/DEBUG ( 33): b0004688 682d447d f44f9103 95017140 f0009402 }D-h..O.#q......
I/DEBUG ( 33): b0004698 f8d4ff67 b10330f0 f8d44798 b17000e0 g....0...G....p.
I/DEBUG ( 33): b00046a8 10e4f8d4 f7ff2200 2000f9b5 f8d4e007 ....."..... ....
I/DEBUG ( 33): b00046b8 f04f20a8 f04230ff f8c40102 b00710a8 .O..0B.........
I/DEBUG ( 33):
I/DEBUG ( 33): code around lr:
I/DEBUG ( 33): 4003c490 f240b507 9300736c 33fff04f 466b9301 ..#.ls..O..3..kF
I/DEBUG ( 33): 4003c4a0 fd80f7ff bf00bd0e 4604b510 fe90f7ec ...........F....
I/DEBUG ( 33): 4003c4b0 f04f6004 bd1030ff 0ffff110 db02b510 .`O..0..........
I/DEBUG ( 33): 4003c4c0 f7ff4240 bd10fff1 48214603 4478b5f0 #B.......F!H..xD
I/DEBUG ( 33): 4003c4d0 b0976800 68022150 4620ac01 92154e1d .h..P!.h.. F.N..
I/DEBUG ( 33):
I/DEBUG ( 33): stack:
I/DEBUG ( 33): beef7c20 00000000
I/DEBUG ( 33): beef7c24 4003c4c7 /system/lib/libc.so
I/DEBUG ( 33): beef7c28 00000000
I/DEBUG ( 33): beef7c2c 4002f477 /system/lib/libc.so
I/DEBUG ( 33): beef7c30 b00144c4
I/DEBUG ( 33): beef7c34 00000000
I/DEBUG ( 33): beef7c38 10000000
I/DEBUG ( 33): beef7c3c 00000000
I/DEBUG ( 33): beef7c40 00000000
I/DEBUG ( 33): beef7c44 4002f49b /system/lib/libc.so
I/DEBUG ( 33): beef7c48 00000000
I/DEBUG ( 33): beef7c4c 0000c090 /data/local/pjsua-arm-unknown-linux-androideabi
I/DEBUG ( 33): beef7c50 b00144c4
I/DEBUG ( 33): beef7c54 0000c070 /data/local/pjsua-arm-unknown-linux-androideabi
I/DEBUG ( 33): beef7c58 df0027ad
I/DEBUG ( 33): beef7c5c 00000000
I/DEBUG ( 33): #01 beef7c60 00000001
I/DEBUG ( 33): beef7c64 beef7d47 [stack]
I/DEBUG ( 33): beef7c68 00000000
I/DEBUG ( 33): beef7c6c beef7d6d [stack]
I/DEBUG ( 33): beef7c70 beef7d82 [stack]
I/DEBUG ( 33): beef7c74 beef7d92 [stack]
I/DEBUG ( 33): beef7c78 beef7dba [stack]
I/DEBUG ( 33): beef7c7c beef7df7 [stack]
I/DEBUG ( 33): beef7c80 beef7e10 [stack]
I/DEBUG ( 33): beef7c84 beef7e2a [stack]
I/DEBUG ( 33): beef7c88 beef7f55 [stack]
I/DEBUG ( 33): beef7c8c beef7f68 [stack]
I/DEBUG ( 33): beef7c90 beef7f83 [stack]
I/DEBUG ( 33): beef7c94 beef7fa0 [stack]
I/DEBUG ( 33): beef7c98 beef7fb3 [stack]
I/DEBUG ( 33): beef7c9c 00000000
I/DEBUG ( 33): beef7ca0 00000010
I/DEBUG ( 33): beef7ca4 000030d7
EDIT 1: I must remark that I already know solutions such as csipsimple. Anyway, I'm interested to resolve my cross-compiling issue with Android-ndk's tools.
Why not trying to use an android device instead?
I red in the android website that the android simulator is usually not compatible with sip stacks.

libspotify.so.12.1.51 segfaults on Android

I've modified the jukebox example to run on Android, but it segfaults miserably when trying to call the sp_session_create() function.
Basically - I have a helloworld Android app with a button. When pressed it calls this function, which crashes on sp_session_create():
JNIEXPORT void JNICALL Java_com_holidaystudios_unispot_uniSpot_prepareSpotify() {
sp_session *sp;
sp_error err;
const char *username = NULL;
const char *password = NULL;
username = __USERNAME;
password = __PASSWORD;
g_listname = __PLAYLIST;
UNISPOT_DEBUG("prepareSpotify() - 1\n");
audio_init(&g_audiofifo);
UNISPOT_DEBUG("prepareSpotify() - 2\n");
/* Create session */
spconfig.application_key_size = g_appkey_size;
UNISPOT_DEBUG("prepareSpotify() - 3 %d, %p, %p (%p)\n", g_appkey_size, &spconfig, &sp, sp_session_create);
err = sp_session_create(&spconfig, &sp);
UNISPOT_DEBUG("prepareSpotify() - 4\n");
.
.
.
Here's the logcat output which shows the segfault:
I/UNISPOT|NDK( 5951): prepareSpotify() - 1
I/UNISPOT|NDK( 5951): prepareSpotify() - 2
I/UNISPOT|NDK( 5951): prepareSpotify() - 3 321, 0x575115ac, 0xbec4052c (0x5b4107b4)
F/libc ( 5951): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)
I/DEBUG (31750): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG (31750): Build fingerprint: 'google/yakju/maguro:4.0.4/IMM76I/330937:user/release-keys'
I/DEBUG (31750): pid: 5951, tid: 5951 >>> com.holidaystudios.unispot <<<
I/DEBUG (31750): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I/DEBUG (31750): r0 0155d708 r1 4006162c r2 00000000 r3 5b47add8
I/DEBUG (31750): r4 0155d708 r5 5b47e740 r6 57508d48 r7 0155d708
I/DEBUG (31750): r8 bec40460 r9 bec4052c 10 0155d768 fp 0155d768
I/DEBUG (31750): ip 40061474 sp bec40340 lr 5b410a7c pc 5b4104f4 cpsr 60000010
I/DEBUG (31750): d0 00656c6f736e6f63 d1 72616364732f2061
I/DEBUG (31750): d2 61726f74532f2f63 d3 7865646e692f6568
I/DEBUG (31750): d4 0000000000000000 d5 0000000000000000
I/DEBUG (31750): d6 0000000000000000 d7 00f92b8000000000
I/DEBUG (31750): d8 0000000000000000 d9 0000000000000000
I/DEBUG (31750): d10 0000000000000000 d11 0000000000000000
I/DEBUG (31750): d12 0000000000000000 d13 0000000000000000
I/DEBUG (31750): d14 0000000000000000 d15 0000000000000000
I/DEBUG (31750): d16 416f257010000000 d17 3fe0000000000000
I/DEBUG (31750): d18 0000000000000000 d19 3fe5555560000000
I/DEBUG (31750): d20 0000000000000000 d21 0000000000000000
I/DEBUG (31750): d22 3ff0000000000000 d23 0000000000000000
I/DEBUG (31750): d24 0000000000000000 d25 3fe5555560000000
I/DEBUG (31750): d26 0000000000000000 d27 3fe5555560000000
I/DEBUG (31750): d28 0000000000000000 d29 3ff0000000000000
I/DEBUG (31750): d30 3ff0000000000000 d31 be23e4f5df600000
I/DEBUG (31750): scr 80000013
I/DEBUG (31750):
I/DEBUG (31750): #00 pc 0016b4f4 /data/data/com.holidaystudios.unispot/lib/libspotify.so
I/DEBUG (31750): #01 lr 5b410a7c /data/data/com.holidaystudios.unispot/lib/libspotify.so
I/DEBUG (31750):
I/DEBUG (31750): code around pc:
I/DEBUG (31750): 5b4104d4 e59f50ac e59f30ac e08f5005 e7953003 .P...0...P...0..
I/DEBUG (31750): 5b4104e4 e5902004 e2833008 e5803000 e1a04000 . ...0...0...#..
I/DEBUG (31750): 5b4104f4 e5923000 e1a00002 e1a0e00f e593f178 .0..........x...
I/DEBUG (31750): 5b410504 e5943004 e3530000 0a000005 e3a02000 .0....S...... ..
I/DEBUG (31750): 5b410514 e1a00003 e5842004 e5933000 e1a0e00f ..... ...0......
I/DEBUG (31750):
I/DEBUG (31750): code around lr:
I/DEBUG (31750): 5b410a5c ebfaaa07 e5c7822c e1a00007 ebfffdec ....,...........
I/DEBUG (31750): 5b410a6c e3500000 1a000005 e1a00007 ebfffe94 ..P.............
I/DEBUG (31750): 5b410a7c e1a00007 ebfc951c e3a04002 ea00009d .........#......
I/DEBUG (31750): 5b410a8c e1a01006 e4d13001 e5c73064 e3a02080 .....0..d0... ..
I/DEBUG (31750): 5b410a9c e2870065 ebfaa8ee e3a020c0 e2861081 e........ ......
I/DEBUG (31750):
I/DEBUG (31750): stack:
I/DEBUG (31750): bec40300 0155d9c8 [heap]
I/DEBUG (31750): bec40304 5b37f080 /data/data/com.holidaystudios.unispot/lib/libspotify.so
I/DEBUG (31750): bec40308 0155d708 [heap]
I/DEBUG (31750): bec4030c 5b47e740 /data/data/com.holidaystudios.unispot/lib/libspotify.so
I/DEBUG (31750): bec40310 57508d48 /data/data/com.holidaystudios.unispot/lib/liblespot.so
I/DEBUG (31750): bec40314 5b410230 /data/data/com.holidaystudios.unispot/lib/libspotify.so
I/DEBUG (31750): bec40318 00000400
I/DEBUG (31750): bec4031c bec40460 [stack]
I/DEBUG (31750): bec40320 bec4052c [stack]
I/DEBUG (31750): bec40324 0155d768 [heap]
I/DEBUG (31750): bec40328 0155d768 [heap]
I/DEBUG (31750): bec4032c 5b33f988 /data/data/com.holidaystudios.unispot/lib/libspotify.so
I/DEBUG (31750): bec40330 00000000
I/DEBUG (31750): bec40334 00040000
I/DEBUG (31750): bec40338 df0027ad
I/DEBUG (31750): bec4033c 00000000
I/DEBUG (31750): #00 bec40340 575115ac /data/data/com.holidaystudios.unispot/lib/liblespot.so
I/DEBUG (31750): bec40344 5b47e740 /data/data/com.holidaystudios.unispot/lib/libspotify.so
I/DEBUG (31750): bec40348 57508d48 /data/data/com.holidaystudios.unispot/lib/liblespot.so
I/DEBUG (31750): bec4034c 5b410a7c /data/data/com.holidaystudios.unispot/lib/libspotify.so
I/DEBUG (31750): bec40350 00000000
I/DEBUG (31750): bec40354 57e90026 /system/framework/framework.odex
I/DEBUG (31750): bec40358 41678018 /dev/ashmem/dalvik-heap (deleted)
I/DEBUG (31750): bec4035c bec404e4 [stack]
I/DEBUG (31750): bec40360 00000000
I/DEBUG (31750): bec40364 00010001
I/DEBUG (31750): bec40368 00000000
I/DEBUG (31750): bec4036c 00000000
I/DEBUG (31750): bec40370 416a9ee8 /dev/ashmem/dalvik-heap (deleted)
I/DEBUG (31750): bec40374 416a9ee8 /dev/ashmem/dalvik-heap (deleted)
I/DEBUG (31750): bec40378 41678018 /dev/ashmem/dalvik-heap (deleted)
I/DEBUG (31750): bec4037c 00000024
I/DEBUG (31750): bec40380 01303740 [heap]
I/DEBUG (31750): bec40384 408a39b8
I/BootReceiver( 189): Copying /data/tombstones/tombstone_00 to DropBox (SYSTEM_TOMBSTONE)
I/WindowManager( 189): WIN DEATH: Window{416abe40 com.holidaystudios.unispot/com.holidaystudios.unispot.uniSpot paused=false}
I/ActivityManager( 189): Process com.holidaystudios.unispot (pid 5951) has died.
Any ideas?
I'm posting this as an answer since it seems I need more reputation to answer comments, but, to answer #KurtCobain's request: you also need to make sure that your cache_location and settings_location point to a valid, writable location on your android device. The default value in the spotify examples for those variables is "tmp". This won't work and will cause your app to crash.
Instead (at least as a temporary, straightforward solution) you could use something like Context.getCacheDir in your activity to retrieve a valid temporary folder, and use this value in your C code (see this question for more info on that).
I finally figured out what the problem is. If your AndroidManifest.xml does not request the INTERNET permission (and possibly WRITE_EXTERNAL_STORAGE) it will crash... Unfortunately libspotify does not perform any checks on creating sockets and will therefore crash... I'd say it's actually a bug in libspotify... But anyhoo - here's what you need to add to your AndroidManifest.xml if you are having the same problem as I did:
<uses-permission android:name="android.permission.INTERNET" />
Possibly also this:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

reboot using newly built libdvm.so gives fatal error

I have changed the structure of the JIT table (pJitEntryTable in /
dalvik/vm/Globals.h) from a chained array(sort of hash) to a
combination of hash table and B-tree. It finds hashed value based on
PC and enters the corresponding JitEntry(dalvik address,translated
address) into the b-tree pointed by the hashed index. I built the code
successfully and pushed libdvm.so file into the emulator and rebooted
the emulator by killing zygote. But the boot screen is showing
"android" for infinite time and when i did a $adb logcat i found the
following log
I/DEBUG ( 33): *** *** *** *** *** *** *** *** *** *** *** ***
*** *** *** ***
I/DEBUG ( 33): Build fingerprint: 'generic/sdk/generic:4.0.3/
MR1/237985:eng/test-keys'
I/DEBUG ( 33): pid: 491, tid: 520 >>> system_server <<<
I/DEBUG ( 33): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault
addr 002e0080
I/DEBUG ( 33): r0 002e0081 r1 4d685228 r2 00000014 r3 002e006d
I/DEBUG ( 33): r4 4d685228 r5 51669e38 r6 001de3b8 r7 000086f4
I/DEBUG ( 33): r8 407d9dc0 r9 00000002 10 00000000 fp 520a0e68
I/DEBUG ( 33): ip 00000030 sp 520a0da0 lr 00000000 pc
002e0080 cpsr 20000030
I/DEBUG ( 33): d0 437000004382353f d1 3ff0000043700000
I/DEBUG ( 33): d2 3ff0000000000000 d3 4197d78400000000
I/DEBUG ( 33): d4 3ff0000000000000 d5 4028000000000000
I/DEBUG ( 33): d6 43e0000000000000 d7 000000f000000000
I/DEBUG ( 33): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 33): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 33): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 33): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 33): scr 80000012
I/DEBUG ( 33):
D/dalvikvm( 491): in getCodeAddrCommon function
D/dalvikvm( 491): searching in the JIT table
I/DEBUG ( 33): #00 pc 002e0080
I/DEBUG ( 33): #01 lr 00000000 <unknown>
I/DEBUG ( 33):
I/DEBUG ( 33): code around pc:
I/DEBUG ( 33): 002e0060 ffffffff ffffffff ffffffff
ffffffff ................
I/DEBUG ( 33): 002e0070 ffffffff ffffffff ffffffff
ffffffff ................
I/DEBUG ( 33): 002e0080 ffffffff ffffffff ffffffff
ffffffff ................
I/DEBUG ( 33): 002e0090 ffffffff ffffffff ffffffff
ffffffff ................
I/DEBUG ( 33): 002e00a0 ffffffff ffffffff ffffffff
ffffffff ................
I/DEBUG ( 33):
I/DEBUG ( 33): code around lr:
I/DEBUG ( 33): 00000000 ffffffff ffffffff ffffffff
ffffffff ................
I/DEBUG ( 33): 00000010 ffffffff ffffffff ffffffff
ffffffff ................
I/DEBUG ( 33): 00000020 ffffffff ffffffff ffffffff
ffffffff ................
I/DEBUG ( 33): 00000030 ffffffff ffffffff ffffffff
ffffffff ................
I/DEBUG ( 33): 00000040 ffffffff ffffffff ffffffff
ffffffff ................
I/DEBUG ( 33):
I/DEBUG ( 33): memory map around addr 002e0080:
I/DEBUG ( 33): 0000b000-00237000 [heap]
I/DEBUG ( 33): (no map for address)
I/DEBUG ( 33): 10000000-10001000
I/DEBUG ( 33):
I/DEBUG ( 33): stack:
I/DEBUG ( 33): 520a0d60 4d685228 /system/framework/
framework.odex
I/DEBUG ( 33): 520a0d64 00000000
I/DEBUG ( 33): 520a0d68 00000000
I/DEBUG ( 33): 520a0d6c 407d9dc0 /system/lib/libdvm.so
I/DEBUG ( 33): 520a0d70 00000002
I/DEBUG ( 33): 520a0d74 00000000
I/DEBUG ( 33): 520a0d78 520a0e68
I/DEBUG ( 33): 520a0d7c 4083c78b /system/lib/libdvm.so
I/DEBUG ( 33): 520a0d80 4d685228 /system/framework/
framework.odex
I/DEBUG ( 33): 520a0d84 51669e38
I/DEBUG ( 33): 520a0d88 001de3b8 [heap]
I/DEBUG ( 33): 520a0d8c 000086f4 /system/bin/app_process
I/DEBUG ( 33): 520a0d90 407d9dc0 /system/lib/libdvm.so
I/DEBUG ( 33): 520a0d94 4083c7e5 /system/lib/libdvm.so
I/DEBUG ( 33): 520a0d98 df0027ad
I/DEBUG ( 33): 520a0d9c 00000000
I/DEBUG ( 33): #00 520a0da0 00000000
I/DEBUG ( 33): 520a0da4 001de3b8 [heap]
I/DEBUG ( 33): 520a0da8 4086ef90 /system/lib/libdvm.so
I/DEBUG ( 33): 520a0dac 520a0dd8
I/DEBUG ( 33): 520a0db0 44e6bb60 /dev/ashmem/dalvik-
LinearAlloc (deleted)
I/DEBUG ( 33): 520a0db4 520a0e1c
I/DEBUG ( 33): 520a0db8 00000000
I/DEBUG ( 33): 520a0dbc fffffe60
I/DEBUG ( 33): 520a0dc0 520a0e68
I/DEBUG ( 33): 520a0dc4 407ef200 /system/lib/libdvm.so
I/DEBUG ( 33): 520a0dc8 00000000
I/DEBUG ( 33): 520a0dcc 00000000
I/DEBUG ( 33): 520a0dd0 00000000
I/DEBUG ( 33): 520a0dd4 520a0eb8
I/DEBUG ( 33): 520a0dd8 00000000
I/DEBUG ( 33): 520a0ddc 00000000
I/DEBUG ( 33): 520a0de0 00000000
I/DEBUG ( 33): 520a0de4 00000000
I don't understand the error. Do i need to make any adjustments to the
jit code cache size and heap size? Any help regarding this will be
appreciated.
Thanks
This is a segfault crash. Something is trying to access a segment of memory that hasn't been allocated, or it is otherwise not allowed to. This most likely indicates a bug in the libdvm changes that you made.
Debugging will be tricky. What I would try is to build a libdvm_new.so and dalvikvm_new binary that links against it, and push those to a device/emulator (rather than replacing the existing libdvm.so and dalvikvm) and then use gdb-server and gdb to debug dalvikvm_new, on a command line type program (the typical static void main(String[] args) type program).

Categories

Resources