Xcode dynamic debugging principles

The principle of Xcode dynamic debugging involves two tools, LLDB and debugServer. The DEBUgServer is stored in Xcode at the beginning. When Xcode identifies the mobile device, Xcode will automatically install the DebugServer on the iPhone, and then interact with the DEBUgServer through LLDB to realize the real machine dynamic mode.

How to debug any APP dynamically

Manually add the DebugServer to any APP and interact with it using the LLDB of the terminal.

The implementation process

1. Connect to the jailbroken phone.

2. Use iFunBox to find the debugServer in the directory /Developer/usr/bin and drag it to the desktop.

3. Open the terminal, go to the desktop path, and run the following command to export permissions.

ldid -e debugserver > debugserver.entitlements
Copy the code

4. Open debugServer. Entitlements with Xcode, add two new permissions.

get-task-allow
task_for_pid-allow
Copy the code

ldid -Sdebugserver.entitlements debugserver
Copy the code

6. Log in to the root environment of the mobile phone and run the following command to attach the debugServerP to an APP process. The port number is customized and the process is the process ID or name of the listening APP.

Debugserver *: indicates the port number-aprocessCopy the code

7. Open a terminal window and start LLDB to remotely connect to the debugServer on the iPhone.

// Enter LLDB to start LLDB LLDB // Remote connection debugServer process connect connect:// Mobile IP address: port numberCopy the code

8. After the connection is successful, the listening APP is in the breakpoint state. Run the C command of LLDB to continue the program.

added

* / Developer /usr/bin/debugServert * / Developer /usr/bin/debugServert * / Developer /usr/bin/debugServert * / Developer /usr/bin/debugServert * / Developer /usr/bin/debugServert * / Developer /usr/bin/debugServert * /

Problems 2. The configuration process, I have written to < iOS reverse dynamic debugging FAQ | >, please make your own reading.