XCode 4.5 Keeps using old code, despite updates - macos

I have a several years old Mac project that I'm now doing maintenance using Xcode 4.5. I made some changes to the code and was testing the changes using the debugger. Every change I make is compiled as I see the relevant warnings and have had to fix errors along the way. But when it actually runs, although it shows the code up to date, the debugger is behaving as though the prior version of code is still there. It will line up with commented out code and execute that code as I step through. Changes I have made are completely ignored, and it seems like the compiled code being debugged is the old code and not the new code that I am working with.
BUT, when I run the actual build file from my build subfolder, it does indeed have the changes in it. Just can't debug it and need to in order to find an issue!
I am guessing that the derived data folder or the files that are used by the debugger are somehow out of sync or pointing to the wrong location. I tried deleting everything there and of course have run multiple Clean's on the code, to no avail. I've also tried switching between LLVM and GCC, and also the two debugger options in the edit scheme section.
Any ideas?

Related

Visual Studio: No symbols have been loaded for this project

Yes, I've seen this previous question here and none of the solutions have worked.
On Visual Studio Community 2019 I was debugging a project that I've been working on for years. I have a common library project, that I've built, that I use on multiple solutions - one web, one exe.
In working on the EXE solution, which is one windows app project + about half a dozen other custom libraries, I was debugging along without issue. Changed a bit of code and then started another debugging cycle and suddenly symbols couldn't be loaded for one of the libraries.
If I look in the output folder, the PDB file for the library IS there. If I look in the Debugging Windows... Modules, the library does NOT show up.
If I load up the web project which also uses this library, it debugs fine and the module shows up in the modules window.
I've tried everything in the thread I've referenced above. I've also tried:
Build, Clean, rebuild, in all sorts of different orders - the PDB is ALWAYS there.
Removing and readding references to the project from the EXE
Creating a whole new solution
Going to a different PC entirely - one that I knew was working yesterday - grabbing my latest code, and still the same problem.
Reverting back to several different old branches of code, on BOTH the new machine and the old machine, same issue.
Installing VS updates
Repairing VS
Checking my GAC to make sure there was nothing for these libraries in there
Played with every project setting I could find
Cursing and praying to the programming Gods
I have no clue what to do next. Obviously this one specific project is not loading the DLL, but I can't figure out any possible reason why. The only thing that changed between a successful debug and the missing symbols error was me changing a few lines of code and clicking Run again. (And I even removed the code changes and it still failed.)
I just don't understand what could have caused this, for this singular library, on this single solution.
To anyone who finds this later, I've solved the problem and my code is debugging fine again.
And I have zero clue about what changed, why it started working, or if I even did anything at all. I came back to it the next day, systematically started working through various tests, and suddenly everything was fine - though I didn't do anything differently than the day before.
These are the times that try men's souls.

Need to always reload project in Xcode for it to function

I've built a couple dozen projects in Xcode and only one of them experiences this strange issue.
Every time I load Xcode to resume work on the project, Xcode auto-loads the project (good) but in an unusable state (bad). It appears this way:
The project name is grayed out, with no disclosure triangle. I cannot access any of its contents, and trying to build it fails immediately with no error message other than "Build Word Practice: Failed" as you see in the screenshot.
But if I close the project and reload it, it functions fine. The only oddity about when it loads this way is that it appears with all its disclosure triangles closed, and I have to manually "disclose" the contents of all the folders in the list each time:
I have had this issue with all recent versions of Xcode, up to and including the current version, 11.5.
The project does not use any features that are not present in other similar projects I've written that behave fine. So it would seem to be a matter of corruption… but besides deleting derived data and doing a clean build (which I've done), I can't think of any other steps to take.
I would include code here, but short of including the whole project (and I doubt that would help), I wouldn't know what to include.
Any ideas?

Xcode4 breakpoints adapt to code changes?

I have a series of logging breakpoints in Xcode4 that I'm using to selectively log things as I need them. However, whenever I make changes to the code involving adding or deleting lines, these breakpoints get out of sync with where they are supposed to be, sometimes even going to a completely different function.
Is there a way to keep the breakpoint in sync with the code, rather than just rely on the line number?
I believe it should, at least it's the IDE's usual behaviour.
Just a thought. Have you tried to reinstall XCode? I have experienced all sorts of weird bugs since the upgrade to XCode 4. For example, being unable to select a XIB file for a popup window in a project---and when creating a project from scratch, I was able to select that XIB and create the popup. At the time I posted a question on StackOverflow about this and it is still unanswered ever since.
Since that time, the project was overhauled and now I build my interfaces from scratch using full Obj-C code, dumping the interface builder 99% of the time...

Certain functions/methods not changing when built in Xcode

I am currently working on a project which runs just fine in both the simulator and on device except for one particular method which does not update on the device or in the simulator. It seams that I can put whatever I like in it and it just runs an old version. If I change other methods in the same file they build and run with the changes. Any ideas why this is happening or what I could do to solve it?
One suggestion I heard was to start a new project and copy my code in. I would like to avoid that if possible but it looks like I might have to.
Sometimes you need to do a clean build because Xcode does not always notice dependency changes (e.g. changes to source files).
Some people do not configure their dependencies (e.g. static/dynamic libraries) correctly. If you are using the auto-detect-dependency feature, it still has some bugs, so you may need to configure this explicitly.
FWIW, starting a new project has never been necessary for me...

Deleting Derived Data from Xcode 4.2 project doesn't re-index project

Indexing, code completion, & coloring disappear from my projects on a fairly regular basis, usually right after I add a file. And then it returns hours or days later, usually for unknown reasons (I've tried keeping a record but it's pretty random). CMD-clicking on even known terms (like viewDidLoad: or NSLocalizedString) result in a "Symbol Not Found" error.
It happens with Xcode 4.2 (I believe it happened in Xcode 4.0.2, but not as frequent).
I have no build errors, warnings, or static analysis messages.
I've restarted Xcode.
I've tried turning precompile off.
I don't have a case where I've got a circular header file include/import.
It happens if I use gcc, LLVM, CLang (in whatever combo).
It happens if I use iOS 4.3 or 5.0.
I've tried deleting the "derived data.", and even only the Index/ path.
After deletion & re-build I see the .hmap file & .xcindex folder (filled with db.xcodeindexdb* files).
...but I can't get code-completion, symbol detection, or coloring back.
What else can I do? I sincerely appreciate the help.
Have you tried a clean install (sudo /Developer/Library/uninstall-devtools)?
I have exactly the same problem for one particular project. Following workaround works for me: apart from deleting Derived Data , I make an SVN update or revert any file of the project. If the project file itself is changed my Xcode displays wrong target ,so I close the project and re-open it and then indexing starts properly.
The most reliable way I've found to force re-indexing of the project is to change the build settings, specifically 'Run Static Analyzer' - I wish I had a real answer though.
This might seem like a silly response, but have you tried to repair file permissions under disk maintenance?
Your thread is old, but anyway...
Deleting the derived data folder helps me everytime. I have to do it quite regularly, which is very annoying. Your find the path in the xCode-Settings(cmd+,) in the locations-tab.
I just had this issue. What worked for me is clearing the derived data, then closing the project and re-opening it. It didn't reindex until I closed and re-opened the project. The project never compiled fully, so it didn't even have to finish building to work.

Resources