User forums > Using Code::Blocks

[HOWTO] Set up GDB to debug wxWidgets (wxString)

(1/1)

BlueHazzard:
Hello,
here a little How to set up the new Debugger Interface in Codeblocks to display wxWidgets types like wxString...

1) Download an Python enabled GDB described here: https://code.google.com/p/qp-gcc/wiki/GDB

2) Download the wxWidgets GDB Python-script from here: http://svn.wxwidgets.org/viewvc/wx/wxWidgets/trunk/misc/gdb/print.py?view=markup
    I had to add:
--- Code: ---import datetime
import gdb
--- End code ---
at the beginning of the file

3) Open C::B -> Settings -> Debugger -> Default
    Add to "Debugger intializaton commands":

--- Code: ---python
import sys
import gdb
sys.path.insert(0,'path/to/wxWidgets-python-script')
import script_name
end
set print pretty 1
--- End code ---

you have to replace "path/to/wxWidgets-python-script" with your path to the wxWidgets script
and script_name with the filename of your script, without .py
The filename can't contain "-" or spaces

4) Remove tick from "Enable watch script"

5) enjoy the big  advantage to see what is stored in you wxString Variable

if you have trouble make a tick at  C::B -> Settings -> Debugger -> Common -> Full (Debug) log. Now you can see the full output of the gdb in the debugger log window.

sorry for the shortness, but my English is really bad....

greetings

ollydbg:

--- Quote from: BlueHazzard on July 24, 2012, 03:04:42 pm ---2) Download the wxWidgets GDB Python-script from here: http://svn.wxwidgets.org/viewvc/wx/wxWidgets/trunk/misc/gdb/print.py?view=markup
    I had to add:
--- Code: ---import datetime
import gdb
--- End code ---
at the beginning of the file

--- End quote ---
You post is quite nice for the beginners try to use python pretty printer.
If I remember correct, I don't need the above change to the wx's python pretty printer, maybe I use an old revision of the print.py.

eranon:
I've installed this wx-dedicated Python script some days ago and, in my case, I got this error :


--- Quote ---[debug]Error while executing Python code.
[debug]>>>>>  File "<string>", line 4
[debug]    import print
[debug]               ^
[debug]SyntaxError: invalid syntax

--- End quote ---

To remove-it I've had to add the "import gdb" line as BlueHazzard did, and rename the "print.py" script file to something else (I've choosen "wxprint.py"). Now it works w/o error.

This using python-enabled GDB 7.2.50.20101213, the python script of 2009-01-04, and Python 2.7 under Windows 7 Pro FR.

ollydbg:
@eanon, you can see this page: http://forums.codeblocks.org/index.php/topic,11301.msg77000.html
I have a detailed wiki page link in that page.
For gdb, you can use either official mingw's gdb(currently gdb 7.5), or other newer ones(include mybuild in the link above)

eranon:
OK, thanks Olly : bookmarked and I'll read calmly asap...

Navigation

[0] Message Index

Go to full version