Learn more about Consol on IOS Console

Source: Internet
Author: User

UnderstandingIOS console ConsolThis section describes how to view the error stack and global variable values by using the gdb command.

Use the gdb command to view the error Stack

InIOSDuring development, if the memory of a pointer is released in advance and the pointer continues to be used in the future, the program will immediately crash off and it is difficult to report an error, I used to rely on speculation to determine the cause of the error. We should use tools to locate the cause of the error, quickly and accurately locate the cause of the error, and finally make improvements.

ActuallyIOS ConsoleThis mechanism is provided. If you choose the debug mode, after the program crashConsoleEnter bt to display the crash Stack:

 
 
  1.     Program received signal:  “EXC_BAD_ACCESS”.  
  2.     warning: Unable to read symbols for /Developer/ios4.2.1/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 
  3. (8C148)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).  
  4.     (gdb) bt  
  5.     #0  0x33a06464 in objc_msgSend ()  
  6.     #1  0x3139de2e in -[UIImageView setImage:] ()  
  7.     #2  0x00009ecc in -[RoundMenuView touchesEnded:withEvent:] (self=0x29e140, _cmd=0x316b1a7b, 
  8. touches=0x2e1050, event=0x2424f0) at /Users/wangjun/workspace/iphone/Classes/RoundMenuView.m:130  
  9.     #3  0x313b1354 in -[UIWindow _sendTouchesForEvent:] ()  
  10.     #4  0x313b0cce in -[UIWindow sendEvent:] ()  
  11.     #5  0x3139bfc6 in -[UIApplication sendEvent:] ()  
  12.     #6  0x3139b906 in _UIApplicationHandleEvent ()  
  13.     #7  0x31eecf02 in PurpleEventCallback ()  
  14.     #8  0x304236fe in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()  
  15.     #9  0x304236c2 in __CFRunLoopDoSource1 ()  
  16.     #10 0x30415f7c in __CFRunLoopRun ()  
  17.     #11 0x30415c86 in CFRunLoopRunSpecific ()  
  18.     #12 0x30415b8e in CFRunLoopRunInMode ()  
  19.     #13 0x31eec4aa in GSEventRunModal ()  
  20.     #14 0x31eec556 in GSEventRun ()  
  21.     #15 0x313cf328 in -[UIApplication _run] ()  
  22.     #16 0x313cce92 in UIApplicationMain ()  
  23.     #17 0x00002da2 in main (argc=1, argv=0x2fdff44c) at /Users/wangjun/workspace/iphone/main.m:19  
  24. kill  
  25. quit 

The stack information can be used to locate the error accurately.

Use the gdb command to view global variable values

InConsol ConsoleInput the print variable name to view the value.

Summary: UnderstandingIOS console ConsolThis article is helpful to you!

Related Article

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.