Had the same problem for a long time. Today I tried to solve this issue and here is my solution:
The problem actually occurs because wxWidgets (I guess since 2.9.?) is now using std::string internally. If you want more information on this, you could look into wx/stringimpl.h and search for
#define wxUSE_STL_BASED_WXSTRING. It is also possible to use their own implementation, if you
#define wxUSE_STL_BASED_WXSTRING 0 when building wxWidgets.
Because I do not want to switch back, I looked into the
share/CodeBlocks/scripts/gdb_types.script file for another solution. I'm not sure if the following code is 100% correct, but it actually works. Just put the following functions into the script and change in the RegisterTypes function the wxString type to the new functions.
function RegisterTypes(driver)
{
// wxString
driver.RegisterType(
_T("wxString"),
_T("[^[:alnum:]_]*wxString[^[:alnum:]_]*"),
_T("Evaluate_wxString3std"),
_T("Parse_wxString3std")
);
// ...
}
function Evaluate_wxString3std(type, a_str, start, count)
{
local oper = _T(".");
if (type.Find(_T("*"), false) > 0)
oper = _T("->");
return _T("print ") + a_str + oper + _T("m_impl._M_dataplus._M_p");
}
function Parse_wxString3std(a_str, start)
{
local index = a_str.Find(_T("\""));
if (index < 0) return _T("");
return a_str.Mid(index, a_str.Length()-index);
}
It works only with watches not with locals or function arguments (currently using Code::Blocks 13.12). So maybe someone has an answer to the following questions:
- Could the script somehow be executed on locals and functions arguments?
- Is it possible to view the raw data or disable the script on a single variable?