Starting with wx 2.9, the wxString internal representation depends on the OS. Seehttp://docs.wxwidgets.org/trunk/overview_string.html
To get your own OS suitable type, use wxString::wx_str(), which returns a pointer of the needed type.
To get the length (in characters, not chars, no bytes, no etc.) there are three functions: Len(), Length() and length().
If you use Len(), then the compiler knows about it and can use it too. If your code does not, GDB neither.
In Squirrel language, I can't find a way for telling the size of an "external" array. So let's GDB manage it.
Because wxString is moving to use std::string, it seems length() (lower case letter) is available.
With all of this, the Evaluate_wxString function at gdb_types.script would look like:
function Evaluate_wxString(type, a_str, start, count)
local oper = _T(".");
if (type.Find(_T("*"), false) > 0)
oper = _T("->");
local result = _T("output /c ") + a_str + oper + _T("wx_str()") + _T("[") + start + _T("]@");
if (count != 0)
result = result + count;
result = result + a_str + oper + _T("length()");
Now, the C:B Watches window shows the contents of the wxString type var.
Note the GDB command 'output /c' will treat each character as an integer and display it in 7 bit ASCII or escaped sequences if value>127
So, if your wxString has some characters not representable in 7 bit ASCII, you'll see escaped sequences for them.
Looking at wx2.8.12 wxWidgets string.h, I find both functions (wx_str & length) are defined. So this script should work also for [all?] wx 2.8 series.