Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: GravityWell on October 25, 2012, 05:15:49 pm

Title: GUIDE - STL Pretty Print in Code::Blocks
Post by: GravityWell on October 25, 2012, 05:15:49 pm
Guide is now on the Codeblocks Wiki (http://wiki.codeblocks.org/index.php?title=Pretty_Printers)
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: Jenna on October 25, 2012, 05:19:22 pm
Can you add this to the wiki ?
You can use the same credentials to login there as for he forum.
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: GravityWell on October 25, 2012, 07:37:44 pm
Done. I don't know if I should add a link somewhere on the main Wiki page.
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: ollydbg on October 26, 2012, 02:07:32 am
Done. I don't know if I should add a link somewhere on the main Wiki page.
Nice work.
I see in wiki page:
Quote
Comment out the Codeblocks gdb handler:
, I think it is not necessary, because we have an option in debugger setting dialog.
"Enable watch scripts", just uncheck it. :)

BTW: you can add many other pretty printers like wxWidgets' pretty printers.
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: GravityWell on October 26, 2012, 02:50:52 am
Nice work.
I see in wiki page:
Quote
Comment out the Codeblocks gdb handler:
, I think it is not necessary, because we have an option in debugger setting dialog.
"Enable watch scripts", just uncheck it. :)

BTW: you can add many other pretty printers like wxWidgets' pretty printers.

Thanks, I didn't realize that option was there. Wiki page is updated to use this much easier method. I haven't started using wxWidgets yet. Is the built-in watch script broken for that too?
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: ollydbg on October 26, 2012, 02:59:16 am
Is the built-in watch script broken for that too?
I think the built-in script for wx can only handle wxString class, but the pretty-printer for wx also support many other class (wxRect, wxArrayString.....)
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: killerbot on October 26, 2012, 07:39:41 am
and what needs to be done for linux ? The guide doesn't mention that.
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: oBFusCATed on October 26, 2012, 09:24:28 am
and what needs to be done for linux ? The guide doesn't mention that.
GDB on linux should be able to find the pretty printers automagically.
So it should just work. The STL ones are shipped with gcc >=4.5 by default.

Probably I should remove the old scripting functionallity at all :)
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: Martin K. on October 26, 2012, 10:02:44 am
Probably I should remove the old scripting functionallity at all :)

Ohh, than i should not implement it in the CDB Plugin?

Martin
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: oBFusCATed on October 26, 2012, 12:30:27 pm
Ohh, than i should not implement it in the CDB Plugin?
You can do it in a CDB specific way probably. As far as I remember the scripting is inside the GDB plugin, not in the public API.
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: GravityWell on October 26, 2012, 07:20:00 pm
and what needs to be done for linux ? The guide doesn't mention that.
GDB on linux should be able to find the pretty printers automagically.
So it should just work. The STL ones are shipped with gcc >=4.5 by default.

Probably I should remove the old scripting functionallity at all :)

I'm working on adding this to Linux, and will update the guide. As far as I can tell, the printers are not included with GDB, at least with my version of Ubuntu. I had to download the printer and make a command file.

A problem with Codeblocks on Ubuntu is this:
(http://img171.imageshack.us/img171/6241/debuggersettings.png)

I think a work around is to manually edit Codeblocks default.conf.
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: oBFusCATed on October 26, 2012, 07:31:12 pm
I'm working on adding this to Linux, and will update the guide. As far as I can tell, the printers are not included with GDB, at least with my version of Ubuntu. I had to download the printer and make a command file.
Probably they are in a separate package you need to install.
Or this might be bug in ubuntu https://lists.ubuntu.com/archives/foundations-bugs/2011-October/046696.html

A problem with Codeblocks on Ubuntu is this:
(http://img171.imageshack.us/img171/6241/debuggersettings.png)

I think a work around is to manually edit Codeblocks default.conf.
Which version of C::B is this?
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: GravityWell on October 26, 2012, 07:48:08 pm
8466 - Oct 21 2012 via the Pasgui PPA.
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: oBFusCATed on October 26, 2012, 09:10:48 pm
Morten: Can you apply the same magic you've applied here: http://svn.berlios.de/wsvn/codeblocks/trunk/src/sdk/resources/select_target.xrc?op=diff&rev=7937&peg=7937&ignorews=1 ?
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: GravityWell on October 26, 2012, 09:27:49 pm
I have the python printers working in Ubuntu and will update the guide soon. Can anyone say why the -nx parameter is always being passed to GDB from Codeblocks?
http://sourceware.org/gdb/current/onlinedocs/gdb/Mode-Options.html
It disables GDB startup commands, so this removes our option to add pretty printers to ~/.gdbinit.
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: GravityWell on October 27, 2012, 12:55:56 am
Guide is updated to include Linux. Let me know how it goes if you try it.
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: GravityWell on October 27, 2012, 04:14:52 am
Morten: Can you apply the same magic you've applied here: http://svn.berlios.de/wsvn/codeblocks/trunk/src/sdk/resources/select_target.xrc?op=diff&rev=7937&peg=7937&ignorews=1 ?
I just noticed something that may help in reproducing this. It seems if I start Codeblocks without a project, from the Linux start menu or desktop, then load a project, the problem with the "Debugger initialization commands" appears. If I launch Codeblocks with a project, such a double clicking a .cbp file, then the "Debugger initialization commands" text box is properly sized and works.
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: MortenMacFly on October 27, 2012, 05:36:04 pm
Morten: Can you apply the same magic you've applied here: http://svn.berlios.de/wsvn/codeblocks/trunk/src/sdk/resources/select_target.xrc?op=diff&rev=7937&peg=7937&ignorews=1 ?
Well actually this is a different issue here, but you can try the patch attached and tell me if that helps (I don't have Linux to test ATM)...

BTW: To me it seems more like a WX bug related to static sizers.
Title: Re: GUIDE - STL Pretty Print in Code::Blocks
Post by: GravityWell on October 27, 2012, 09:05:09 pm
Removing <option>1</option> didn't seem to make any difference. Removing the multiline style solved it, but then of course it is limited to one line. It could probably be much better debugged in a IDE in Linux, but my abilities and interest in Linux is limited. Barring any other developments, I think I'll update the Wiki page to recommend opening a project via CBP file if necessary, which seems to be a functioning work-around for some reason.