Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* No symbol "<val>" in current context error for temporary variable in template class
@ 2008-05-29 17:58 Peng Yu
  2008-05-30 12:25 ` Andreas Schwab
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Yu @ 2008-05-29 17:58 UTC (permalink / raw)
  To: gdb

Hi,

I have the following code. I try to print the variable temp in the
constructor of A. But gdb can not do that. The error message is shown
blow the C++ code. Would you please let me know how to make it work?

Thanks,
Peng

template <typename T>
class A {
  public:
    A(int a) {
      T temp = a + 1;
      _a = temp + 1;
          }
  private:
    T _a;
};

int main() {
  A<double> a(1);
}


$ gdb main
GNU gdb 6.4.90-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...Using host
libthread_db library "/lib/libthread_db.so.1".

(gdb) start
Breakpoint 1 at 0x400510: file main.cc, line 13.
main () at main.cc:13
13        A<double> a(1);
(gdb) s
A (this=0x7fff250d7080, a=1) at main.cc:5
5             T temp = a + 1;
(gdb) n
6             _a = temp + 1;
(gdb) p temp
No symbol "temp" in current context.
(gdb)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-29  8:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-29 17:58 No symbol "<val>" in current context error for temporary variable in template class Peng Yu
2008-05-30 12:25 ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox