Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > gdb doesn't step into a template function

gdb doesn't step into a template function
Thread Tools
Senior User
Join Date: Nov 2002
Location: US
Status: Offline
Reply With Quote
Nov 19, 2002, 07:16 PM
 
After many head scratching, I found gdb doesn't allow me to step into a template function. Consider the following simple code:

--
#include <iostream>

using namespace std;


template <class T>
class Foo {
T i;

public:

Foo (const T &i):i(i) {}

const T &read () const { return i; }
};

int main () {
Foo<int> foo(10);

cout<<foo.read()<<endl;
return 0;
}
--

When executing to the line of foo.read(), I can't step into the method.

Note I tried -g and -finline-limit=0 but I got the same behavior. Is there some secret inline code generation that I had not turned off? Or what else am I missing here?
     
Professional Poster
Join Date: Apr 2001
Location: Seattle, WA
Status: Offline
Reply With Quote
Nov 21, 2002, 11:57 AM
 
dunno about special settings (I fear the preferences of Project Builder), but i have the same problem, which is getting very frustrating, considering that ALL the classes I have been writing have been template classes. My "workaround" has been debugging via the insertion of cout statments, to see how far the program gets, then getting someone else to explain my code to, since usually when "reading it" aloud, I see the bug. good luck
The short shall inherit the earth. Just you wait. You won't see us coming. We'll pop out from under tables, beds, and closets in hordes. So you're tall, huh? You won't be so tall when I chew off your ankles. Mofo
     
Senior User
Join Date: Nov 2002
Location: US
Status: Offline
Reply With Quote
Nov 21, 2002, 03:46 PM
 
Glad to know I'm not the only one having this problem. And it's even not restricted to Project Builder! I've tried using ddd and gdb support in emacs, and none of them allowed me to step inside a template function! This hints at that the real problem might be gdb.

But don't you feel strange? This is such an obvious problem and no one has noticed it?
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:22 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2