I started to talk about GDB 64-bit and pretty printing at
http://forums.codeblocks.org/index.php/topic,17495.0.html, but there were several subjects and it remains only one now : so, a new clear fresh thread !
Well, I'm under Windows 7 64-bit. My project is compiled using the compiler delivered with the TDM64GCC 4.7.1-3 package. The debugger in use is GDB 7.5 (x86_64-w64-mingw32) coming with this same package. This debugger is Python-enabled.
My project being wxWidgets-based, to be able to watch data like wxString, I've followed the guide at
http://code.google.com/p/qp-gcc/wiki/GDB. Thus, I've added the wxWidgets-dedicated "print.py" Python script beside "gdb.exe" (under "C:\MinGW64\bin") and added the required initialization commands in CodeBlocks settings about debugger.
The problem is that the returned value look "undreadable" (directly I mean).
For example, watching this wxString :
wxString strTest = "C:/some/path/somewhere/test.txt";
I see :
L"C\000:\000/\000s\000o\000m\000e\000/\000p\000a\000t\000h\000/\000s\000o\000m\000e\000w\000h\000e\000r\000e\000/\000t\000e\000s\000t\000.\000t\000x\000t\000"
It's obvious the data are here : original "C" is shown as "C\000", ":" as ":\000", "/" as "/\000", etc. And the first idea is just to strip out these extra "\000" for every character, but the things are maybe more complex to manage others wx data classes covered by print.py (i.e. wxDateTime, wxFileName, wxPoint, wxSize, wxRect)...
So, is there a print.py script around which would be ready for 64-bit target ?
--
EDIT : OK, solved modifying the to_string() function of wxStringPrinter class in Python script like shown below.
Was :
def to_string(self):
return self.val['m_impl']['_M_dataplus']['_M_p']
And is now :
def to_string(self):
buff = self.val['m_impl']['_M_dataplus']['_M_p'].string()
return buff.decode('utf-16', 'ignore')
Also, at the beginning of script, I've added "import string". Now, wxString is displayed correctly in watching window.