|
From: K. F. <kfr...@gm...> - 2010-05-11 21:44:17
|
Hello List!
I am having a problem where gdb reports an odd (garbage?) value for a data
member of a class. Am I doing something wrong? Is there a problem with
gdb that I should know about (and that maybe has a work-around)?
Here's the specific issue:
code fragment:
con.nvar_ = n;
unsigned uu = con.nvar_;
int ii = con.nvar_;
int kk = ii + uu; // <-- breakpoint
gdb results:
(gdb) print n
$1 = 100
(gdb) print con.nvar_
$2 = 2674944 [ <-- incorrect value ]
(gdb) print uu
$3 = 100
"con" is a local instance (on the stack) of a class that has
unsigned nvar_;
as a public data member.
As far as I can tell, the program runs correctly, and con.nvar_ in fact has the
correct value of 100. It appears to me that the only thing that is
wrong is that
gdb is not reporting the correct value for con.nvar_.
(I tried making a minimal test program, setting and using a data member of a
local class variable, but with the test program gdb displays the
expected value.)
My real application is a smallish Qt test application, built by
running mingw32-make
on the qmake-produced makefile.
Versions:
gdb --version
GNU gdb 6.8
This GDB was configured as "i686-pc-mingw32".
g++ --version
g++ (TDM-2 mingw32) 4.4.1
I am running a 32-bit tdm build of mingw on 64-bit windows 7.
Any thoughts would be appreciated.
K. Frank
|