Address: http://blog.csdn.net/likendsl/article/details/7576549
After xcode4.0, the compiler is replacedLlvm compiler 2.0
More powerful than before:
1. llvm compiler is a next-region open source compilation technology. It fully supports C, objective-C, and C ++.
2. llvm is twice faster than GCC, and the established program runs faster because it makes better use of the modern Chip structure.
3. llvm and xcode 4 are fully integrated. including keyword highlighting and code integrity are all analyzed by llvm syntax analyzer. in this way, you can understand your code well during editing.
After the compiler evolved, the console debugging command prefix was changed from the original GDB to lldb, so when you see that the Console does not have GDB and lldb appears, don't worry, because we can still use the following common Debugging commands:
Prerequisites:
1. For Debugging commands, select debug mode for program mode.
2. In debug mode, if your program crashes during running (crash), congratulations, the chance to use lldb for debugging is coming. (Another way is to open the breakpoint program and enter the debugging status. You can enter some commands on the command line)
After the preceding two conditions are met, the console (that is, the log output window all output) will automatically generate a (lldb) command. Enter Bt and press Enter.
Congratulations, xcode will automatically output the last call stack. As follows:
In fact, to be honest, this is really difficult to find. I searched Baidu for xcode command line commands for a long time, but none of them were the results I wanted. Today I suddenly saw a blog about it, after reading the command, I also typed the command in the command line. It is really useful! However, there are still many more powerful functions that I have not studied yet ~~
There are also some other commands: (common to gdb commands)
- Command explanation
- Break num sets a breakpoint on the specified row.
- BT displays all call stack frames. This command can be used to display the call sequence of a function.
- Clear deletes a breakpoint set on a specific source file or line. The usage is clear filename: num.
- Continue continues to execute the program being debugged. This command is used when the program stops running because of processing signals or breakpoints.
- Display expr: The expression value is displayed after each program is stopped. An expression is composed of variables defined by the program.
- File file to load the specified executable file for debugging.
- Help name: displays the help information of a specified command.
- Info break displays the current breakpoint list, including the number of times the breakpoint is reached.
- Info files: displays detailed information about the file to be debugged.
- Info func shows all function names.
- Info local shows the local variable information in the function.
- Info prog displays the execution status of the program to be debugged.
- Info var displays all global and static variable names.
- Kill the program being debugged.
- List shows source code segments.
- Make runs the make tool without exiting GDB.
- Next executes a source code line forward without entering other functions.
- Print expr: the value of the expression expr.
- Print-object: print an object
- Print (INT) Name print a type
- Print-object [artist description] calls a function.
- Set artist = @ "test" to set the variable value
- Whatis: view the variant Data Type
If you are proficient in this application, your level will rise to another level. One way to solve the exc_bad_access error is to use nszombieenabled together, it is really convenient to find the crash tool of crash !!
Finally, we recommend several websites
- Cocoadev: I personally think it is one of the websites with very professional cocoa technology. The following link details the principles of nszombieenable. Http://www.cocoadev.com/index.pl? Nszombieenabled
- Apple's official Mac OS X debugging magic, detailed about the most advanced Apple programmers should have debugging skills http://developer.apple.com/library/mac/#technotes/tn2004/tn2124.html
- In fact, you can also enable the nszombie option in instruments, so that you can directly view the callstack crash in instruments: http://www.markj.net/iphone-memory-debug-nszombie/
Xcode console Debugging commands (small experience)