[prev in list] [next in list] [prev in thread] [next in thread] 

List:       suse-programming-e
Subject:    Re: [suse-programming-e] Debugging c++ template classes
From:       "Steven T. Hatton" <hattons () globalsymmetry ! com>
Date:       2005-12-01 19:44:21
Message-ID: 200512011444.21466.hattons () globalsymmetry ! com
[Download RAW message or body]

On Thursday 01 December 2005 09:46, Jerry Feldman wrote:
> I'm working on a huge (1,000,000 lines of code + 12 3rd party libraries)
> project and I'm trying to use gdb to debug some template classes. More
> specifically, I've got a template within a template. I want to be able to
> get a breakpoint.
> Note that my GDB script has a number of dir commands so it can find all the
> sources and header files.
> In this case, there is a static class variable I want to set a watchpoint
> on.
> But, even when stepping thorough I generally cannot even view the lines of
> code (templates are generally inlined).
> In this particular case I am using the Intel C++ compiler on an Itanium
> processor.
>
> What is really strange is that the Intel version of the code fails to
> obtain some data, but executes and exits cleanly. The g++ code executes
> cleanly and segfaults on exit.
>
> There are other debugging techniques I am using, but the ability to step
> into or set a breakpoint in a template class function would save me some
> time.

I don't believe you will be able to do that.  The problem is that templates 
are actually converted into "regular source code" and then compiled.  The 
only thing I can think of which might shed some light on things is running 
`objdump -C ' on the object code.  Depending on your situation, that may, or 
may not be useful.

The difference in behavior between the two compilers is probably a result of 
the "unspecified behavior" related to program termination.  My guess is, the 
g++ generated version is trying to execute some cleanup code that is 
accessing an invalid memory address.  Examine your destructors carfully.

Steven

-- 
To unsubscribe, email: suse-programming-e-unsubscribe@suse.com
For additional commands, email: suse-programming-e-help@suse.com
Archives can be found at: http://lists.suse.com/archive/suse-programming-e

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic