Xcode 4.X still has a sucky debugger(s)

July 31, 2011

Even with all the massive changes to Xcode 4.X, it seems like no one at Apple has ever used Visual Studio's debugger to steal ideas from, and both Xcode debuggers are still pathetic.

The only thing I like in Visual Studio is the debugger, which totally rules for debugging C++. It understands STL types and always tries its best to show you as much information about an object or pointer or structure if it can.

Apple on the other hand seems to think that C++ is unimportant to anyone using Xcode. Only Objective-C gets any debugging love at all. So the GNU debugger can't even display a simple c-string much less a std::map. Even the new LLVM debugger which does have a few more features fails completely as a C++ debugger. Even a c-string with its c-string formatting shows stupid things like 'dog\0\0\0\0\0\0\0\0\0\0\0\0'.

Why? After all these years of debugging C++ apps with a Cocoa wrapper I grit my teeth anytime something goes wrong with my C++ and I have to try to debug something. Lots and lots of clicking to expand objects so I can see what's in them. Since I use STL heavily debugging a map means ... putting print statements in the source. Yeah, like I did in 1983. Is this useful to debug with:

mGrid	std::CardPtrVector	
  std::_Vector_base<ACard *, std::allocator<ACard *> >	
                 std::_Vector_base<ACard *, std::allocator<ACard *> >	
    _M_impl	std::_Vector_base<ACard *, std::allocator<ACard *> >::_Vector_impl	
    _M_start	ACard **	0x00000001003776e0
    _M_finish	ACard **	0x0000000100377800
    _M_end_of_storage	ACard **	0x0000000100377800

Of course I could use GDB and spend hours typing casts and the like, or creating Apple's completely moronic data formatters from hell.

I want to debug my code, not Apple's lack of interest in C++.

In Xcode 4.1, unlike all prior versions, creating a new C++ cpp file does not create the matching .h file unless you find and then twiddle with the file template. Why, I have no idea other than C++ may as well be APL as far as Apple is concerned.

I work in both Windows and OS X in my day job, and use C++ as the core of my iOS and OS X stuff at home so I need to be able to debug C++. Grrrr.