This is the mail archive of the gdb@sourceware.cygnus.com 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]

STL support


I am wondering who to debug STL constructs with gdb. E.g. for a simple program 
(see below) gdb throws already

(gdb) p a.size()
Cannot resolve method vector<int,allocator<int> >::size to any overloaded 
insta\
nce
(gdb) p a[1]
Argument list of operator[] mismatch with component in the structure.
(gdb)

where the program is

#include <iostream>
#include <vector>
using namespace std;

int main() {
  vector<int> a;
  a.push_back(5);
  a.push_back(5);
  a.push_back(5);
  a.push_back(7);
  a.push_back(5);
  a.push_back(5);
  a.push_back(5);

=>exit(0);
} 


My gdb/g++ releases are

[rainer@rawu] ~$ gdb -v
GNU gdb 4.18
Copyright 1998 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 "sparc-sun-solaris2.6".
[rainer@rawu] ~$ g++ -v
Reading specs from /usr/local/gcc-2.95.1-binutils/lib/gcc-lib/sparc-sun-solaris
2.6/2.95.1/specs
gcc version 2.95.1 19990816 (release)
[rainer@rawu] ~$  


Is there any list, which is more suited for this querry than this one?

Thanks.

--Rainer.


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