Xcode debugging red arrow not working properly

Discussion in 'Mac Programming' started by stephan.works, Nov 10, 2009.

  1. macrumors member

    Joined:
    Apr 29, 2008
    #1
    Hi guys!

    I'm debugging a C++ program with Xcode but unfortunately I have to manually follow the flow of the program since Xcode doesn't automatically display the line of code which is currently executing (the one with the red arrow).

    (clicking on the stack brings to the correct line but of the wrong file!)

    Does anybody know why?
    Thanks :)
     
  2. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #2
    Was your project started from an Xcode project template?

    If so are you building and attempting to debug a debug target or a release target?
     
  3. thread starter macrumors member

    Joined:
    Apr 29, 2008
    #3
    I started from a template (command line tool, c++) and I'm trying to debug a debug target.
    Thank you.
     
  4. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #4
    OK, so, when debugging a red arrow does appear and it moves from line to line when stepping through the code but the view does not follow the arrow as it steps out of bounds.

    Is that correct?

    Does this also happen following a quit and relaunch of the Xcode project?
     
  5. thread starter macrumors member

    Joined:
    Apr 29, 2008
    #5

    Correct.
    I've tried to relaunch, reboot, update to latest version, "clean all" in the project. Unfortunately those didn't help.

    Thank you.
     
  6. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #6
    I've seen this a couple of times. Quitting Xcode and trashing the build folder would usually straighten things out.

    Sorry but I'm coming up empty.

    Does the same thing happen logged-in as a different user?

    Does the same thing happen when the project is brought up on a different machine?

    Does the same thing happen with a new project?

    Are you using unusual, non system supplied, fonts?
     
  7. thread starter macrumors member

    Joined:
    Apr 29, 2008
    #7
    I have no unusual fonts.
    I've tried to trash the build folder: nothing.
    I've tried to use an old version of the project: nothing.
    I've created a new project with just main.cpp and a couple of functions: in such project the red line works properly.

    There must be something wrong with the project... but what?
    Thank you!
     
  8. macrumors G4

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #8
    Is your Xcode up to date? The latest versions:

    2.5 for Tiger
    3.1.4 for Leopard
    3.2.1 for Snow Leopard
     
  9. thread starter macrumors member

    Joined:
    Apr 29, 2008
    #9
    Yes, I have 3.2.1 on Snow Leopard 10.6.2.
    (I had the same problem on 10.6.1).
    Thank you.
     
  10. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #10
    So, it's just this one project.

    Perhaps you've accidentally changed a debug setting in the debug targets.

    You can check this out by selecting "Edit Active Target <your project name>" from the "Project" menu.

    In the resulting "Target <your project name> Info" window select "Debug" from the "Configuration" popup menu. And "User-Defined Settings" from the "Show" popup menu. If you changed something from the default it should pop out at you.

    Another thing we could try is looking over the "project.pbxproj" file located within your ".xcodeproj" bundle package if you're willing to post it.
     
  11. thread starter macrumors member

    Joined:
    Apr 29, 2008
    #11

    Thank you for your help.
    I've checked and there are no user-defined settings.
    I've attached my my .xcodeproj file.
     

    Attached Files:

  12. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #12
    Which version of Xcode was used to "create" this project?

    Which project creation template did you select to "create" this project?
     
  13. thread starter macrumors member

    Joined:
    Apr 29, 2008
    #13

    I started from a command-line tool template.
    At the time I created the project I was using Xcode 3.0 (I think, not entirely sure though).

    Thank you!
     
  14. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #14
    I'm not seeing anything that should be a problem.

    I hadn't seen an answer to the question: Does the same thing happen when the project is brought up on a different machine?

    Either way a next possibility would be to set aside the two files "<your-login-name-here>.pbxuser" and "<your-login-name-here>.mode1v3" (rename by adding an underscore to the front) located within your ".xcodeproj" bundle package. Relaunch the problematic Xcode project an see if that takes care of it.

    These files store thing like breakpoints and personal execution setting related to console interactions so they may need to be reset-up should it otherwise start working.
     
  15. thread starter macrumors member

    Joined:
    Apr 29, 2008
    #15
    Sorry for my late reply.
    I tried to rename such files and it didn't help.
    Unfortunately I don't have another Mac on which to try (at least for this week).

    I also tried to create the project from scratch but it also doesn't work; those are the steps I've followed:
    • I've built freeglut2.4 (I need it for a project)
    • I've set the settings attached below
    • I've added the OpenGL and the freeglut frameworks
    I guess there must be something wrong with those steps.


    Thanks!
     

    Attached Files:

  16. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #16
    OK. I'll take a look at those later this evening, but first - a question. You are aware that Apple provides a version of GLUT for your use in /System/Libraries/Frameworks aren't you? Or is there something special about "freeglut2.4"?
     
  17. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #17
  18. thread starter macrumors member

    Joined:
    Apr 29, 2008
    #18
    Thank you but I can't find "freeglut" it in /System/Library/Frameworks
    I can see on "GLUT" but I need to use freeglut because that's a requirement of the project.

    I also found another Mac on which to run my project... and the red arrow works properly on it... :confused::confused::confused:

    There must be something wrong with my Mac / Xcode...
    Thanks for your help.
     
  19. thread starter macrumors member

    Joined:
    Apr 29, 2008
    #19
    I just uninstalled and reinstalled Xcode... didn't help.
    I also tried (again) to delete the preferences file... no help.
     
  20. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #20

    Repeating an unanswered question from much earlier - does the same thing happen logged-in as a different user?

    Now I'm just plain nosey! Is this project for a class of some type? If so what?
     
  21. thread starter macrumors member

    Joined:
    Apr 29, 2008
    #21

    So I tried with a test user... and it works.
    There must be something wrong with my user then...

    Removing preferences didn't help... I also tried to clean the cache...
    Not sure what else influences Xcode.


    Thanks for your help!

    PS: yes, it's for a class. The project should also run on lab machines, which are Linux boxes and have freeglut installed.
     
  22. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #22
    So "freeglut" really isn't needed for your Xcode project but will be needed in order to link under LINUX, and or, Windows. In which case the only thing that would need changing in order for you to drop "freeglut" under Mac OS X is the addition of a conditional inclusion of 'glut.h' as follows:

    #ifndef __APPLE__
    #include <gl/glut.h>
    #else
    #include <GLUT/glut.h>
    #endif

    This leaves the source compilable on all platforms that support GLUT.
     
  23. thread starter macrumors member

    Joined:
    Apr 29, 2008
    #23
    Thank you but unfortunately, as far as I know (I might be mistaken though), GLUT is slightly different from freeglut and I don't want to work on something that might not work properly on Linux.

    Moreover... the project works on the test account so... there must be something wrong with my account. But I really don't have idea of what it might be.

    Thanks for you help!
     
  24. thread starter macrumors member

    Joined:
    Apr 29, 2008
    #24
    Any other idea on how to solve this Xcode problem (which apparently is linked to my account)?

    Thanks!
     
  25. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #25
    I'd probably start by moving ALL the files in my ~/Library/Preferences folder to someplace else logging out and then back in to do testing to see if it then works. Remember to quit Xcode before performing the next round of testing.

    And sure things will feel a bit odd at first but it's only for testing purposes.

    If it works narrow it down by placing files back into the Preferences folder in small groups starting at either end of most likely, or least likely, till you hit the problematic one.
     

Share This Page