mmccarty12:
Looking more thoroughly at the output it looks like your wx is compiled in STL compatibility mode (--enable-stl or something like that)
Here is the output of a simple wxString variable:
> output test
{
<wxStringBase> = {
m_pchData = 0x6916d8 L"\x69d9c8"
}, <No data fields>}>>>>>>cb_gdb:
Can you provide a simple test project?
I have been having a problem for some time when I am trying to debug my wxWidgets projects. When I attempt to view the value of a wxWidgets object, many will give a message saying it is undefined in this context, although I am in the function that uses/defines the object. And when I comes to wxStrings, regardless of what is actually in the variable, when I try to output the value in the watch window all I get is "" for the value.
Any suggestions?
wxWidgets 2.9.0 - Mono-Shared-Debug-OpenGL-Unicode-GTK
wxWidgets 2.9.0 - Mono-Static-OpenGL-Unicode-GTK
C::B SVN 6178.
CentOS 5.4
I've found this happens when the variable being examined is associated with a return value (which is usually kept in a register) and gdb decides that the address of the variable/value is unreachable (which it is since it's in a register, not memory).
Example:
// ----------------------------------------------------------------------------
wxString ICCISPDlg::GetVerifyParms(const wxString& fname)
// ----------------------------------------------------------------------------
{
wxString parms = wxEmptyString;
if (IsSTK500() )
{
parms = wxString::Format(_T("-ve -ie%s"), fname.c_str());
}
#if defined(DEBUGGING)
wxString gdblook = parms; //assign to see in gdb
#endif
return parms;
}
Gdb is unable to display the value of the parms string (example above) because it's a returned value. Gdb version 6.8 thru 7.0.2 will display a value of "" (in CodeBlocks) while 7.5 will sometimes crash if it attempts to access the <string>.m_pchData address.
The work around is to assign the string to a local variable that is not a return value. Gdb can then successfully examine the local variable.
Half the problem here should be owned by Codeblocks. In Gdb version 6.8-702 (and mostly 7.5), Gdb reports that the address is invalid, but CodeBlocks ignores that message and blithly attemps to display the value anyway. CodeBlocks could parse the additional gdb message and report that the variable is "unreachable" or "may be a return value".
>>>>>>cb_gdb:
> whatis parms
type = wxString
>>>>>>cb_gdb:
> output &parms
(wxString *) 0x28dc5c>>>>>>cb_gdb:
> output /c parms.m_pchData[0]@((wxStringData*)parms.m_pchData - 1)->nDataLength
Cannot access memory at address 0x28dce0
>>>>>>cb_gdb: