debugger types for wxWidgets 2.9

General questions regarding the usage of CodeLite
denk_mal
CodeLite Enthusiast
Posts: 16
Joined: Mon Oct 13, 2008 6:20 pm
Contact:

debugger types for wxWidgets 2.9

Post 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
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: debugger types for wxWidgets 2.9

Post 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
Jérémie
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: debugger types for wxWidgets 2.9

Post 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
denk_mal
CodeLite Enthusiast
Posts: 16
Joined: Mon Oct 13, 2008 6:20 pm
Contact:

Re: debugger types for wxWidgets 2.9

Post 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
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: debugger types for wxWidgets 2.9

Post 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.
Post Reply