This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug? GDB can't display c++ c'tor local variable.


Hi,

I found that GDB can't display local variables in a c++ constructor.

Please see the testing code below. When I stepped into the c'tor, and
typed ''info lo'', gdb responded "No locals.", however `tmp' is a
local with type int.

I searched on the web and somebody said it's a bug of gcc rather than
gdb. But that's for gcc 3.x years ago. (see:
http://gcc.gnu.org/ml/gcc-bugs/2007-08/msg00727.html)

Any hint???

Thanks!

Here's my system:
----------------------------------
Distributor ID: Ubuntu
Description:    Ubuntu 8.04.1
Release:        8.04
Codename:       hardy

g++ (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".

----- testing code ------
     1  #include <iostream>
     2
     3  using namespace std;
     4
     5  class A {
     6      public:
     7          int a;
     8          A();
     9  };
    10
    11  A::A()
    12  {
    13      int tmp = 5;
    14      a = tmp;
    15      cout << "a= "<<a<<endl;
    16      cout << "tmp= "<<tmp<<endl;
    17  }
    18
    19  int main()
    20  {
    21      A x;
    22      return 0;
    23  }
    24


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]