What's the difference between “p” and “po” in Xcode's LLDB debugger?

后端 未结 9 1471
无人及你
无人及你 2021-02-04 12:27

Example. I write the following string in my old project and a new, clear one:

UIInterfaceOrientation k = [UIApplication sharedApplication].statusBarOrientation;
         


        
相关标签:
9条回答
  • 2021-02-04 12:59
    Strip debug symbols during copy
    

    In most answers they advice to set optimization to "none" but forget that this option should be set to NO (at least for debug configuration).

    0 讨论(0)
  • 2021-02-04 13:02
    • Use po, p, & v to print variables

      • po ends up compiling & executing twice, once to evaluate your expression and again to get the object description.

      • v doesn’t compile at all: can’t evaluate any expression but does allow property accessing and does recursive dynamic type resolution so each property is treated as the actual runtime type.


    For people who are interested in learning more : https://developer.apple.com/videos/play/wwdc2019/429/

    Add this as an answer for visibility, Also explains the functionality of each debugging commmand

    0 讨论(0)
  • 2021-02-04 13:03

    It seems the difference is lldb/gdb debugger. The only way for iOS project to make debugger more workable is expr @import UIKit. But it may not work for older xcode versions and... you need to input this string in the console after each relaunch. The only way to automate it is an extra breakpoint with this expression.

    0 讨论(0)
提交回复
热议问题