Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: bamf226 on December 06, 2014, 01:32:45 am

Title: Viewing Linked Lists in C::B
Post by: bamf226 on December 06, 2014, 01:32:45 am
I've tried everything I can think of to get a linked list to appear in the Watches window.  It's easy enough to dereference head and see the contents of the node, but I can't seem to get past the head node except by hardcoding all the next pointers.  It gets to be pretty tiresome to type head->next->next->next to look at the fourth node in the list.  Is there any easier way that I can get the node contents to appear in the Watches window without a string of dereferenced next pointers?
Title: Re: Viewing Linked Lists in C::B
Post by: ollydbg on December 06, 2014, 03:23:52 am
You need to write your own GDB python pretty printers, see: STLSupport - GDB Wiki - Free software! (https://sourceware.org/gdb/wiki/STLSupport) and Debugging with GDB : Writing a Pretty - Printer (https://sourceware.org/gdb/onlinedocs/gdb/Writing-a-Pretty_002dPrinter.html)
Title: Re: Viewing Linked Lists in C::B
Post by: bamf226 on December 06, 2014, 05:29:36 am
That is well outside my area of expertise.  Is there a plug-in that someone else has already written that will do that?
Title: Re: Viewing Linked Lists in C::B
Post by: oBFusCATed on December 06, 2014, 12:18:59 pm
It depends on the library. If it is your own library then no - you have to do it yourself.

BTW: Never use linked lists they are sloooow:)