lldb breakpoint on all methods in class objective c

后端 未结 2 1303
鱼传尺愫
鱼传尺愫 2021-02-01 21:49

How can I automate setting a breakpoint on all methods in an Objective C class using lldb?

This is useful for learning the behavior of a complicated legacy class. I am u

2条回答
  •  一生所求
    2021-02-01 22:50

    br se -f FooViewController.m -p '^@property|^ *- *\('
    

    "br se" is short for "breakpoint set", pass your own filename to the -f argument, and the -p argument is a crude regex for properties and methods in Objective C.

    Caveats: This doesn't seem to work for .h files, so if you have properties declared in the header that you want to watch then you may need to set watchpoints on their backing instance variables.

    This is the best solution I have found so far, please post alternative solutions if you think they will be helpful.

提交回复
热议问题