No symbol in debugger, xCode 4 - iphone

Hi I'am running a debug build with NO optimizations and "DWARF with dSYM file" as debugging format. Why can't I print my dictionary to console? Have I missed something? xCode version is 4.0.2 and Iam using LLVM 2.9 svn version with GDB debugger.

Can't say that I know for sure, but here are a few things to try...
Try "po [dict description]"
Try cleaning before you compile in case old symbols file stuck around for some reason
Are you attaching the debugger after launch? I've had problems with this.
Is this breakpoint firing during the launch? Also had problems with this.
Can you print anything else?
Try inserting an "NSLog(#"%#", [dict description])" in there.
Is your SessionManager for certain returning something that is both a) not nil and b) responds to the selector "description:"? If not you may get nothing.
Looking at your log, my first guess is that you're breaking before the debugger has had a chance to attach properly. Totally a guess, but try the NSLog thing and see if you get output.

Related

Xcode "Use of undeclared identifier" errors, compiles/runs just fine

I've got an incredibly annoying issue that is hampering my workflow. In my project I have "User of undeclared identifier" errors all over. They are all in reference to a single class, specifically a Theme class. I checked for any circular referencing with my imports, none. I'm really confused.
Here is a screenshot of the errors. I would post errors in the Build Log for more detail, but there aren't any. It builds and runs just fine...
I've tried cleaning, deleting the derived data... Any ideas?
I was having the same problem and noticed that all of the undeclared identifiers were declared in files that were in my pch file.
With this in mind I deleted one of the #import lines from the pch file and recompiled which failed as expected. I then put the deleted line back in, recompiled and it compiled normally with all the false errors gone.
Hopefully this simple solution helps a few of you out if the above solutions don't.
These kinds of errors are quite common with Xcode, unfortunately. It would be great if it would auto-refresh its error list all the time, but it doesn't always. When this happens, I strongly suggest that you restart Xcode, which will flush its error cache and hopefully solve your issues.
How are you including this class? In most cases I just include the class explicitly in header and/or body - instead of the *.pch file. Then this error goes away in my case.
Also deleting the derived data workes once in a while. Did you change the location in preferences recently by any chance. I also got this error when I use a ramdisk for derived data and then go back to default. This is the most annoying case - since it causes this error to appear then in almost every file.
This error seems to happen more often in Xcode 4.4 than the prior versions.
Have you included the library files correctly? Take a look at that. Sometimes ARC issues might occur if we don't include the correct file, or something's missing or not connecting UI.
For me the issue was that I created UnityInterface.h/m file to handle the obj-c to c# interface. UnityInterface.h is already defined by Unity. I renamed my own UnityInterface to _UnityInterface and now everything works.
Just posting this for anyone who might have this problem later and doesn't find any of these solutions to work:
If you have any pragma marked #if statements that only execute if the program is in debug mode it will obviously cause anything declared inside of them to not be declared when you try to archive/export.
I had the same problem. Closing and opening XCode didn't help.
I solved it by checking errors in other targets and fixing them (I had tons of errors in my unit testing target). Also I moved header links from h files to m files. But I'm pretty sure, that the first thing was critical.
For others who experienced the same problem and tried all solution above with no result, perhaps you should try something like I did. I solved the problem simply by unplugging my iPhone USB cable from my Mac and then replugged again those cable. After that, rebuilt again and all undeclared identifier errors were gone.
I had the same error. In my case, it was on this line of code:
- (void)playerItemDidReachEnd:(NSNotification *)notification {
// some code
}
My error message said:
Use of undeclared identifier 'playerItemDidReachEnd'
I tried added this line to the .h file:
- (void)playerItemDidReachEnd:(NSNotification *)notification;
I cleaned it, I re-booted my macbook, and I was still getting the error.
Finally, I decided to try to delete the line in the .h file. I then pasted it into a text file, and then copied and pasted it back in to the .h file.
Now I cleaned and VOILA' !!! no more errors. Go figure. This happens sometimes in VBA. Somehow there seems to be unseen formatting in a line of code. So I thought it might be happening with xCode. Cutting it out, pasting into a text file, cutting out of the text file, and pasting it back in right where it was - fixed it in my case.
---- UPDATE -----
The above was posted as my answer. Apologies, apparently there's something else wrong.
After cleaning - my ERRORS were gone. Now I tried to build and run my app. THE ERRORS CAME BACK! So this time I re-created the class files after cutting out all the text, and pasting it into a text file. I did it for both my .m and .h files. But now the errors are back again after trying to run. SORRY. I don't know how to delete this text altogether cuz it is not an answer.
Tried to build and run my app. THE ERRORS CAME BACK!
There was also an error msg that I was missing a bracket ( } ). Finally I looking at the method just before this method, and sure enought it was missing the ending bracket! That was it!
Might be little late in answering.
I had this issue very recently. I fix this by updating my OS and then updating Xcode. I tried updating Xcode alone but did not happen because Xcode 9.4 requires OS High Sierra 10.13.*
Happy Updating :)
It it compile time error
Use of undeclared identifier '<class_name>'
I was run into this issue when developing own framework and app. Objective-C consumer -> Objective-C static framework
Report Navigator had a clear description
umbrella header for module '<module_name>' does not include header '<class_name>.h'
The solution was just to add #import <class_name>.h into umbrella header in a framework target
Try to click Product -> Analyze, after that to Product -> Build. This helped for me.

