Xcode Debug Commands

Source: Internet
Author: User

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:

[CPP]View PlainCopyprint?
  1. * thread #1: tid = 0x1f03, 0x0132edee corefoundation ' ___forwarding___ + 206, Stop reason = Exc_breakpoint (code=exc_i3 86_BPT, subcode=0x0)
  2. Frame #0:0x0132edee corefoundation ' ___forwarding___ + 206
  3. Frame #1:0x0132ecb2 corefoundation ' _cf_forwarding_prep_0 + 50
  4. Frame #2:0x00002e60 testmvc '-[viewctrl2 touchesbegan:withevent:] + + at viewctrl2.m:40
  5. Frame #3:0x013c9e99 corefoundation '-[nsobject performSelector:withObject:withObject:] + 73
  6. Frame #4:0x000ffc49 UIKit ' Forwardtouchmethod + 268
  7. Frame #5:0x000ffb38 UIKit '-[uiresponder touchesbegan:withevent:] + 30
  8. Frame #6:0x0003a2cf UIKit '-[uiwindow _sendtouchesforevent:] + 272
  9. Frame #7:0x0003a5e6 UIKit '-[uiwindow sendevent:] + 273
  10. Frame #8:0x00020dc4 UIKit '-[uiapplication sendevent:] + 464
  11. Frame #9:0x00014634 UIKit ' _uiapplicationhandleevent + 8196
  12. Frame #10:0x012b2ef5 graphicsservices ' purpleeventcallback + 1274
  13. Frame #11:0x0139c195 corefoundation ' __cfrunloop_is_calling_out_to_a_source1_perform_function__ + 53
  14. Frame #12:0x01300ff2 corefoundation ' __cfrunloopdosource1 + 146
  15. Frame #13:0x012ff8da corefoundation ' __cfrunlooprun + 2218
  16. Frame #14:0x012fed84 corefoundation ' cfrunlooprunspecific + 212
  17. Frame #15:0x012fec9b corefoundation ' Cfrunloopruninmode + 123
  18. Frame #16:0x012b17d8 graphicsservices ' Gseventrunmodal + 190
  19. Frame #17:0x012b188a graphicsservices ' Gseventrun + 103
  20. Frame #18:0x00012626 UIKit ' Uiapplicationmain + 1163
  21. Frame #19:0x000026fa testmvc ' main + at main.m:16
  22. Frame #20:0x00002645 testmvc ' start + 53


Of course there are other commands (and GDB commands are common):

[CPP]View PlainCopyprint?
    1. Command explanation
    2. Break NUM sets a breakpoint on the specified line.
    3. BT displays all the call stack frames. This command can be used to display the order in which functions are called.
    4. Clear removes breakpoints that are set on a specific source file, on a specific line. Its usage is: Clear filename:num.
    5. 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.
    6. Display EXPR Displays the value of an expression every time the program stops. An expression consists of a variable defined by a program.
    7. The file file loads the specified executable file for debugging.
    8. Help NAME displays assistance information for the specified command.
    9. Info Break Displays the list of current breakpoints, including the number of times the breakpoint was reached.
    10. Info files Displays detailed information about the files being debugged.
    11. Info func Displays all the function names.
    12. Info Local Displays the local variable information in the function.
    13. Info prog shows the execution state of the program being debugged.
    14. Info var displays all the global and static variable names.
    15. Kill terminates the program that is being debugged.
    16. The list displays the source code snippet.
    17. Make to run the Make tool without exiting GDB.
    18. Next executes a line of source code forward without stepping into other functions.
    19. Print expr Displays the value of the expression expr.
    20. Print-object Printing an Object
    21. Print (int) name prints a type
    22. Print-object [artist description] Call a function
    23. Set artist = @"Test" sets the value of the variable
    24. Whatis view the data type of the variable

Xcode Debug Commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.