Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: typicalc on May 16, 2016, 10:17:58 pm

Title: When debugging how to see structure member value
Post by: typicalc on May 16, 2016, 10:17:58 pm
The watch -window shows structure pointer hex address values, I'd like to see the structure members also.
For example in my code I have:

void somefunc(struct address *test)
{
..
}

When debugging what goes on in "somefunc" I'd like to see what in test->street and test->name etc. I can enter each watch member but that is cumbersome. Is tehre an easier way?
Title: Re: When debugging how to see structure member value
Post by: oBFusCATed on May 17, 2016, 01:10:44 am
Write click on the watch and there is a menu item in the context menu that replaces the variable with its dereferenced value. It turns test into *test.
You can also manually enter dereferenced variables.
Title: Re: When debugging how to see structure member value
Post by: raynebc on May 17, 2016, 08:00:37 am
The only downside of showing an entire structure in the watch window (and this is minor of course) is that you can't control the displayed format of each member variable.
Title: Re: When debugging how to see structure member value
Post by: typicalc on May 17, 2016, 08:02:28 am
Thanks.
The watch window already had the local item "test", but clicking it procudes no ".." button. However entering "test" as a new watch item and clicking that got what I wanted.
Title: Re: When debugging how to see structure member value
Post by: oBFusCATed on May 17, 2016, 10:15:58 am
The "..." button is not what you want. :)
Enter *test and you'll see a lot better output. :)