Author Topic: Can't see value of unicode strings while debugging  (Read 16740 times)

Offline Ramazan Kartal

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Can't see value of unicode strings while debugging
« Reply #15 on: November 06, 2007, 12:35:43 am »
Hi,

Quote
Ramazan's solution works and is even ok for wxString. But this can't be said about other libraries, especially STL. Its implementation is vendor specific and in order to access a container's contents we must use library exposed functions (if we want to be portable), like c_str() for strings.

Then I assume it is ok to provide a patch just for wxString, because wxString internals are not implementation dependent. Am I right? Alternatively, I can write an article in wiki detailing the necessary changes in 'gdb_types.script'.

Regards,
Ramazan Kartal
 
« Last Edit: November 06, 2007, 01:00:59 am by Ramazan Kartal »

Offline marlo

  • Single posting newcomer
  • *
  • Posts: 8
Re: Can't see value of unicode strings while debugging
« Reply #16 on: November 07, 2007, 08:47:34 am »
Dear all,

In case the patch as proposed by Ramazan does not “break” debugging support for debuggers other than GDB, I strongly support that proposal.

From Mandrav’s feedback I understand that the patch is not a “general” solution and that it will not work for more complex data structures (when using the Static wxWidgets library).

However, the wxString data structure is rather fundamental in programming, just like simpler data types like int, long, bool, etc. In my opinion this should be enough to justify the patch.

The ability to debug wxString variables, independent of the wxWidgets library used (static or shared) would be very useful, especially for new users of the CodeBlocks environment. And where possible, the learning curve should not be steeper then strictly necessary.

Therefore I would like to ask the CodeBlocks development team to seriously consider implementation of the patch.



A small note on what brought me to use the Static wxWidgets library as opposed to the Shared wxWidgets library:

I'm using Biplab's wxWidgets Project wizard. Limitation of the wizard is that it will setup the CodeBlocks project to use the same wxWidgets library for both the Release Target and the Debug Target (either Static or Shared).
For Release Targets I prefer to have an executable that doesn't depend on DLL files, hence the static library.

Quite some time ago I've asked Biplab about the possibility to add support to the wxWidgets Project Wizard to support different wxWidgets library types for Release and Debug Targets (which was not easy to do). At that time my motivation for this request was only related to the required HDD space for the Static wxWidgets Debug library (about 360 MB) compared to the Shared wxWidgets Debug Library (about 75MB).

But after this useful discussion I think there is a much stronger argument for the request to change the wxWidgets Project Wizard to support different library types for Release and Debug targets: not the required HDD space (which probably affects only a small group of people) but being able to set up the CodeBlocks project for optimal debugging support.
 

Regards, Marlo.
« Last Edit: November 07, 2007, 08:52:33 am by marlo »

Offline Hitnrun

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Can't see value of unicode strings while debugging
« Reply #17 on: November 07, 2007, 09:33:46 pm »
I'm working with ICU, and my life is much more miserable than when working with wxString. The watch windows just displays "incomplete type", and says that UnicodeString is a struct not a class??

s = (const struct icu_3_6::UnicodeString &) @0xbfedeaa8: <incomplete type>

It is hell on earth trying to debug a program where you can't see the string values in a debugger.
« Last Edit: November 07, 2007, 09:36:15 pm by Hitnrun »

Offline Hitnrun

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Can't see value of unicode strings while debugging
« Reply #18 on: November 07, 2007, 10:18:48 pm »
I made the problem less worse, recompilling ICU with debug symbols. In ubuntu, ICU doesn't have a -dbg package so I had to do this:

# apt-get source icu
# cd icu-3.6
# export DEB_BUILD_OPTIONS=nostrip
# dpkg-buildpackage -rfakeroot -uc -us
# dpkg -i ../*.deb

Now I can at least see the class private fields... still not easy, but at least no impossible!

Offline Hitnrun

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Can't see value of unicode strings while debugging
« Reply #19 on: March 25, 2008, 10:22:16 pm »
I found a (hackish) way to display ICU strings, it is not pretty but works, better than nothing!

In debugger settings -> debugger initialization commands, put this text:

Quote
def pu
  set $uni = $arg0
  set $i = 0
  while (*$uni && $i++<500)
    if (*$uni < 0x80)
      printf "%c", *(char*)$uni++
    else
      echo "?"
      *(short*)$uni++
    end
  end
end

Now when you run your program, instead of using the watch window, use Debug->Send user command to debugger, and enter

pu <icu_variable_name>.fArray

and you will have a somewhat pretty print of all ASCII on your string on the debugger window.