Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: variable question?



Markian,

Normally, the combination "-g -O0" would cause the compiler to make space for "e" regardless of whether you use it or not. And, in fact, if you use just "-O0" there will actually be stack space set aside for "e". However, "-g" is not quite as simple a flag as it seems. What "-g" means is "use the default debug info generation that the maintainers of gcc for this platform think is advisable." On Mac OS X at present, "-g" generates stabs format debug information using the "used" optimization. This is a way of compacting debug information that Apple introduced a couple of years ago (and has since been adopted by the FSF community) where you ONLY dump debug info for types and variables that are actually used. Since "e" is not actually used, it doesn't get any debug info, and so the debugger can't find it.

I actually filed a bug a while ago that the "used" optimization only be applied to types, not to variables. But because most cases where it comes into affect are pretty artificial, the bug hasn't risen very high up on the gcc folks queue.

If it is really important that you force gcc to generate debug info for "e", you can use the "-gfull" flag instead, which turns off the "used" optimization. It will in most cases make the debug info bigger, however.

Hope this helps,

Jim

On Jan 30, 2005, at 8:15 PM, Markian Hlynka wrote:

shouldn't compiling with -g force e to exist?
Markian
On Jan 30, 2005, at 12:23, Chris Espinosa wrote:
On Jan 30, 2005, at 11:16 AM, Michael de Haan wrote:
The reason I am unable to view "e" in the debugger is because it has only been declared and not initialized?
Or is there a setting I am missing.
'e' doesn't exist. Since it's never assigned nor used, the compiler hasn't even allocated space for it to be stored. There's no information in your compiled code about where 'e' should be, so the debugger cannot show it.
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden
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: http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden
References: 
 >variable question? (From: Michael de Haan <email@hidden>)
 >Re: variable question? (From: Chris Espinosa <email@hidden>)
 >Re: variable question? (From: Markian Hlynka <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.