In the bottom of the exploration process, we often need to use some print commands to output our object Pointers and memory conditions, at this time we need to skillfully use LLDB command.

The LLDB command is as follows:

Bt: Displays stack information of the thread

Bt all: Displays stack information of all threads

Po: prints objects, similar to p. Po only prints the corresponding value, while P prints the type of the value and the result of the command

Expr: expression Short for dynamically executing an assignment expression and printing the result during debugging.

Call: Dynamically calls a function

Image: Image list allows you to view the code location of an address. In addition to image list, there are also image add, image lookup and other commands. When a crash occurs, only the address of stack frame can be seen when the thread stack is checked. The code line corresponding to this address can be conveniently located by using the image look-address address.

X: View the address, for example, x objc

X /4gx: Prints four hexadecimal addresses. x/4gx objc

This command is a combination command, note:

Several sets of data (4)

The number 4 represents the output of four sets of data

Byte size (g)

  • B: Byte indicates one byte
  • H: Half word means 2 bytes
  • W: Word stands for four bytes
  • G: Giant word stands for eight bytes

Output format (X)

  • X: indicates hexadecimal system
  • F: floating point number
  • D: indicates base 10
  • U: indicates an unsigned decimal integer
  • O: octal
  • T: binary
  • A: The difference between hexadecimal and x is that the address content is printed out.
  • I: instruction address
  • C: character format

One more thing:

  • P/T binary printing
  • P /0 octal print
  • P /x hexadecimal printing