If you want to remote debug an android binary in a VM, you can use IDA easily, but if, like me, you run IDA in an virtual machine, you need a trick.
IDA have binary for remote debug, you don’t need gdbserver,
So firstly copy android_server binary in your VM in the sdcard file, or use
adb push android_server /data/local/tmp
Start a shell on your Android VM and start android_server (don’t forget to add execute permission (chmod 755))
Forward the debug port (23946), for use it on your local machine, now android_server port is just bind on your lo interface, it’s not accessible from an other interface, and you can’t use iptable to forward it. But redir can!
Check it with a useful mnemonic command:
It’s cool 😉
Now configure IDA, select remote ARM Linux/Android debugger and Debugger->Process options:
Don’t forget to add just the remote paths, if IDA can’t find the binary in the android VM, he will upload it.
That’s all 🙂