Let me start by saying that I've scoured other questions on here that are incredibly closely related, but haven't lent themselves to resolving my issue.
Setup:
- Win7 laptop, SSH/X11 to CentOS 6.4 Final running Eclipse Kepler SR2 w/ CDT 8.3
- GDB 7.2
- Managed corporate server that does not have Internet access (so no
svn co...
)
I am new to using Eclipse/CDT, but familiar with GDB. When I try to debug an application that uses STL, upon the first occurrence of an STL object, I get the below error(s). On programs with many, many STL objects, I get so many errors, that it makes single-stepping impossible. I have here a small sample program for illustration purposes.
Here is my sample program:
#include <iostream>
using namespace std;
int main() {
string sComplex;
sComplex = "!!!Hello World!!!";
cout << sComplex << endl; // prints !!!Hello World!!!
//cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
cout << "This is a new string that writes out a numeric..." << endl;
int i = 1000;
cout << "Value for integer 'i' is : '" << i << "'." << endl;
cout << " In HEX: '";
cout << std::hex << std::showbase << i;
cout << "'." <<endl;
return 0;
}
Here are the errors that print out as soon as it hits the first line (STL string instantiation):
Traceback (most recent call last): File "/usr/lib64/../share/gdb/python/libstdcxx/v6/printers.py", line 558, in to_string return self.val['_M_dataplus']['_M_p'].lazy_string (length = len) RuntimeError: Cannot access memory at address 0xffffffffffffffe8
Traceback (most recent call last): File "/usr/lib64/../share/gdb/python/libstdcxx/v6/printers.py", line 558, in to_string return self.val['_M_dataplus']['_M_p'].lazy_string (length = len) RuntimeError: Cannot access memory at address 0xffffffffffffffe8
Traceback (most recent call last): File "/usr/lib64/../share/gdb/python/libstdcxx/v6/printers.py", line 558, in to_string return self.val['_M_dataplus']['_M_p'].lazy_string (length = len) RuntimeError: Cannot access memory at address 0xffffffffffffffe8
First, notice that there are 3 separate errors for this one object. I have verified that the python pretty print module is installed and I have tried suggestions to limit the length in to_string, but to no avail. If I step past the string instantiation, everything works fine and I can see the simple string value of the variable. Mouse-over looks good too. When I debug this same application using gdb straight on the command-line, I don't see any such errors and variable values print pretty.
(gdb) p sComplex
$1 = "!!!Hello World!!!"
(gdb) p sComplex.c_str()
$2 = 0x602028 "!!!Hello World!!!"
I've tried various suggestions with my .gdbinit file and Eclipse's Window->Preferences->C/C++->Debug->GDB settings, even disabling pretty print, but it still happens. I don't know what else to try next.