Xcode/LLDB: How to get information about an exception that was just thrown?

后端 未结 4 2071
陌清茗
陌清茗 2020-11-29 15:08

OK, so imagine that my breakpoint in objc_exception_throw has just triggered. I\'m sitting at the debugger prompt, and I want to get some more information abou

4条回答
  •  我在风中等你
    2020-11-29 15:39

    If you have a catch statement, put a breakpoint in there and you can inspect the exception object at that point.

    If you don't have a catch statement, continue.

    You'll get a message in your terminal like this:

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'

    However, you're probably looking for a way to inspect it without continuing since you'll lose your nice stack trace when the application is terminated.

    For that it sounds like Fnord's answer is best, but I wasn't able to get it working in LLDB.

提交回复
热议问题