我可以在 Cocoa 框架代码中设置断点吗?

发布于 2024-10-20 19:01:43 字数 1088 浏览 3 评论 0原文

我应该能够在 Cocoa 框架本身内部设置断点吗?

我在 Mac OS X 应用程序中遇到过各种崩溃,有时是随机的。以下是 Xcode 调用堆栈示例的一部分:

0  - 0x98ed0e20 in __CFRunLoopRun  
1  - 0x98ece464 in CFRunLoopRunSpecific  
2  - 0x98ece291 in CFRunLoopRunInMode  
3  - 0x96a90004 in RunCurrentEventLoopInMode  
4  - 0x96a8fdbb in ReceiveNextEventCommon  
5  - 0x96a8fc40 in BlockUntilNextEventMatchingListInMode  
6  - 0x925b078d in _DPSNextEvent  
7  - 0x925affce in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]  
8  - 0x92572247 in -[NSApplication run]  
9  - 0x021f009c in QEventDispatcherMac::processEvents at qeventdispatcher_mac.mm:591  
10 - 0x01e47742 in QEventLoop::processEvents at qeventloop.cpp:149  
11 - 0x01e4799e in QEventLoop::exec at qeventloop.cpp:201  
12 - 0x01e49a33 in QCoreApplication::exec at qcoreapplication.cpp:1003  
13 - 0x02254c54 in QApplication::exec at qapplication.cpp:3581  

当我单击第 0 - 8 行时,Xcode 显示反汇编。

我更改了 Xcode 项目,以便在加载框架时使用 _debug 后缀。这允许我单步执行第 9 - 13 行中的 Qt 代码,但第 8 行在启动时调用,此后随时可能发生崩溃。

如果我无法设置断点,是否有任何工具可以帮助我调试此类问题?

提前致谢。

Should I be able to set breakpoints inside the Cocoa framework itself?

I've been seeing various crashes in my Mac OS X application, sometimes randomly. Here's part of an example call stack from Xcode:

0  - 0x98ed0e20 in __CFRunLoopRun  
1  - 0x98ece464 in CFRunLoopRunSpecific  
2  - 0x98ece291 in CFRunLoopRunInMode  
3  - 0x96a90004 in RunCurrentEventLoopInMode  
4  - 0x96a8fdbb in ReceiveNextEventCommon  
5  - 0x96a8fc40 in BlockUntilNextEventMatchingListInMode  
6  - 0x925b078d in _DPSNextEvent  
7  - 0x925affce in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]  
8  - 0x92572247 in -[NSApplication run]  
9  - 0x021f009c in QEventDispatcherMac::processEvents at qeventdispatcher_mac.mm:591  
10 - 0x01e47742 in QEventLoop::processEvents at qeventloop.cpp:149  
11 - 0x01e4799e in QEventLoop::exec at qeventloop.cpp:201  
12 - 0x01e49a33 in QCoreApplication::exec at qcoreapplication.cpp:1003  
13 - 0x02254c54 in QApplication::exec at qapplication.cpp:3581  

When I click on lines 0 - 8, Xcode displays disassembly.

I've changed my Xcode project so that it uses the _debug suffix when loading frameworks. This allows me to step through the Qt code in lines 9 - 13, but line 8 is called at startup and crashes can happen at any time after that.

If I can't set breakpoints, are there any tools that might help me debug problems like this?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

痴意少年 2024-10-27 19:01:44

您可以设置断点,以便它在您自己之外的代码上中断。但是您将无法看到源代码,因为您没有源代码。

在 xCode (3.xx) 中
“运行->管理断点->添加符号断点”

You can set up a breakpoint so it breaks on code outside your own. But you will not be able to see the source because you don't have the source code.

In xCode (3.x.x)
"Run->Manage Breakpoints->Add Symbolic Breakpoint"

夏日浅笑〃 2024-10-27 19:01:44

在 XCode 4 中,您可以使用

Product->Debug->Create Symbolic Breakpoint... 创建符号断点

In XCode 4 you can create a symbolic breakpoint with

Product->Debug->Create Symbolic Breakpoint...

漆黑的白昼 2024-10-27 19:01:44

在XCode 5中

调试->断点->创建符号断点

In XCode 5

Debug->Breakpoints->Create Symbolic Breakpoint

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文