This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

[g++] cannot debug static const data members



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++

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