Author Topic: Debugging with C structs  (Read 7354 times)

draggett

  • Guest
Debugging with C structs
« on: August 21, 2010, 07:23:33 pm »
My C programs uses lots of structs that point to other structs. The Code::Blocks debugger UI doesn't make it easy to see what is going on. You have to right click and select add watch, type the name of the variable containing a pointer to a struct, then right click on the watch and select dereference. I don't know how to follow pointers in the dereferenced struct to view a struct it points to.

I guess that there may be some limitations imposed by the debugger (in my case gdb as I am on Ubuntu Linux), but surely the UI could be improved to make dereferencing pointers to structs easier, and to allow you to follow struct pointers to whatever depth you need. One ideas is for Code::Blocks to show the triangle icon before all pointers to structs, so that you can dereference the contents at a single click.

How hard would it be to add this feature to Code::Blocks?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging with C structs
« Reply #1 on: August 21, 2010, 07:57:13 pm »
There is some work done on this feature in the debuggers branch.
But struct member dereferencing doesn't work too, but adding watches is way easier than the trunk version.
Unfortunately this feature can be implemented only if GDB/mi mode is used,
I've started work on a GDB/mi plugin, but it is not usable for debugging yet.

Some feedback on the changes in the debuggers branch will be wellcome.
You can find the branch in http://svn.berlios.de/wsvn/codeblocks/branches/wxpropgrid_debugger/?rev=6505&peg=6505#ab1bb068457ecc925a5b07fe41a91d401
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]