[Android] Debugging with gdb.sh

Andrey Gursky andrey.gursky at e-mail.ua
Sun May 29 16:01:50 CEST 2016


I've been debugging VLC-Android on February 2016 last time.
Now gdb.sh does not work anymore for me.

I've added --verbose to NDK_GDB_ARGS and tried with both NDK r10e and r11c.

* NDK r10e:

$ PATH=$PATH:/ABS-PATH-TO-android-sdk-linux/platform-tools ANDROID_SDK=/ABS-PATH-TO-android-sdk-linux ANDROID_NDK=/ABS-PATH-TO-android-ndk-r10e ./gdb.sh 
Android NDK installation path: /ABS-PATH-TO-android-ndk-r10e
Using default adb command: /ABS-PATH-TO-android-sdk-linux/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.32
Revision 09a0d98bebce-android
Using ADB flags: 
Using JDB command: /usr/bin/jdb
Using auto-detected project path: .
Found package name: org.videolan.vlc.debug
ABIs targetted by application: arm64-v8a armeabi armeabi-v7a armeabi-v7a mips mips64 x86 x86_64
Device API Level: 19
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: 
Using gdb setup init: ./libs/armeabi/gdb.setup
Using toolchain prefix: /ABS-PATH-TO-android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi
Found debuggable flag: false
ERROR: Package org.videolan.vlc.debug is not debuggable ! You can fix that in two ways:

  - Rebuilt with the NDK_DEBUG=1 option when calling 'ndk-build'.

  - Modify your manifest to set android:debuggable attribute to "true",
    then rebuild normally.

After one of these, re-install to the device!
$

-----------------

* NDK r11c:

PATH=$PATH:/ABS-PATH-TO-android-sdk-linux/platform-tools ANDROID_SDK=/ABS-PATH-TO-android-sdk-linux ANDROID_NDK=/ABS-PATH-TO-android-ndk-r11c ./gdb.sh 
ADB command used: 'adb -s 4100ee82e443a17b'
ADB version: Android Debug Bridge version 1.0.32 Revision 09a0d98bebce-android
Using project directory: /ABS-PATH-TO-vlc-android.git/.gdb 
Found package name: org.videolan.vlc.debug
Attaching to existing application process.
Application ABIs: arm64-v8a, armeabi, armeabi-v7a, armeabi-v7a-hard, mips, mips64, x86, x86_64
Device ABIs: armeabi-v7a, armeabi
Selecting ABI: armeabi-v7a
Detected pretty printer: none
Found application data directory: /data/data/org.videolan.vlc.debug
App gdbserver not found at /data/data/org.videolan.vlc.debug/lib/gdbserver, uploading.
Uploaded gdbserver to /data/local/tmp/arm-gdbserver
Pulling '/system/bin/linker' to '/ABS-PATH-TO-vlc-android.git/.gdb/obj/local/armeabi-v7a/system/bin/linker'
Pulling '/system/lib/libc.so' to '/ABS-PATH-TO-vlc-android.git/.gdb/obj/local/armeabi-v7a/system/lib/libc.so'
Pulling '/system/lib/libm.so' to '/ABS-PATH-TO-vlc-android.git/.gdb/obj/local/armeabi-v7a/system/lib/libm.so'
Pulling '/system/lib/libdl.so' to '/ABS-PATH-TO-vlc-android.git/.gdb/obj/local/armeabi-v7a/system/lib/libdl.so'
Starting gdbserver...
Redirecting gdbserver output to /tmp/gdbclient.log
GNU gdb (GDB) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Error: unable to connect to device.
Remote communication error.  Target disconnected.: Connection reset by peer.
(gdb)

-----

/tmp/gdbclient.log:
run-as: exec failed for /data/local/tmp/arm-gdbserver Error:Permission denied

adb shell:
ls -l /data/local/tmp/                                          
-rwxrwxrwx shell    shell      579940 2016-03-30 09:57 arm-gdbserver

---------------------------------------------------------

Summary:
- r10e: doesn't recognize a debug build of VLC-Android at all.
- r11c: can't run gdbserver from non-app path /data/local/tmp
        (on Android 4.4.4).

I believe removing gdb.setup and gdbserver (git 6ae7318b58b) from .apk
causes both failures (directly or indirectly).

Regards,
Andrey


More information about the Android mailing list