then enter "chmod777/data/local/tmp/android_server" to add corresponding permissions to Android _ server.
then type "/data/local/tmp/android_server" to start android_server.
as shown in the following figure:
enter "adb forward tcp:23946 tcp:23946" to forward the tcp port
command and start the Activity to be debugged.
the app will pop up the "Waitting for debugger" dialog box, as shown in the following figure:
click the "Debug options" button, and click on "suspend on process entry point", "suspend on thread start/exit". Put a tick in front of the options such as "Suspend on library load/unload", as shown in the following figure:
Click "ok" to fill in "localhost" in the hostname of the following dialog box
Find the "com.example.testjniso" process in the pop-up "Choose process to attach to" window, select it, and then click "ok".
you can see that the port of the com.example.testjniso process is 87.
As shown in the following figure:
Click the "Cancle" button in the "Add map" window popped up by ida.
Click the Pause Debugging button in ida to pause the current debugging, as shown in the following figure:
Right-click the libTestJniSo.so file, and click "Jump to module base" in the pop-up box to jump to the starting address of the libTestJniSo.so file.
press Alt+T, and enter "Java _ com _ example _ testjniso _ mainactivity _ hellofromjni" in the search dialog box, as shown in the following figure:
click the "ok" button to jump to the starting address of the Java _ com _ example _ testjniso _ mainactivity _ hellofromjni function.
Then break at the address:
Press F9 again to start debugging, and click the "Click to load so file" button in the app to reload libTestJniso.so You can see that the program has successfully stopped at the breakpoint:
So file can be debugged normally here.
what is a linker?
Linker is /system/lib/linker, which is the first module loaded when the process starts. It is responsible for managing the loading and execution of elf executable files and various so files, and also participates in some debugging. In layman's terms, it is an interpreter of elf files. It can load elf executable files and so dynamic libraries.
under android 5., you can't execute android_server because the linker that comes with android5. doesn't support loading non-pie elf files. But if you implement a linker that can load pie, can't you solve this problem? That's right, it's sauce purple. Add your own custom linker in the attachment.
/thread-2684.htm.