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

后端 未结 9 1453
无人及你
无人及你 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:49

    p prints value of primitive variable or value of a reference
    po try to call -description for that object and print returned string
    
    There is also **v command** in lldb. Explaining using example.
    
    protocol Activity {} 
    struct Trip: Activity { 
    var name: String 
    var destinations: [String] 
    } 
    let cruise: Activity = Trip(...)
    
    Using v command 
    (lldb) v cruise.name
    (string) cruise.name = "print name"
    //As it uses dynamic resolution
    
    Using p command
    (lldb) p cruise.name
    //execution interrupted
    

提交回复
热议问题