R
R
Rou19972016-08-29 08:43:03
Android
Rou1997, 2016-08-29 08:43:03

How to use gdb to debug Android applications with native libraries (NDK)?

I use Genymotion, so I have su rights.
Application launched.
Launched gdb-server in adb shell, made attach to application PID.
gdb started, calling target remote. There is a connection, I tried the command continue- it works ("hung" application stops "not responding", continues to run, everything is correct).
But I can’t actually load the library (*.so) so that the list of functions ( info functions) is available and so that breakpoints can be set, that is, I can’t “explain” gdb that I need this particular library, because there may be several of them in one application and one gdbserver session.
The problem is very simple, and in all the tutorials the process seems to be described, but everywhere it’s different and nothing happens.
On Windows, I did this using symbol-file remote:test.exe (I also found it with some difficulty), but for Android this command is not supported . I
also tried this (according to this tutorial):
gdb D:\путь-на-компьютере\libTest.so
The library seems to be loaded, but it is not loaded from the phone’s memory, but from the computer itself, therefore it info functionsreturns addresses not in the application’s process memory, but in the .so file, and accordingly, I cannot set breakpoints.
How to solve the problem?
Or maybe use some GUI?
I'm interested in debugging without source code.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question