XCode 4.2 Debugger Issue: Showing incorrect values + addresses for pointers

I've taken a screenshot of the compiler inconsistencies that I have been getting when creating new ViewControllers in my current project.
In this example, the debugger shows a different value for my variables 'kim', 'fakekim', and 'blah' from my log output (which shows the correct values). The debugger consistently shows the next instance variable obtaining the current instance variable's value ('fakekim' is assigned the value that 'kim' is supposed to have).
The issue seems to be project-specific. I've been able to reproduce the issue by importing my project on another Mac. However, if I create a new project, the debugger works fine. Was hoping to figure out the issue to prevent this from happening in the future.
Thanks for your help, StackOverflow community!
Edit: Larger screenshot image: http://i.imgur.com/QfZme.png
This was a (very annoying) bug with LLDB in Xcode 4.3. It has been fixed in 4.3.2.
Probably an Xcode bug. Try dragging the .xcuserstate file from you working project to your real one, and see whether that fixes it.
You could also try a clean build (shift-command-k).

xcode 4 debugging shows 'Summary Unavailable' for most objects

Whilst using Xcode 4.0 and trying to debug and see what value is held in what variable - or see what objects are in an array etc, I always seem to get "Summary Unavailable" or "Invalid Summary".
The problem seems much like the one in 3.2.6 if you built and ran a release version with the symbols stripped.
Any chance that any one knows where I am going wrong, or what the resolution is
For years things worked smoothly - then Apple stepped in - again.
Thanks
You're not going wrong, Xcode 4 is. This problem is pretty common, unfortunately. Report it at http://bugreport.apple.com/ and hope for the best.
In the meantime you can inspect variables using the console, which appears at the bottom of Xcode 4's window during debugging. If you have an object "myObj", you can inspect it in the console by typing "po myObj". It's a lot less convenient but it's better than not getting the information at all.
You can also try changing the "Summary Format" in the GDB window. Try something like {(NSString *)[$VAR description]}:s as the Summary format - this works for NSManagedObject derived objects.
While waiting for Apple to fix Xcode 4 you can try using "Print Description", which prints the value to console.
Start your app up in debug
IN XCODE 4.02, go to Product/Debug/Shared Libraries
The window that appears tells you which dynamicLibs are loaded
Scroll down until you see "libXcodeDebuggerSupport.dylib
Click the "Load" button, and then "Done"
After stopping on a breakpoint, the contents of a string should be printed in blue after the object's address.
Hope this helps!
This happened to me upon upgrade to xCode 4.3.1.
I found that editting the Run/Debug scheme and changing the Debugger setting in the Info tab from LLDB to GDB fixed the problem.
I had that problem. If you explicitly declare the ivars in your h file, they should show up in the debugger as expected.
#synthesize will create the proper ivers for you, but it does not always make them accessible in the debugger endless you use the command line po to look at them.
I have battled this issue for quite a while and I finally figured out the issue. I have several build configurations in my application (Debug, Release, UAT). When I hit 'Run' on my main scheme then I am using the 'UAT' configuration -- not 'Debug'. I realized that I was stripping debug symbols for my 'UAT' and 'Release' configurations. I simply modified my build settings to not strip debug symbols for the 'UAT' build configuration and voila, all my symbols are available again.
I am using XCode 4.5.1, but have seen this issue for quite a while on various projects. I assume that most of my projects use the 'Debug' build configuration by default and therefore were working fine. Only when I started getting fancy with my schemes and build configurations did I come across this issue.

