Xcode 6.4 crashes in Swift breakpoint
Asked Answered
D

3

8

In one project I'm using I can't set breakpoints in Swift code, Xcode always crashes when reaching one of them, doesn't matter if it's a "manual" or an exception breakpoint.

In other projects everything works as expected, only for one project Xcode 6.4 (6E35b) always crashes.

I tried cleaning, deleting derived data, resetting simulator, restarting Xcode/Mac - nothing helped at all.

Anyone else experiencing this problem and hopefully knows what helps?

EDIT Seems only to be the case on one machine (Xcode 6.4, 10.10.5), but not on the other (Xcode 6.4, El Capitan). But as I mentioned in the comments, reinstalling Xcode didn't help, are there some other preferences I could reset/delete?

EDIT2 Here's the Xcode crash log file: https://dl.dropboxusercontent.com/u/119600/Xcode_2015-08-12-074655_Stefans-iMac.crash

Doan answered 20/7, 2015 at 15:8 Comment(7)
I am having similar problems, is the breakpoint is in a callback function or completion block?Isoagglutination
doesn't matter at all for me. Really every breakpoint in Swift crashes; in the Objective-C part it works normally, but in Swift it crashes always and everywhere.Doan
Is this just one project or more than one? Perhaps a bug needs filling with Apple. Later I'll try downloading this version...Vitiated
it's only one project, other ones (with less Swift, don't know if that's the reason) work fine.Doan
Had this issue too. Unresolved. Seems to be happening when another thread was kicking in while the breakpoint was in the main thread. You have any threads running asynchronously? I had to use log prints. This was reproducible on every run, every time.Adriell
on one machine I have this crash always, for every breakpoint, no matter if threading or not. Have to do log prints as well...Doan
Can't debug! Every breakpoint on every brand new swift project in xcode 6.4 crashesFaker
V
2

I would try uninstalling and reinstalling Xcode to see if it helps... I've heard of successes with this technique for similar issues.

Just delete the entire Xcode.app from /Applications, and reinstall from the .dmg. If you're not certain of the binaries and have time / bandwidth, consider re-downloading the .dmg.

If that doesn't work, try the following source control tricks (substitute "your favorite revision control" for "git"):

  • Try purging all objects not in source code control
  • Another approach: Check out the app again into a fresh repository (this will get even the files that may have been committed but ignored later).
  • If not under source code control, grab a .gitignore from here and add it to git, then check out into another directory (this will leave everything but source, interface builder, project files and resources/assets behind).

I'd suggest moving the breakpoint code to another location (such as making a function call and breaking either before or inside the function). However, if all Swift code has this problem, that may not work.

Finally, after making an interim commit (to roll back to), try it in Xcode 7 beta. Bit of a hassle because you have to upgrade to Swift 2.0, but if you keep the deployment target the same no iOS target changes are needed.

If this really is a burden and/or it's a small project, you could try creating a new project and migrating the files and storyboard over, but likely this is too much effort.

Either way, since you note it's pretty much all breakpoints in Swift code, file a bug with Apple's bug reporter. They really need to hear about issues such as this, since you don't seem to be alone in having this issue.

EDIT: Where are others seeing this issue? Maybe we can see commonality -- since this is only reported in Swift projects (so far). A colleague has seen this problem with breakpoints (as well as stepping through code) in Xcode 6.4 on 10.10.4. (I've seen Xcode 6.4 crashes in the past as well).

I see OS version 10.10.5 mentioned as a target where this happens (@swalkner); is this a beta? If OS 10.10.4/5 is the only place we see this, it might be significant. If it's a project/OS interaction, it might be tricky to reproduce / fix, but I'd encourage everyone to submit detailed bug reports to Apple (maybe even link this post).

Some points to note if you're seeing this:

  • Operating System Version
  • Hardware
  • Target: Simulator vs. Hardware; iOS vs WatchKit app.
  • Target SDK version(s)
  • Swift only? Or on an Objective-C only project? Mixed?
  • Only one project, or several?
Vitiated answered 20/7, 2015 at 15:16 Comment(6)
uninstalling - only remove it from the Applications folder or something more complex? :)Doan
unfortunately it didn't help. Neither did defaults delete com.apple.dt.XcodeDoan
If you show a stack trace or other info it might help. If it's possible to share the repo (understand if it's proprietary) someone might be able to try to reproduce.Vitiated
unfortunately I can't share the repo... what stack trace do you mean? Xcode crashes at a "normal" breakpoint, not at an exception breakpoint.Doan
@Doan I'm not sure what you want for resolution of this question, as it appears (to me) to be a real bug in Xcode 6.4. I have not seen a work-around, and I've not been able to reproduce this myself. We have some data points on when this occurs, but they're very limited, due to lack of concrete input from those who have answered. A work-around would obviously be nice. Have you tried any of the revision-control-based attempts to get a truly clean copy of the code in question?Vitiated
@Doan I also noticed that someone (you probably) offered a bounty after I'd initially answered. It's actually the first time I've tried on a bountied question, so I'm not sure how it's supposed to work, since that's not what I was seeking here. The bounty, however, appears to have never been awarded and as I understand, you've already lost those points, which seems a shame. I'd like to bring more attention to this question if there is a specific result you want, since you've already "paid" for that.... I've already up-voded the question to try to get more eyes, since I find it useful.Vitiated
F
1

It's a longshot, but let me know if it's working:

uncheck the "Always show Dissasembly" check

Debug > Debug Workflow > Always Show Disassembly

In older versions of Xcode (<6.1):

Product > Debug Workflow > Show Disassembly When Debugging
Faker answered 30/8, 2015 at 7:55 Comment(0)
C
0

I've just spent the past few hours trying to solve exactly the same issue.

I thought at first, it had started due to installing Xcode 7 on the same machine as Xcode 6.4. The problem certainly coincided.

However, due to having version control, I could look and see what files had changed since opening the project with Xcode 7.

The images.xcassets file had changed. Reverting this file back has stopped Xcode from crashing each time it hit a breakpoint.

I'm not sure whether this helps at all, but definitely look at images.xcassets and if needs be, delete it, recreate it and ensure it's setup 100%. It certainly fixed my issue.

Couthie answered 18/9, 2015 at 9:5 Comment(2)
great information - do you know what exactly changed for the images.xcassets? Really weird...Doan
I believe Xcode 7 added x3 images to the file, or at least attempted to.Couthie

© 2022 - 2024 — McMap. All rights reserved.