This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[g++] cannot debug static const data members
- To: gcc-bugs at gcc dot gnu dot org, jason at cygnus dot com, mark at codesourcery dot com, rth at cygnus dot com, dberlin at redhat dot com
- Subject: [g++] cannot debug static const data members
- From: Benjamin Kosnik <bkoz at redhat dot com>
- Date: Fri, 22 Dec 2000 02:34:38 -0800
I've been pleasantly surprised with the recent and newly-found ability
to debug c++ code produced with g++ in gdb. Thanks guys. I know Jason
and Richard have done work on this lately.
example: I can now see a std::string in gdb.
source:
std::string s01("touch of evil");
gdb:
$1 = {static npos = 4294967295,
_M_dataplus = {<allocator<char>> = {<No data fields>},
_M_p = 0x80dca9c "touch of evil"}, static _S_empty_rep_storage = {0, 0, 3,
0}}
awesome!!!!
Anyway. Now I'm moving on to bigger and badder data types (say,
std::locale), and am running into a problem seeing static data
members. Here's a brief, very brief example:
// start
class __ios_flags
{
typedef short __int_type;
public:
static const __int_type _S_dec = 98;
};
const __ios_flags::__int_type __ios_flags::_S_dec;
int main()
{
return 0; // (gdb) p __ios_flags::_S_dec
}
// end
gives, with gdb-5 and current CVS g++:
(gdb) p __ios_flags::_S_dec
Cannot access memory at address 0x62
What gives?? Am I a fool for expecting this to work? Is there an easy
(or even hard) way for me to tell what static const data members in a
given abstract data type have not been defined, or which ones have
definitions that cannot be found, or some other voodoo or spell
casting I can do to make this work?
-benjamin
FYI current gdb is a regression on gdb 5 WRT debugging c++