Author
Topic: A way to see wxString of wxWidgets 2.9.2 with gdb ? (Read 9732 times)

Since I began to work with wxWidgets 2.9.2 I cannot see wxString with the gdb debugger, it was working with wxWidgets 2.8.x but wxString code has changed and the gdb_types.script is not working with this new wxString code.

I have tryed to modify gdb_types.script but for the moment, I cannot found a way to make it work.Any idea ?

If some piece of memory should be reused, turn them to variables (or const variables).If some piece of operations should be reused, turn them to functions.If they happened together, then turn them to classes.

It's seems to be a litle bit more complex that I could read.The video http://people.redhat.com/ebachalo/video/archer-pretty-printing-no-audio.swf is no more avalaible.In downloaded file stdcxx_and_wx_pythonscript.7z, when I decompress, in wx folder I can see libwx\v28\: is this files are really working with wxWidgets 2.9 ?I use gdb 7.2, should I use C:\MinGW\bin\gdb.exe or C:\MinGW\bin\gdb-python27.exe as debugger ?gdb-python27.exe cannot be run because python dll is missing, so I have download and install python-2.7.2.msi here, gdb-python27.exe could now be run.In settings/compiler and debugger/debugger settings I put 2 lines :

Quote

source C:\MinGW\bin\stl.gdbsource C:\MinGW\bin\wx.gdb

Where should I put the file print.py ?

Will test and try to make it work. Will edit this message each time I'll make a step to explain exactly what I need to do to make it work.

If some piece of memory should be reused, turn them to variables (or const variables).If some piece of operations should be reused, turn them to functions.If they happened together, then turn them to classes.

I have just take several hours to build a wx 2.9.2 under pcx's mingw 4.6.1 then try to see whether it works on wxWidgets.it seems that you need to change the file:MinGW_gcc4.6.1release_static_win32\bin\libwx\v28\printers.py

If some piece of memory should be reused, turn them to variables (or const variables).If some piece of operations should be reused, turn them to functions.If they happened together, then turn them to classes.

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:

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>127So, if your wxString has some characters not representable in 7 bit ASCII, you'll see escaped sequences for them.

N.B.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.