Display the value of a variable property in LLDB debugger?

烈酒焚心 提交于 2019-11-30 00:40:23

The dot syntax is just syntactic sugar added by the compiler. I've always disagreed with adding it to Objective-C, but some people love it. What you have to remember is that these dots are getting converted into method calls by the compiler, so when you message something directly, like in the debugger, you must use the actual method call. Try rewriting your expression:

expr (void)NSLog(@"indexPath row: %ld", (long int)[indexPath row])

I'm not sure if the debugger's basic log method will execute method calls like this, so you may have to use the expression type.

I think this is a special case. The code below will work, but only if row is initialised to some value.

(lldb) print (NSInteger)[indexPath row]

I think this might be related to the fact that the row property is an extension of NSIndexPath in UIKit and is implemented as a category on that class.

Try to set this summary format in Xcodes variable view:

section:{(int)[$VAR section]},row:{(int)[$VAR row]}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!