Command flags for debugging template code

Stephen Torri storri@torri.org
Tue Mar 27 09:51:00 GMT 2007


I have a C++ project that uses the boost graph library. Now the reason I
am emailing here is that I was wondering for general C++ code that uses
templates what flags should I use to enable gdb to stop in a template
function? For example if I had a header file that had:

class Fruit {
public:

	template <typename Basket>
	void print_Contents ( Basket* container_ptr ) 
	{
		std::cout << container_ptr->dump() << std::endl;
	}
};

Assuming that I had a class that supported the function dump() I could
then use this function. Well as I understand it the definition in the
header for the function dump() will be inlined anywhere it is used in
the code. Is that correct?

If it is then unless I keep careful management of print_Contents I may
not know its called. In the boost graph library there are a lot of ways
certain functions are used but require a indepth understanding of which
are called explicitly or implicitly. I would like such that if I used
flags X, Y and Z with the g++ compiler I can call gdb to stop in
function print_Contents. Do I make sense?

Stephen



More information about the Gcc-help mailing list