This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Command flags for debugging template code
- From: Stephen Torri <storri at torri dot org>
- To: John Love-Jensen <eljay at adobe dot com>
- Cc: MSX to GCC <gcc-help at gcc dot gnu dot org>
- Date: Tue, 27 Mar 2007 09:05:53 -0500
- Subject: Re: Command flags for debugging template code
- References: <C22E6D90.200E1%eljay@adobe.com>
Thanks for the programming idea. That is certainly an easy way of doing
what I want.
Stephen
On Tue, 2007-03-27 at 06:43 -0500, John Love-Jensen wrote:
> Hi Stephen,
>
> One of the problems with debugging (depending on the debugger and
> environment) is break points with inline functions.
>
> To give me a debug-able spot I can drop a breakpoint on, I've done this
> before:
>
> // --- Fruit.h ---
> void EljayBreakpoint();
>
> class Fruit
> {
> public:
>
> template <typename Basket>
> void print_Contents(Basket* container_ptr)
> {
> EljayBreakpoint();
> std::cout << container_ptr->dump() << std::endl;
> }
> };
>
> // --- Fruit.cpp ---
> #include "Fruit.h"
> void EljayBreakpoint()
> {
> std::cerr << "EljayBreakpoint: you are here\n";
> }
>
> And then I set the breakpoint inside EljayBreakpoint.
>
> I now realize I haven't needed to do this trick in many years. So either
> the debuggers are better on the platforms I'm using and can sensically step
> into inline functions, or I'm making less boo-boos.
>
> HTH,
> --Eljay
>