简体   繁体   中英

Can I set breakpoints in Cocoa framework code?

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.

In XCode 4 you can create a symbolic breakpoint with

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

In XCode 5

Debug->Breakpoints->Create Symbolic Breakpoint

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.xx) "Run->Manage Breakpoints->Add Symbolic Breakpoint"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM