• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bug: Debugger doesn't correctly show static variables with member function scope
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Bug: Debugger doesn't correctly show static variables with member function scope
      • From: Andreas Grosam <email@hidden>
References: 
 >Bug: Debugger doesn't correctly show static variables with member function scope (From: Andreas Grosam <email@hidden>)

  • Prev by Date: Bug: Debugger doesn't correctly show static variables with member function scope
  • Next by Date: Is xcodebuild multi-processor aware?
  • Previous by thread: Bug: Debugger doesn't correctly show static variables with member function scope
  • Next by thread: Re: Bug: Debugger doesn't correctly show static variables with member function scope
  • Index(es):
    • Date
    • Thread