在LLDB调试器中显示变量属性的值? [英] Display the value of a variable property in LLDB debugger?

查看:383
本文介绍了在LLDB调试器中显示变量属性的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有日志消息"操作的断点,并且我想打印NSIndexPath的行.所以我尝试了:cell row @indexPath.row@,但是什么也没打印.我还尝试使用调试器命令:expr (void)NSLog(@"indexPath row:%i", indexPath.row),但出现错误:error: property 'row' not found on object of type 'NSIndexPath *'

I'm using a breakpoint with Action "Log Message", and I want to print the row of an NSIndexPath. So I tried: cell row @indexPath.row@ but nothing gets printed. I also tried using a debugger command: expr (void)NSLog(@"indexPath row:%i", indexPath.row) but I get an error: error: property 'row' not found on object of type 'NSIndexPath *'

我在做什么错了?

推荐答案

点语法只是编译器添加的语法糖.我一直不同意将其添加到Objective-C,但是有些人喜欢它.您要记住的是,这些点已被编译器转换为方法调用,因此当您直接在调试器中发送消息时,必须使用实际的方法调用.尝试重写您的表情:

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.

这篇关于在LLDB调试器中显示变量属性的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