1. Format of instructions

<command> [<subcommand> [<subcommand>...]] <action> [-options [option- value]] [argument [argument...]]

  • <command> The command
  • [<subcommand> [<subcommand>...]] Sons command
  • <action> The command operation
  • [-options [option- value]] Command options
  • [argument [argument...]] The command parameter

For example, breakpoint set -n test

Second, the instruction

1. Help (See how to use the command)

Such as Help BreakPoint, Help Breakpoint set

2. Expression — (Executes an expression)

  • –: End of command options: indicates that all command options are set. If no command options are available,– can be omitted

Such as expression self. The backgroundColor = [UIColor redColor]

  • Expression, expression — The same effect as the print, p, call instructions
  • Expression -O — same effect as Po

3. Thread backtrace (Prints thread stack information)

  • Thread Backtrace has the same effect as the BT directive

4. Thread return []

Thread return [self test]

5. Frame variable (Print the current stack frame variable)

For example frame variable self->_age

6. Thread continue, continue, c

7. Thread step out, finish (directly execute all code of current function, return to previous function)

8. Thread step-over, next, n

9. Thread step-in, step, s

10. Thread step-inst-over, Nexti, NI (single step, execute sub-functions as a whole)

11. Thread step-inst, stepi, si

Si and NI are similar to S and N, where S and N are source code levels, si and NI are assembly instruction levelsCopy the code

12. Breakpoint set

  • Breakpoint set -a Function address
  • Breakpoint set -n Specifies the function name
  • Breakpoint set -r Regular expression
  • Breakpoint set -s Dynamic library -n Specifies the function name

13. Breakpoint list (List all breakpoints, each breakpoint has its own number)

14. Breakpoint disable Breakpoint number

15. Breakpoint enable Breakpoint number

16. Breakpoint delete breakpoint number

17. Breakpoint command add Breakpoint number

  • The breakpoint is preconfigured with commands to execute, and when the breakpoint is triggered, the commands are executed in sequence

18. Breakpoint Command list Breakpoint number

  • Command to view a breakpoint setting

19. Breakpoint command delete Breakpoint number

  • Command to delete a breakpoint setting

20. Memory breakpoints, triggered when memory data changes (similar to code breakpoints)

  • Watchpoint set variable

For example watchpoint set variable self->age

  • Watchpoint set variable address

Watchpoint set expression &(self->_age)

  • watchpoint list
  • Watchpoint Disable Breakpoint number
  • Watchpoint enable Number of a breakpoint
  • Watchpoint delete Breakpoint number
  • Watchpoint Command add Breakpoint number
  • Watchpoint Command List Breakpoint number
  • Watchpoint Command delete Number of a breakpoint

21. image lookup

  • Image lookup -t Type: searches for information of a certain type
  • Image lookup -a Address: searches the location in the module based on the memory address
  • Image lookup -n Symbol or function name: Finds the location of a symbol or function

22. Image list (listing the loaded module information)

  • Image list -o-f: displays the offset address and full path of the module

tip

  • When you press Enter, the last command is automatically executed
  • Abbreviations can be used for most instructions

For example, breakpoint list can be abbreviated to BR L