ADB Debuging

Android Emulation notes.

Enable Root Shell

In BlueStacks: 
    Settings > Advanced > Android Debug Bridge > Enable
Using adb:
    adb connect 127.0.0.1:<Port from BlueStacks>
    adb shell
In Shell:
    system/xbin/bstk/su root

Debug any process

adb connect 127.0.0.1:<port>
adb root
adb shell
adb su root 
pm dump com.company.programName  //for the string below
am start -D -n "com.company.programName/us.company.progNam.player.AndroidPlugin"

GDB Debugging

  1. Download NDK SDK: https://developer.android.com/ndk/downloads

On the host computer:

adb connect 127.0.0.1:56598
adb root
adb push android-ndk-r23c\prebuilt\android<version>\gdbserver64 /tmp/
adb shell

On the remote host:

su root
gdbserver64 :8000 --attach <PID>

Host:

adb forward tcp:8000 tcp:8000
android-ndk-r23c\prebuilt\windows\gdb.exe
(gdb) target remote :8000
GDB Debugging Guide:
https://wladimir-tm4pda.github.io/porting/debugging_gdb.html

Android OS Debugging Notes:
https://source.android.com/devices/tech/debug/gdb

Last updated

Was this helpful?