LLDB main commands
1. Print related commands p and Po.
The difference between p and Po is that Po only prints the corresponding value, while p returns the type of the value and the reference name of the command result.Comparison result: Po: output value P: value type + reference name + memory address + output value P
- 1. P: Indicates decimal notation by default
- 2. P /x: Switch to hexadecimal
- 3. P/O: Switch to base 8
- 4. P/T: switch to binary
- 5. P/D: Converts characters to decimal digits
- 6. P/C: converts decimal digits to characters
2. Expression Modifies the parameter value
3. Call method invocation
Breakpoints debug a method and print the return value of the method
4. Print x
The X object stands for printing the object’s memory address in hexadecimal (x stands for hexadecimal). Because iOS is small-endian mode (high bytes of data are stored at high addresses in memory, and low bytes of data are stored at low addresses in memory — the data is stored in reverse), the data is read backwards
The x/4gx object represents the output of four hexadecimal 8-byte address Spaces (x represents hexadecimal, 4 represents four, and g represents 8-byte units, equivalent to the X /4xg object)
The memory address is printed by x/4xg or x/ 4Gx, and the address information contains stored attributes
5. Image instructions
The image command is mainly used for addressing
- Image list: command to see which libraries are used in the project
- Image lookup –address+ address: The image lookup –address+ address command is used to query the original address of an executable file or shared library
When a program crashes, you can use this command to see where it crashed
6. View thread and frame status
- Thread List: Lists all current threads
The * in the figure above represents the current thread, which means thread #1 is the current thread
- Thread Backtrace: Prints stack information. Bt for short
The printed information is more detailed than the Debug Navigator in the red box on the left, and you can add a value limit if you print too many stacks. For example, BT 5.
- Bt all: Displays stack information of all threads
The reason why BT prints the same result as BT All is that the project of the example is very simple
- Thread Return: Out of the execution of the current method, mainly used to control the flow of the program. Thread Return has an optional parameter, which is loaded into a register during execution, and the return command is immediately executed to exit the current stack frame.
- Frame variable: Displays variables of the current frame. By default, all parameters and local variables of the current frame are displayed
7. View the register address
Register read: Displays the register address informationRegister Read /x: View the specific register address
8. The methods command displays the properties and methods of the current object
The last
Finally, LLDB command LLDB command is added
Ongoing update