Boost logo

Boost Users :

Subject: Re: [Boost-users] can't debug into BOOST_FOREACH?
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2009-03-02 08:14:29

On Mon, Mar 2, 2009 at 1:43 PM, Stephan Menzel <>wrote:

> Hi there,
> I just noticed there seems to be no way of debugging into a BOOST_FOREACH
> loop... Is that true?
> I use g++ 4.3 / gdb 6.8 here and neither would the debugger stop any any
> breakpoint inside such loops nor can I step into them from outside. Is this
> supposed to be like that?
> puzzled...
> Stephan

AFAIK BOOST_FOREACH is a macro. Therefore it is expanded by pre-processor
into the real code. Can you debug into macros with g++/gdb anyway? MSVC
supports that, but what about g++/gdb?

There might be some workarounds, like temorary modifying the BOOST_FOREACH
code and placing a debug break compiler intrinsic call into it. I think than
you might be able to stop the debugger inside, but not sure what is shown

Good Luck,

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at