delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/10/09/07:26:04

From: xiao AT cmold DOT com (Xiaomao Xiao)
Subject: B19: gdb and template
9 Oct 1998 07:26:04 -0700 :
Message-ID: <199810081758.NAA00352.cygnus.gnu-win32@spencer.actech.com>
Reply-To: xiao AT cmold DOT com
Mime-Version: 1.0 (generated by tm-edit 7.106)
To: gnu-win32 AT cygnus DOT com

Hi there:

I recently tried to debug a c++ program with templates.  I found that I cannot
step into the implementation of a template.  I prepared a simple example here to 
show what I mean.  Any advice is appreciated.

==================================
#include <stream.h>

template <class T>
void Print(const T & a)
{
  cout << a << endl;
}

void Print1(const float & a)
{
  cout << a << endl;
}

void Print1(const double & a)
{
  cout << a << endl;
}

main()
{
  Print(0.5);
  Print(0.4f);
  Print1(0.5);
  Print1(0.4f);
}
==================================

I used this command to compile the program: gcc -gstabs+ test.cpp -lstdc++.

When I tried to debug the program with gdb (4.16-B19), I could not step into the 
template function Print().  However I can step into function Print1().

What should I do to solve this problem?  Thanks!

-- 

Xiaomao

=================================================================
Xiaomao (Mark) Xiao                  E-Mail: xiao AT cmold DOT com
C-MOLD                                  TEL: (607) 257-4949 x 699
31 Dutch Mill Road                      FAX: (607) 257-6355
Ithaca, NY 14850                        URL: http://www.cmold.com
=================================================================
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019