如何在lldb中创建和使用temp NSRange? [英] How to create and use temp NSRange in lldb?

查看:174
本文介绍了如何在lldb中创建和使用temp NSRange?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NSRange只是一个C结构。我想在断点处在Xcode中的lldb中创建一个临时的。

NSRange is just a C struct. I want to create a temporary one in lldb in Xcode at a breakpoint.

特别用于NSArray方法 objectAtIndex:inRange:

Specifically for use in NSArray method objectAtIndex:inRange:

这不起作用。

(lldb) expr NSRange $tmpRange = (NSRange){0,4}
(lldb) expr $tmpRange
(NSRange) $tmpRange = location=0, length=4
(lldb) expr -o -- [items indexOfObject:item4 inRange:$tmpRange]
error: no matching constructor for initialization of 'NSRange' (aka '_NSRange')
error: 1 errors parsing expression

我的代码在断点处有一个名为 badRange 的NSRange var,并传递给它一个在工作中。因此:

My code has an NSRange var named badRange at the breakpoint, and passing that one in works. Thus:

(lldb) expr -o -- [items indexOfObject:item4 inRange:badRange]
0x7fffffffffffffff
(lldb) expr badRange
(NSRange) $1 = location=0, length=3

发生了什么事?

谢谢。

推荐答案

创建调试器中的NSRange在OS X项目中工作时工作正常,但不适用于iOS项目。它在iOS上不起作用的原因是,即使Foundation提供了声明结构的头文件,它也不会公开任何相应的符号。基本上,在iOS上,NSRange只是一个前向声明,我不知道实现的真实符号。

Creating a NSRange in the debugger works fine when working in a OS X project but it doesn't for iOS projects. The reason it doesn't work on iOS is that even though Foundation provides the header file in which the struct is declared, it doesn't expose any corresponding symbol. Basically, on iOS, NSRange is just a forward declaration and I do not know the real symbol for the implementation.

这篇关于如何在lldb中创建和使用temp NSRange?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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