views:

170

answers:

2

Single stepping through code that uses any of the NS_INLINE functions from NSGeometry.h causes the debugger to lose sync with the current instruction pointer, making debugging the routines very difficult.

I've tried #undef NS_INLINE at the top of my implementation file,#define NS_INLINE in the precompiled header, looking for pragmas, compiler switches, etc., but no matter what, the functions always compile inline for my debug builds.

FWIW - NSMakeRect, NS_MakeSize, etc. all compile inline.

Question is, how do I get NS_INLINE to compile to nothing?

TIA, Paul

A: 

Is this really about stepping through built-in API functions, or are you trying to do something similar in your own code? If it's the former, is it just due to curiosity, or some other reason for debugging? If it's the latter, I'd suggest commenting out the NS_INLINE while debugging. If you're trying to change the inlining behavior of existing API functions, you may be disappointed, and there are probably better ways to go about it. If your intent is something else, please clarify so we can answer adequately.

Quinn Taylor
He can't comment out the NS_INLINE because it's in the header files in the SDK. His issue is that when he does a Step Into, it shows that the stack frame is still inside the inlined function when the instruction pointer is well beyond it. This is a known bug.
cdespinosa
Correct. I'm working on the Quicksilver code base and the issue interferes with fixing bugs and understanding what the code is doing.
Paul
Ah, I see, it's an Xcode bug when dealing with existing NS_INLINE functions. Thanks for clarifying, Chris.
Quinn Taylor
+1  A: 

NS_INLINE is wrapped in #if !defined(NS_INLINE). You just need to define it appropriately before you include the Foundation headers. Glancing at the original declaration, you'll probably just need to remove __attribute__((always_inline)) for the debugger to catch your symbols (assuming you're generating all debug symbols and running a debug build - if not, then you could do a little more work to get them to all be visible. Ideally, you'll just create your own label local to your project/group/libs so you can debug your own code more easily.

Justin