Page 1 of 1

Viewing class static members in debugger

Posted: Thu Nov 29, 2012 4:18 am
by Arbalest
Is there a way to display the contents of static members of a class in the debugger? When I float over it and click CTRL nothing happens. When I add members to the Watch tab of the debugger nothing happens.

I am declaring and initializing the class and it's members before main() but I am not instantiating an instance of it. I thought I would be able to look at the contents of this static class as if it were any other global data.

Also, I don't see a tab to display "globals" in the same way you can display "locals" but I have been able to type other global expressions in the Watches tab and see them there. If there is a global tab I would like to know how to add it to the debugger pane but the main question here is how to see the values of static class members any which way.

Re: Viewing class static members in debugger

Posted: Thu Nov 29, 2012 10:22 am
by eranif
Arbalest wrote:Is there a way to display the contents of static members of a class in the debugger? When I float over it and click CTRL nothing happens. When I add members to the Watch tab of the debugger nothing happens.

I am declaring and initializing the class and it's members before main() but I am not instantiating an instance of it. I thought I would be able to look at the contents of this static class as if it were any other global data.

Also, I don't see a tab to display "globals" in the same way you can display "locals" but I have been able to type other global expressions in the Watches tab and see them there. If there is a global tab I would like to know how to add it to the debugger pane but the main question here is how to see the values of static class members any which way.
Atm, there are 2 ways to watch globals:

1) Explicitly type its full name in the "Watches"
2) Select it (its full path) in the editor and then Ctrl-Click

There is no "Globals" tab, there is a good a reason for this: if you type "info variables" - you will get tons of data (which in most cases, you dont care about)
We can introduce such tab that will work "on demand" with some kind of filters - please post a feature request on sourceforge - or it will get lost in this forum

Attached 2 screenshots that shows how you can currently view static members of a class
2.png
1.png
Eran

Re: Viewing class static members in debugger

Posted: Thu Nov 29, 2012 4:33 pm
by Arbalest
1) Explicitly type its full name in the "Watches"
2) Select it (its full path) in the editor and then Ctrl-Click
Interesting - I tried both methods before posting my question. It does
not work in my environment.

This is a small test program and everything is in main.cpp, not that
it should matter.

Re: Viewing class static members in debugger

Posted: Thu Nov 29, 2012 4:42 pm
by eranif
So this is the time to ask the additional information:
- Which OS?
- Which gdb version?

Eran

Re: Viewing class static members in debugger

Posted: Thu Nov 29, 2012 5:20 pm
by Arbalest
Windows XP (all updates applied).

GDB 7.0