 |
 |
gdb doesn't step into a template function
|
 |
|
 |
|
Senior User
Join Date: Nov 2002
Location: US
Status:
Offline
|
|
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
|
|
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
|
|
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?
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |