Page 1 of 1

debugger types for wxWidgets 2.9

Posted: Tue Mar 24, 2009 2:19 pm
by denk_mal
Hi,

i have tried to compile my projects on the upcoming wxWidgets 3.0 (aka 2.9)
Everything compiles fine (except some warnings about depecated methos ;) ) but the applications would not work correct.
So I have tried to debug my app with gdb but I can't see the content of wxStrings.
$(Variable).c_str().m_str shows me the pointer address but not the content :(

Has some already find out how to see wxWidgets 3.0 strings (compiled with wxUSE_STL=1) in gdb?

thanks
denk_mal

Re: debugger types for wxWidgets 2.9

Posted: Tue Mar 24, 2009 8:12 pm
by jfouche
I dont know the answer, but maybe this could be helpfull :
- In wxGtk and wxMac, wxString stores data in UTF-8 inside std::string
- In wxMSW, it stores in UTF-16, in std::wstring
(as far as I remember what I read)...
--
Jérémie

Re: debugger types for wxWidgets 2.9

Posted: Wed Mar 25, 2009 1:14 am
by DavidGH
Hi,

foo.utf8_str () works for me atm. However I'm not sure how robust it is: it worked once before, then stopped working a couple of weeks later :/

Regards,

David

Re: debugger types for wxWidgets 2.9

Posted: Wed Mar 25, 2009 3:53 pm
by denk_mal
jfouche wrote:I dont know the answer, but maybe this could be helpfull :
- In wxGtk and wxMac, wxString stores data in UTF-8 inside std::string
- In wxMSW, it stores in UTF-16, in std::wstring
(as far as I remember what I read)...
--
Jérémie
You are right. Here on wxMSW it will then UTF-16
http://docs.wxwidgets.org/trunk/overview_string.html explain it in detail

I have also tried foo.utf8_str() and foo.To8BitData() but none of them worked.
It seems to me a little bit that I have to convert a wxString to an old-standard char pointer on my own
and that every converting function returning a char pointer in 2.9 is overloaded by a function returning a wchar pointer. :?

I will try to findout more...
denk_mal

Re: debugger types for wxWidgets 2.9

Posted: Sun Mar 29, 2009 5:37 pm
by DavidGH
Another method that works for me is foo.wx_str(). This might be suitable for a wider spread of builds, as it does:
"Explicit conversion to C string in the internal representation (either wchar_t* or UTF-8-encoded char*, depending on the build)".

However it doesn't exist pre-2.9.