Lldb Error Use Of Undeclared Identifier
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more lldb variable not available about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users variable not available xcode Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each lldb print variable other. Join them; it only takes a minute: Sign up lldb error: variable not available up vote 21 down vote favorite 4 Here are my two lines of code: NSString *frontFilePath = [[NSBundle mainBundle] pathForResource:[self.bookendFileNames objectAtIndex:self.randomIndex] ofType:@"caf"]; NSLog(@"frontFilePath
Xcode Lldb
= %@", frontFilePath ); I put a break point on the second line and when there, I try to print it: (lldb) po frontFilePath But I get the following error: error: variable not available I'm confused because if I step over the NSLog statement, the variable does indeed print to the console. For what it's worth, I'm trying to debug the first line since sometimes it returns NULL, tho I can't, as of now, figure out why. objective-c ios xcode lldb share|improve this question asked Oct 23 '12 at 23:18 ari gold 8781538 12 I think this is just part of Apple's ongoing effort to make Xcode less and less useful and usable. –Suboptimus Oct 23 '12 at 23:32 add a comment| 1 Answer 1 active oldest votes up vote 35 down vote accepted This is an artifact of debugging optimized code. When the compiler's optimization is enabled in your build settings, it moves variables between memory and registers as it decides is best. At the point where you're examining the variable in lldb, it may not exist in registers or memory at all -- even though it looks like it should still be available for display. It's possible it is a shortcoming of the debug information output by the compiler. Sometimes the compiler will copy a variable into a register for its use and only list that register location in the debug information. Later the register is repurposed for other uses; value is still present on the stack but the compiler hasn't told the debugger that the value can be found there. The only way to really tell whether it's insufficient debug info or if the value genuinely doesn't exist at that particular instruction is to examine the assembly code by hand. As soon as you turn on optimization with the compiler, the source code
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of http://stackoverflow.com/questions/13040777/lldb-error-variable-not-available 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up lldb error: use of undeclared identifier with local variable up vote 4 down vote favorite I've seen this thread. However, I'm having trouble not with ivar but with a regular instant varible. In Mapbox-ios-sdk there is this http://stackoverflow.com/questions/13741055/lldb-error-use-of-undeclared-identifier-with-local-variable code: UITapGestureRecognizer *singleTapRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)] autorelease]; singleTapRecognizer.numberOfTouchesRequired = 1; [singleTapRecognizer requireGestureRecognizerToFail:doubleTapRecognizer]; singleTapRecognizer.delegate = self; I tried printing singletapRecognizer there and there is some output. But not when I use debugger: (lldb) po singleTapRecognizer error: use of undeclared identifier 'singleTapRecognizer' error: 1 errors parsing expression Why is that? objective-c ios lldb mapbox share|improve this question edited Dec 6 '12 at 10:20 trojanfoe 91.6k11133170 asked Dec 6 '12 at 9:56 huggie 4,690105187 Are you sure you are at the right scope within lldb? –trojanfoe Dec 6 '12 at 10:22 Yes, I've just verified it just now. –huggie Dec 6 '12 at 14:11 add a comment| active oldest votes Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook. Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Na
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about http://stackoverflow.com/questions/11488361/lldb-error-use-of-undeclared-identifier Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up lldb error: use of undeclared identifier up vote 2 down vote favorite Anyone know variable not whats going on here: @implementation Test { NSData *_data; } - (id)initWithData:(NSData *)data { self = [super init]; if (self) { _data = data; } return self; // BREAKPOINT HERE } From lldb: (lldb) p data (NSData *) $1 = 0x07f911e0 30308 bytes (lldb) p _data error: use of undeclared identifier '_data' error: 1 errors parsing expression Why can't I view _data? objective-c ios xcode lldb share|improve this question asked variable not available Jul 15 '12 at 0:07 mark 602619 add a comment| 1 Answer 1 active oldest votes up vote -1 down vote I've only ever seen data fields declared in an @interface block; you appear to be defining fields in the @implementation. Try putting this in the header instead, e.g. @interface Test { NSData *_data; } . . . @end share|improve this answer answered Jul 15 '12 at 4:52 Kevin Grant 3,8241918 3 This is a new-ish Clang feature; it's perfectly legal and really nice. See: stackoverflow.com/questions/10407848/… –Josh Caswell Jul 15 '12 at 4:55 Neat. I guess I can use it for iOS but not older Mac development. :) In any case I suspect it may still be a factor in why a debugging tool cannot see the field. –Kevin Grant Jul 15 '12 at 5:00 Yes, lldb seems to still be having some rough times with ivars. I posted an answer here (now deleted) addressing that. –Josh Caswell Jul 15 '12 at 5:07 I'm still seeing this error message. Not even involving ivar, it's a local variable. –huggie Dec 6 '12 at 9:52 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Go