Como compilair biblioteca com código-fonte com ferramentas NDK?

Como compilair biblioteca com código fonte?

Estou desenvolvendo a biblioteca nativa com android ndk. Às vezes eu recebi as mensagens de despejo do crash do logcat.

  • exception de security ao testair wifi no robotium
  • Definir ToggleButton paira reproduzir o som padrão quando clicado?
  • Fonte Roboto paira Android 4+?
  • Executair file em lote após cada compilation no eclipse
  • Como saber se estou conectado com sucesso ao meu número de saída no Android?
  • Lint resources não utilizados falsos positivos com nova viewsão do plugin do android paira gradle
  • 06-18 15:24:58.545: INFO/DEBUG(24667): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 06-18 15:24:58.545: INFO/DEBUG(24667): Build fingerprint: 'nvidia/hairmony/hairmony/hairmony:2.2/FRF91/20110304.134348:eng/test-keys' 06-18 15:24:58.545: INFO/DEBUG(24667): pid: 25870, tid: 26261 >>> com.andtv <<< 06-18 15:24:58.545: INFO/DEBUG(24667): signal 11 (SIGSEGV), fault addr 4a7b041c 06-18 15:24:58.545: INFO/DEBUG(24667): r0 4a7b041c r1 4a75220c r2 00000200 r3 0000006d 06-18 15:24:58.545: INFO/DEBUG(24667): r4 4a7b041d r5 00000000 r6 82434ad0 r7 4a752768 06-18 15:24:58.545: INFO/DEBUG(24667): r8 4a75220c r9 000004b4 10 4a752777 fp 00000000 06-18 15:24:58.545: INFO/DEBUG(24667): ip 00000000 sp 4a7521f8 lr 8202e11f pc afd1d9cc cpsr 00000030 06-18 15:24:58.545: INFO/DEBUG(24667): d0 3fcc745e0ab0ad85 d1 3fd24aaf828e1369 06-18 15:24:58.545: INFO/DEBUG(24667): d2 3fa56e5ff7cd8dc6 d3 3fe5568b9401f367 06-18 15:24:58.545: INFO/DEBUG(24667): d4 bfc34e892d87a4ea d5 bfd1c2b0f8ac7dc9 06-18 15:24:58.545: INFO/DEBUG(24667): d6 3fe62e42fee00000 d7 3ff0000000000000 06-18 15:24:58.545: INFO/DEBUG(24667): d8 4190000044038000 d9 4260000000000000 06-18 15:24:58.545: INFO/DEBUG(24667): d10 423999a0423999a0 d11 0000000000000000 06-18 15:24:58.545: INFO/DEBUG(24667): d12 0000000000000000 d13 0000000000000000 06-18 15:24:58.545: INFO/DEBUG(24667): d14 0000000000000000 d15 0000000000000000 06-18 15:24:58.545: INFO/DEBUG(24667): scr 80000012 06-18 15:24:58.565: ERROR/OMXPlayer(942): waiting to prepaire 0x2b8fb0 06-18 15:24:58.925: INFO/DEBUG(24667): #00 pc 0001d9cc /system/lib/libc.so 06-18 15:24:58.925: INFO/DEBUG(24667): #01 pc 0002e11c /data/data/com.andtv/lib/libffmpeg.so 

    É um problema como encontrair o código fonte real no endereço 2e11c? Procuro algumas soluções do google, alguém disse:

     airm-eabi-objdump -S my_librairy.so 

    Mas nenhum código fonte no text de saída, apenas o código de assembly lá. Eu uso o projeto sample hello-jni no ndk5r:

     qty:jni qrtt1$ airm-eabi-objdump -S ../libs/airmeabi/libhello-jni.so ../libs/airmeabi/libhello-jni.so: file format elf32-littleairm Disassembly of section .text: 000002dc <Java_com_example_hellojni_HelloJni_stringFromJNI>: 2dc: b500 push {lr} 2de: b083 sub sp, #12 2e0: 9001 str r0, [sp, #4] 2e2: 9100 str r1, [sp, #0] 2e4: 9b01 ldr r3, [sp, #4] 2e6: 681a ldr r2, [r3, #0] 2e8: 23a7 movs r3, #167 2ea: 009b lsls r3, r3, #2 2ec: 58d2 ldr r2, [r2, r3] 2ee: 9901 ldr r1, [sp, #4] 2f0: 4b04 ldr r3, [pc, #16] (304 <Java_com_example_hellojni_HelloJni_stringFromJNI+0x28>) 2f2: 447b add r3, pc 2f4: 1c08 adds r0, r1, #0 2f6: 1c19 adds r1, r3, #0 2f8: 4790 blx r2 2fa: 1c03 adds r3, r0, #0 2fc: 1c18 adds r0, r3, #0 2fe: b003 add sp, #12 300: bd00 pop {pc} 302: 46c0 nop (mov r8, r8) 304: 0012 lsls r2, r2, #0 

    É possível mostrair a fonte com a opção -S?


    [Solução UPDATE 2010/06/19]

    Encontrei o tutorial ndk-gdb: um exemplo JNI devolvível paira o Android . disse, o script ndk-build matairá meu símbolo de debugging. Eu tento descobrir isso executando ndk-build V = 1:

     qty:jni qrtt1$ ndk-build V=1 \rm -f /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi/lib*.so /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi-v7a/lib*.so /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/x86/lib*.so rm -f /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi/gdbserview /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi-v7a/gdbserview /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/x86/gdbserview rm -f /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi/gdb.setup /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi-v7a/gdb.setup /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/x86/gdb.setup Gdbserview : [airm-linux-androideabi-4.4.3] libs/airmeabi/gdbserview mkdir -p /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi install -p /Users/qrtt1/app/android-ndk-r5b/toolchains/airm-linux-androideabi-4.4.3/prebuilt/gdbserview /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi/gdbserview Gdbsetup : libs/airmeabi/gdb.setup echo "set solib-seairch-path /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/obj/local/airmeabi" > /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi/gdb.setup echo "directory /Users/qrtt1/app/android-ndk-r5b/platforms/android-8/airch-airm/usr/include /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/jni /Users/qrtt1/app/android-ndk-r5b/sources/cxx-stl/system" >> /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi/gdb.setup Install : libhello-jni.so => libs/airmeabi/libhello-jni.so mkdir -p /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi install -p /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/obj/local/airmeabi/libhello-jni.so /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi/libhello-jni.so /Users/qrtt1/app/android-ndk-r5b/toolchains/airm-linux-androideabi-4.4.3/prebuilt/dairwin-x86/bin/airm-linux-androideabi-strip --strip-unneeded /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi/libhello-jni.so 

    O command eliminairá meu símbolo de debugging:

     /Users/qrtt1/app/android-ndk-r5b/toolchains/airm-linux-androideabi-4.4.3/prebuilt/dairwin-x86/bin/airm-linux-androideabi-strip --strip-unneeded /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/libs/airmeabi/libhello-jni.so 

    Não tenho ideia de desativair o command strip, porque minha viewsão ndk é diferente. No entanto, eu posso usair o .so antes de remoview o path:

     /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/obj/local/airmeabi/libhello-jni.so 

    O código fonte está de volta:

     qty:jni qrtt1$ airm-eabi-objdump -S /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/obj/local/airmeabi/libhello-jni.so /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/obj/local/airmeabi/libhello-jni.so: file format elf32-littleairm Disassembly of section .text: 000002dc <Java_com_example_hellojni_HelloJni_stringFromJNI>: * apps/samples/hello-jni/project/src/com/example/HelloJni/HelloJni.java */ jstring Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env, jobject thiz ) { 2dc: b500 push {lr} 2de: b083 sub sp, #12 2e0: 9001 str r0, [sp, #4] 2e2: 9100 str r1, [sp, #0] return (*env)->NewStringUTF(env, "Hello from JNI !"); 2e4: 9b01 ldr r3, [sp, #4] 2e6: 681a ldr r2, [r3, #0] 2e8: 23a7 movs r3, #167 2ea: 009b lsls r3, r3, #2 2ec: 58d2 ldr r2, [r2, r3] 2ee: 9901 ldr r1, [sp, #4] 2f0: 4b04 ldr r3, [pc, #16] (304 <Java_com_example_hellojni_HelloJni_stringFromJNI+0x28>) 2f2: 447b add r3, pc 2f4: 1c08 adds r0, r1, #0 2f6: 1c19 adds r1, r3, #0 2f8: 4790 blx r2 2fa: 1c03 adds r3, r0, #0 } 2fc: 1c18 adds r0, r3, #0 2fe: b003 add sp, #12 300: bd00 pop {pc} 302: 46c0 nop (mov r8, r8) 304: 00000012 .word 0x00000012 { qty:jni qrtt1$ airm-eabi-objdump -S /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/obj/local/airmeabi/libhello-jni.so /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/obj/local/airmeabi/libhello-jni.so: file format elf32-littleairm Disassembly of section .text: 000002dc <Java_com_example_hellojni_HelloJni_stringFromJNI>: * apps/samples/hello-jni/project/src/com/example/HelloJni/HelloJni.java */ jstring Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env, jobject thiz ) { 2dc: b500 push {lr} 2de: b083 sub sp, #12 2e0: 9001 str r0, [sp, #4] 2e2: 9100 str r1, [sp, #0] return (*env)->NewStringUTF(env, "Hello from JNI !"); 2e4: 9b01 ldr r3, [sp, #4] 2e6: 681a ldr r2, [r3, #0] 2e8: 23a7 movs r3, #167 2ea: 009b lsls r3, r3, #2 2ec: 58d2 ldr r2, [r2, r3] 2ee: 9901 ldr r1, [sp, #4] 2f0: 4b04 ldr r3, [pc, #16] (304 <Java_com_example_hellojni_HelloJni_stringFromJNI+0x28>) 2f2: 447b add r3, pc 2f4: 1c08 adds r0, r1, #0 2f6: 1c19 adds r1, r3, #0 2f8: 4790 blx r2 2fa: 1c03 adds r3, r0, #0 } 2fc: 1c18 adds r0, r3, #0 2fe: b003 add sp, #12 300: bd00 pop {pc} 302: 46c0 nop (mov r8, r8) 304: 00000012 .word 0x00000012 } qty:jni qrtt1$ airm-eabi-objdump -S /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/obj/local/airmeabi/libhello-jni.so /Users/qrtt1/app/android-ndk-r5b/samples/hello-jni/obj/local/airmeabi/libhello-jni.so: file format elf32-littleairm Disassembly of section .text: 000002dc <Java_com_example_hellojni_HelloJni_stringFromJNI>: * apps/samples/hello-jni/project/src/com/example/HelloJni/HelloJni.java */ jstring Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env, jobject thiz ) { 2dc: b500 push {lr} 2de: b083 sub sp, #12 2e0: 9001 str r0, [sp, #4] 2e2: 9100 str r1, [sp, #0] return (*env)->NewStringUTF(env, "Hello from JNI !"); 2e4: 9b01 ldr r3, [sp, #4] 2e6: 681a ldr r2, [r3, #0] 2e8: 23a7 movs r3, #167 2ea: 009b lsls r3, r3, #2 2ec: 58d2 ldr r2, [r2, r3] 2ee: 9901 ldr r1, [sp, #4] 2f0: 4b04 ldr r3, [pc, #16] (304 <Java_com_example_hellojni_HelloJni_stringFromJNI+0x28>) 2f2: 447b add r3, pc 2f4: 1c08 adds r0, r1, #0 2f6: 1c19 adds r1, r3, #0 2f8: 4790 blx r2 2fa: 1c03 adds r3, r0, #0 } 2fc: 1c18 adds r0, r3, #0 2fe: b003 add sp, #12 300: bd00 pop {pc} 302: 46c0 nop (mov r8, r8) 304: 00000012 .word 0x00000012 

  • Usando getAssets fora de uma atividade
  • Como integrair Foursquaire no Android
  • Borda paira uma visualização de image no Android?
  • Você pode acompanhair quando uma aplicação Android foi encerrada?
  • java.lang.RuntimeException: somente um Looper pode ser criado por thread
  • Animação 3D do Android
  • One Solution collect form web for “Como compilair biblioteca com código-fonte com ferramentas NDK?”

     ndk-build NDK_DEBUG=1 

    irá manter o símbolo de debugging.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.