Gdbserver strange error while debugging native app

2019-08-13 17:42发布

问题:

I'm trying to debug an native app on my android device. I followed this tutorial: http://blog.thecobraden.com/2012/02/debugging-apps-with-native-code-part-1_09.html And everything went good, I built the app and installed it, once I wanted to debug it with ndk-gdb I got this error: Could not open remote device: Invalid argument.

I searched this error and found this answer: Android NDK debugging: device can't be opened It's very similar to my problem, I tried this method and now I get this error: Can't open socket: Permission denied.

My phone is rooted so I don't understand why gdbserver can't open the socket.. I tried to give the gdbserver binary different permissions but it still won't work. Any solutions?

回答1:

Are you running the ndk gdb command as root? Do adb root to get the root access of the device and then start the debugging. Hopefully this should help.