9

I don't understand this at all, but I can no longer see any locals or ivars when debugging my iPhone app with Xcode 3.2.3. Everything seemed normal until yesterday afternoon, and now I just see the globals and registers, which are not of much interest to me.

HAs anyone else had this experience? I feel like I have gone crazy. How can the debugger "forget" to show me variables? Its the debug build, non-optimized code generation, breakpoints work, where are the variables?

I am so sorry I upgraded to Xcode 3.2.3. What a mistake that was. I am so not impressed.

Oh, yeah, I built a template app just to see if THAT one would debug normally and it does, so I am looking at the differences in the project settings to see if that holds a clue.

Paul
  • 231
  • 1
  • 4
  • 8
  • What does the debugger console say? – zneak Jul 23 '10 at 20:10
  • I see plenty of stuff there, all my NSLogs and such. Same as before. Lucky, since it looks like that's how I will be debugging this from here on out! – Paul Jul 23 '10 at 20:26
  • I've had that happen as well, and like you, as soon as I try to isolate the problem, it disappears. The problem is not the debugger itself, the problem is missing debug information for the particular method information in the object file. In my case, the problem was isolated to a particular method. Other methods in the same class all from the same source file were all OK. I don't think messing with the project settings will do anything for you (but please report back if it does). I suspect it may be specific to migrating a project to 3.2.3. – Jay O'Conor Jul 23 '10 at 20:29

6 Answers6

19

In my cases it was the optimisation for debug.

In the build settings Optimization Level was set to Fastest for both Debug and Release. I switched Debug to None and it solved the issue.

enter image description here

Tibidabo
  • 21,461
  • 5
  • 90
  • 86
  • 2
    Boy, I was very close to using my workstation as well as server for target practice! Thanks a bunch. It would have taken me a while longer to get to this point! – Marc Brannan Aug 19 '13 at 21:04
  • If this is set to fastest. It can drive the debugger crazy and provide inaccurate messages!!! Thank you. – zirinisp Feb 09 '15 at 15:52
8

Close the project, open Terminal, cd into the <project>.xcodeproj directory, delete all <username>.* files (i.e. delete everything except project.pbxproj), then try opening your project again.

(Note: don't worry about the files you are deleting - they are just per-user setting files for things like window positions, saved breakpoints, etc - the important stuff is all in project.pbxproj.)

One other thing that has also solved problems for me in the past is to trash the entire build folder.

Paul R
  • 208,748
  • 37
  • 389
  • 560
  • Yeah, I tried that (via the Finder, but same idea). I set three breakpoints at various points in the code. The first two I get to, I see locals/self/arguments. When I get to the last (the deepest into the app), all I see are the globals/registers. There is a local var right there in the code, and its value has been printed out to the console via a NSLog call, but the debugger does not show it. Another odd thing is that Xcode no longer seems to have tooltips for the variables. Anyone notice that? – Paul Jul 23 '10 at 21:35
  • 1
    Try deleting the build folder too - that can sometimes clear problems that a "clean" doesn't fix. – Paul R Jul 24 '10 at 08:37
  • Did that too. After much head scratching, I am thinking that something is seriously wrong with my code. If I set a breakpoint early in the lifecycle of the app, I see the vars. Its only farther along that lifecycle that the vars disappear, and now I am finding that very soon thereafter the app crashes. So, What I am thinking now is that I have some major stack corruption going on, and that I need to deal with that. – Paul Jul 24 '10 at 16:42
  • @Paul: yes, that makes sense - if your stack is hosed then that may well confuse gdb. – Paul R Jul 24 '10 at 17:02
2

I just had the same problem and it turned out to be which compiler I had set in the project settings. Switched it to GCC 4.2 and they started showing up again.

Rob
  • 21
  • 1
2

In my build settings Optimization Level was set to None then also having same issue, For me it resoloved by following step:

1-) select your target near run button on xcode where you select device and simulators.

2-) then go to edit scheme of selected target.

3-) now check in run section that Build Configuration is set to Debug

4-) now check in archive section that Build Configuration is set to Release

in my case archive section was set to Debug, i changed it to release and its works.

refer screenshot: https://i.stack.imgur.com/J6nGI.png

  • Interesting. There must be a number of possible problems that cause the behavior described in the question. This particular answer fixed my problem. – jengelsma Nov 20 '17 at 20:56
1

With Xcode 7.1 appeared the same problem, while I'm not sure, if it really was the update, because I changed the Architecture also to "Universal (32/64bit)" and Valid Architectures to "x86_64 i386" in the Project->Build settings.

Anyway, I checked all advices I could find, but my settings were correct.

Changing the Product->Destination from 32 bit to 64 bit solved. I could also recreate the problem by switching from 64 bit to 32 bit.

macrene
  • 198
  • 1
  • 8
0

I upgraded from Xcode 3.2.3 to 3.2.4 and changed the SDK version to 4.1 and this problem went away. Other work arounds didn't work for me.

Rn222
  • 2,167
  • 2
  • 20
  • 36