Gdb commands required for iOS development

Source: Internet
Author: User

Updated Description: This article is described comprehensively later.
Http://blog.csdn.net/ch_soft/article/details/6740000

Article reproduced in: http://www.ethangao.com /? P = 273. Thank you for sharing it.

GDB is not omnipotent, but it is absolutely impossible without GDB. Here is a brief introduction to the most basic gdb commands in iOS development.

Po

Po is short for print-object and can be used to print all nsobject objects. Example:

(GDB) PO
Self

<Launcherviewcontroller: 0x552c570>

(GDB) PO
[Self view]

<Uiview: 0x544eb80; frame = (0 0; 320 411); autoresize = W + H; layer = <calayer: 0x544ebb0>

(GDB) print-Object
[Self view]

<Uiview: 0x544eb80; frame = (0 0; 320 411); autoresize = W + H; layer = <calayer: 0x544ebb0>

P

P is short for print and can be used to print all simple types, such as int, float, and struct. Example:

(GDB) P
Self

$1 = (launcherviewcontroller *) 0x552c570

(GDB) P
[[Self view] size]

Unable to call function "objc_msgsend" at 0x1e7e08c: no return type information available.

To call this function anyway, you can cast the return type explicitly (e.g. 'print (float) FABS (3.0 )')

(GDB) P
(Cgsize) [[self view] size]

$1 = {

Length = 320,

Height = 411

}

(GDB) print
(Cgsize) [[self view] size]

$2 = {

Length = 320,

Height = 411

}

Call

Call is called. In fact, the above Po and P also have the calling function. Therefore, call is generally used only when no output is displayed or the method does not return a value. Example:

(GDB) Call
[[Self view] sizetofit]

Unable to call function "objc_msgsend" at 0x1e7e08c: no return type information available.

To call this function anyway, you can cast the return type explicitly (e.g. 'print (float) FABS (3.0 )')

(GDB) Call
(Void) [[self view] sizetofit]

(GDB) Call
[[Self view] size]

Unable to call function "objc_msgsend" at 0x1e7e08c: no return type information available.

To call this function anyway, you can cast the return type explicitly (e.g. 'print (float) FABS (3.0 )')

(GDB) Call
(Void) [[self view] size]


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.