Xcode 断点 [NSExceptionRaise] 与 -[NSExceptionRaise]
Xcode:Run>Show>Breakpoints
我已经添加了必需的 [NSExceptionRaise]
和 objc_exception_throw
但当我关闭时Breakpoints 窗口然后返回 Xcode 添加第三个断点:-[NSExceptionRaise]
。这是否意味着 [NSExceptionRaise]
是错误的并且我应该删除它? 或者它们都有帮助?如果是的话,它们在功能上有何不同?
Xcode:Run>Show>Breakpoints
I've added the obligatory [NSExceptionRaise]
and objc_exception_throw
yet when I close the Breakpoints window and then return Xcode adds a third breakpoint: -[NSExceptionRaise]
. Does this mean [NSExceptionRaise]
is wrong and I should delete it? Or are they both helpful? If so in what way are they functionally different?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正确的断点是:
您指示调试器在 NSException 类的 -raise 方法上中断。 “[NSExceptionRaise]”是(没有不尊重的意思)废话。 :-)
据我所知,你不需要两者。 objc_exception_throw 是“新”方式,而 -[NSException raise] 是“旧”方式。我相信如果您使用的是 Leopard 或更高版本,则只会调用 objc_exception_throw 。 10.4 或之前版本将调用 -[NSException raise]。
The correct breakpoint is:
You're instructing the debugger to break on the -raise method of the NSException class. "[NSExceptionRaise]" is (meaning no disrespect) nonsense. :-)
You don't need both, as far as I know. objc_exception_throw is the "new" way, whereas -[NSException raise] is the "old" way. I believe if you're on Leopard or later, only objc_exception_throw will be called. 10.4 or prior will call -[NSException raise].
新添加的断点是
-[NSException raise]
,它与[NSExceptionRaise]
不同,后者是一个对象方法(NSException
是类,raise
是消息)。我不知道后者是什么,我怀疑 XCode 试图智能地了解你输入的内容和它认为你的意思。The newly added breakpoint is to
-[NSException raise]
, which is distinct from[NSExceptionRaise]
in that the latter is an object method (NSException
being the class,raise
being the message). I don't know what the latter is, and I suspect XCode is trying to be intelligent about what you entered v. what it thinks you meant.您必须在方法前面加上加号或减号字符,因为调试器使用标头来定位和定义符号。不同的方法可以具有相同的名称,但以“+”开头的方法是类方法,以“-”开头的方法是实例方法。如果没有加号或减号,调试器就不知道您想要什么方法。
You have to preface the method with either a plus or minus character because the debugger uses the headers to locate and define the symbol. Different methods can have the same name but methods prefaced by a "+" are class methods and those prefaced by "-" are instance methods. Without the plus or minus the debugger has no idea what method you wanted.