Author Topic: When debugging how to see structure member value  (Read 4764 times)

Offline typicalc

  • Multiple posting newcomer
  • *
  • Posts: 18
When debugging how to see structure member value
« 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?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: When debugging how to see structure member value
« Reply #1 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.
(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!]

Offline raynebc

  • Almost regular
  • **
  • Posts: 217
Re: When debugging how to see structure member value
« Reply #2 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.

Offline typicalc

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: When debugging how to see structure member value
« Reply #3 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: When debugging how to see structure member value
« Reply #4 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. :)
(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!]