Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
243 views
in Technique[技术] by (71.8m points)

How to automatically set breakpoints on all methods in Xcode?

How do I automatically set breakpoints on all methods in Xcode? I want to know how my program works, and which methods invoke when I interact with the user interface.

question from:https://stackoverflow.com/questions/9275195/how-to-automatically-set-breakpoints-on-all-methods-in-xcode

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  1. Run your app in Xcode.
  2. Press ??Y (Debug -> Pause).
  3. Go to the debugger console: ??C
  4. Type breakpoint set -r . -s <PRODUCT_NAME> (insert your app's name).

lldb will answer with something like...

Breakpoint 1: 4345 locations

Now just press the Continue button.

breakpoint set is lldb's command to create breakpoints. The location is specified using a regular expression (-r) on function/method names, in this case . which matches any method. The -s option is used to limit the scope to your executable (needed to exclude frameworks).

When you run your app lldb will now break whenever the app hits a function from your main executable.

To disable the breakpoints type breakpoint delete 1 (insert proper breakpoint number).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...