After XCode4.0, the compiler replaced the LLVM compiler 2.0
More powerful than before:
The 1.LLVM compiler is the next area of open source compilation technology. Fully supports C, objective-c, and C + +.
The 2.LLVM is twice times faster than GCC, and the established program runs faster. Because it better utilizes the structure of the modern chip.
The 3.LLVM and Xcode 4 are fully integrated. Including keyword highlighting, code integrity, and so on, are all analyzed by the LLVM parser. This allows you to get a good idea of your code as you edit it.
After the compiler evolved, the console debug command prefix, also from the original GDB changed to Lldb, so when you see the console without gdb and appear lldb, do not panic, because we used to debug commands can still be used:
Usage Prerequisites:
1. Since it is a debug command, of course, the program mode should choose Debug mode.
2. In debug mode, if your program crashes in operation (Crash), then congratulations, the opportunity to use LLDB debugging.
After two conditions are met, the console (that is, the Log Output window all output) will automatically hit a (lldb) command, after which you enter BT and return.
Congratulations, Xcode will automatically output the last call stack. As follows:
- * thread #1: tid = 0x1f03, 0x0132edee corefoundation ' ___forwarding___ + 206, Stop reason = Exc_breakpoint (code=exc_i3 86_BPT, subcode=0x0)
- Frame #0:0x0132edee corefoundation ' ___forwarding___ + 206
- Frame #1:0x0132ecb2 corefoundation ' _cf_forwarding_prep_0 + 50
- Frame #2:0x00002e60 testmvc '-[viewctrl2 touchesbegan:withevent:] + + at viewctrl2.m:40
- Frame #3:0x013c9e99 corefoundation '-[nsobject performSelector:withObject:withObject:] + 73
- Frame #4:0x000ffc49 UIKit ' Forwardtouchmethod + 268
- Frame #5:0x000ffb38 UIKit '-[uiresponder touchesbegan:withevent:] + 30
- Frame #6:0x0003a2cf UIKit '-[uiwindow _sendtouchesforevent:] + 272
- Frame #7:0x0003a5e6 UIKit '-[uiwindow sendevent:] + 273
- Frame #8:0x00020dc4 UIKit '-[uiapplication sendevent:] + 464
- Frame #9:0x00014634 UIKit ' _uiapplicationhandleevent + 8196
- Frame #10:0x012b2ef5 graphicsservices ' purpleeventcallback + 1274
- Frame #11:0x0139c195 corefoundation ' __cfrunloop_is_calling_out_to_a_source1_perform_function__ + 53
- Frame #12:0x01300ff2 corefoundation ' __cfrunloopdosource1 + 146
- Frame #13:0x012ff8da corefoundation ' __cfrunlooprun + 2218
- Frame #14:0x012fed84 corefoundation ' cfrunlooprunspecific + 212
- Frame #15:0x012fec9b corefoundation ' Cfrunloopruninmode + 123
- Frame #16:0x012b17d8 graphicsservices ' Gseventrunmodal + 190
- Frame #17:0x012b188a graphicsservices ' Gseventrun + 103
- Frame #18:0x00012626 UIKit ' Uiapplicationmain + 1163
- Frame #19:0x000026fa testmvc ' main + at main.m:16
- Frame #20:0x00002645 testmvc ' start + 53
Of course there are other commands (and GDB commands are common):
- Command explanation
- Break NUM sets a breakpoint on the specified line.
- BT displays all the call stack frames. This command can be used to display the order in which functions are called.
- Clear removes breakpoints that are set on a specific source file, on a specific line. Its usage is: Clear filename:num.
- Continue continue to execute the program being debugged. This command is used when the program stops running because of processing a signal or a breakpoint.
- Display EXPR Displays the value of an expression every time the program stops. An expression consists of a variable defined by a program.
- The file file loads the specified executable file for debugging.
- Help NAME displays assistance information for the specified command.
- Info Break Displays the list of current breakpoints, including the number of times the breakpoint was reached.
- Info files Displays detailed information about the files being debugged.
- Info func Displays all the function names.
- Info Local Displays the local variable information in the function.
- Info prog shows the execution state of the program being debugged.
- Info var displays all the global and static variable names.
- Kill terminates the program that is being debugged.
- The list displays the source code snippet.
- Make to run the Make tool without exiting GDB.
- Next executes a line of source code forward without stepping into other functions.
- Print expr Displays the value of the expression expr.
- Print-object Printing an Object
- Print (int) name prints a type
- Print-object [artist description] Call a function
- Set artist = @"Test" sets the value of the variable
- Whatis view the data type of the variable
The use of LLDB debugging tools, is really looking for crash a big weapon Ah, it is convenient!
Console Debug commands for Xcode