What does "dwarf2_read_address: Corrupted DWARF expression." mean?

I'm trying to do a little debugging in my iPhone project, and whenever i try to print out an object to see its description in one specific method i get this message in gdb:
"dwarf2_read_address: Corrupted DWARF
expression."
Does anyone know why this happens and how i would go about fixing it so that i can inspect my variables?
Apparently this is a known bug in gdb, fixed in later versions (6.7 and above). I've found a reference to it in this bugzilla thread, but that's all I managed to find that's in any manner useful. Try updating your GDB installation.

Debug Iphone Program received signal: "EXC_BAD_ACCESS"

My iphone app randomly received this message. I know certain it is memory release problem. However what is the best way to find which object leads this problem. Here are what I have tried
Use Instrument Leak and
ObjectAllocation Trace. Dont saw any
help to know which object have this
problem
Put NSZombieEnabled=YES and project executive ... Dont saw any
help either
Put NSLog everywhere but the EXE_BAD_ACCESS just appear anywhere.
in the debuger, just saw the code
happened in the assembly. like
objc-msg send.
review code many times and read memory management a lot time
and research online a lot time. but
no surprise.
Is there a completed solution to figure out this problem easily. I am a previous Visual C++ programmer, I deal with memory management with years and it is easy to debug and figure out in Visual C++.
If you couldn't see any helpful debug info, I would suggest you find all the places that you are doing a release. It is most likely the case that you have released something that did not need to be released. Code would help us in tracing the issue with you.
As Juan noted, the first stop is the Debugger - what does the debug window give for a stack trace when the app crashes? You should be able to see the line it crashed on... you said in a comment to one response that you saw the crash happen around the lines:
CGPDFDocumnetRef docA=CGPDFDocumentCreatWithURL(myurl);
CGPDFDocumnetRef docB=CGPDFDocumentCreatWithURL(myurl);
Are you really using the same URL object for both calls? Which line is it exactly?
It could be something around the way you make use of the CGPDFDocumentRef, you can find example code how Apple uses them in the QuartzDemo project, file "QuartzImageDrawing.m" (you can find the demo project from the developer portal or embedded in the iPhone documentation with XCode).
XCode is actually pretty powerful, but it does things differently from other IDE's.
In addition to Erich answer, I'd want to add go backward. Start with the most recently added release and work from there.
I ran in to this and it turned out I was releasing an auto-released object that was returned from a convenience method built in to the Cocoa-Touch framework. My problem was as Erich described -- I released this auto-released object. When the system attempted to release it, the program gave the error you are describing.
Regards,Frank
The best way to know what happend is using the xCode Debbuger, give it a try.
You will also receive the message when you don't pass enough parameters to a variable argument method. For example having a NSLog statement like this: NSLog(#"Hello %#");
To check what the error might be
Use NSZombieEnabled.
To activate the NSZombieEnabled facility in your application:
Choose Project > Edit Active Executable to open the executable Info window.
Click Arguments.
Click the add (+) button in the “Variables to be set in the environment” section.
Enter NSZombieEnabled in the Name column and YES in the Value column.
Make sure that the checkmark for the NSZombieEnabled entry is selected.
found this on iPhoneSDK