IOS development diary 10-Bug debugging (lldb), 10-buglldb
Today, the blogger has some Bug debugging needs and encountered some difficulties. I would like to share with you the hope to make common progress.
Xcode has the following Bug debugging methods:
1. breakpoint, Global breakpoint, and conditional breakpoint used with Nslog to locate bugs
2. Static Analysis tools: Analyze, static detection memory
3. Dynamic Analysis tools: Profile. The most common tools are Leaks (detecting memory Leaks) and Allocations (detecting memory overflow)
4. gdb debugging: debugging tool before Xcode4.0
5. lldb debugging: debugging tool after Xcode4.0
Today, I will share with you how to use lldb to become a Bug handler.
LLDB
LLDB is an open-source debugger with REPL features and C ++ and Python plug-ins. LLDB is bound to Xcode and exists in the console at the bottom of the main window. The debugger allows you to pause the program at a specific time. You can view the value of the variable, execute custom commands, and perform the program progress according to the steps you think are appropriate.
At the same time, let's start our journey by printing variables in the debugger.
Basic
Here is a simple applet that prints a string. Note that the breakpoint has been added to 8th rows. You can click the side slot of the Xcode source code window to create a breakpoint.
The program stops running on this line, and the console is opened, allowing us to interact with the debugger. So what should we do?
Help
The simplest command isHelp
It lists all the commands. If you forget what a command is for or want to know more, you can useHelp <command>
To learn more details, suchHelp print
OrHelp thread
. If you even forgetHelp
What is a command? You can try it.Help
. However, if you know how to do this, you probably haven't forgotten this command.