views:

826

answers:

2

Boost is a great set of libraries and it really boosts productivity. But debugging code that uses it is a total nightmare. Sure, stepping through twenty thousand header files can be a valuable intellectual exercise, but what if you need to do it over and over again?

Is there a developer-friendly way of just skipping the boost portion and having the debugger go straight to my code?

Visual Studio has a DebuggerStepThroughAttribute for .NET framework. Is there anything similar for native C++?

+6  A: 

You can skip the boost namespace entirely by using the techniques described here. Just use something like:

boost\:\:.*=NoStepInto

... in the relevant registry entry.

However if your code gets called from within boost (e.g. through a boost::function or similar) then your code will be skipped as well! I'll be interested if someone can come up with a good solution for that problem...

Alastair
Arr, you beat me to it...:P
Andreas Magnusson
Put a breakpoint in the called function? Most debuggers I've worked with will get that one, although I've never explicitly disabled stepping into a namespace before :)
workmad3
Andreas: heh, yeah that's happened to me before. You have to be quick around here!workmad3: Yep, although if you don't know what the boost::function is currently assigned to, you can't really set a breakpoint...
Alastair
+8  A: 

There's no platform/compiler independent way, but I've been told that you can tell the debugger to not "step into" certain functions or classes. You should look up the registry key: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NativeDE\StepOver] and create a string value named as a number in the order the rules should apply (I'm a bit confused about it too, but I guess that the rules are simply ordered in the (possibly reverse) way they should be applied) and set it to something like: "boost\:\:.*=NoStepInto". E.g.:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NativeDE\StepOver]
"10"="boost\:\:.*=NoStepInto"

You can read a little bit more here.

Andreas Magnusson