Robin
Robin

Reputation: 705

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.

Upvotes: 2

Views: 1308

Answers (3)

Victor Ronin
Victor Ronin

Reputation: 23268

In XCode 5

Debug->Breakpoints->Create Symbolic Breakpoint

Upvotes: 2

Nancy Poekert
Nancy Poekert

Reputation: 290

In XCode 4 you can create a symbolic breakpoint with

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

Upvotes: 2

Konrad77
Konrad77

Reputation: 2535

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"

Upvotes: 2

Related Questions