Re: Bug: Debugger doesn't correctly show static variables with member function scope
Re: Bug: Debugger doesn't correctly show static variables with member function scope
- Subject: Re: Bug: Debugger doesn't correctly show static variables with member function scope
- From: Jim Ingham <email@hidden>
- Date: Fri, 1 Sep 2006 16:11:38 -0700
Please file a bug on this at bugreporter.apple.com.
Thanks,
Jim
On Sep 1, 2006, at 3:52 PM, Andreas Grosam wrote:
The debugger is unable to show the correct value of a static
variable which is defined in a member function as shown in the
following example:
namespace n {
class Foo {
public:
static int bar()
{
static int c = 1;
return ++c;
}
};
}
If we step through a program and reach the function n::Foo::bar() we
should be able to view the static variable c with its current value.
However, in the Debugger in the Variables View, the variable
n::Foo::bar()::c doesn't show the correct value.
If the debugger would propperly apply scoping rules according the
language, we should see the variable c as a local variable since it
has function scope. In fact, the Debugger shows this variable as a
global - which isn't correct either. This is probably due to the
fact that static variables are instantiated in static storage (much
like a class static variable).
I also figured a problem with gdb, which is unable to print the
value of static variables with function scope:
(gdb) print n::Foo::bar()::c
returns an error message:
"A parse error in expression, near `::c'."
Note: I compiled this with the DWARF debugging format, which is
(*sigh*) not yet the default debugging format. With STAB, you may
not see the variable at all.
Andreas Grosam
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden