Debugger not working

Recently I introduced a second app target to my Xcode project and split a great portion of the app into frameworks. Since then my debugger doesn't allow me to view or print the value of variables. When the app stops at a breakpoint I get the following console output:


The REPL and expressions are unavailable.
Shared Swift state for <AppName> could not be initialized.


Breakpoints work most of the time, but occasionally the entire debugger will crash, giving me this output:


Message from debugger: The LLDB RPC server has crashed. The crash log is located in ~/Library/Logs/DiagnosticReports and has a prefix 'lldb-rpc-server'. Please file a bug and attach the most recent crash log.


I also get hundreds of these warnings in my concole output, each for a different class. I'm not sure if it's related


objc[1042]: Class GAI is implemented in both /private/var/containers/Bundle/Application/9678F1A1-F2A4-424D-BCA2-DBD7B23C49FE/patientMpower.app/Frameworks/DevicePickerView.framework/DevicePickerView (0x10c42b468) and /private/var/containers/Bundle/Application/9678F1A1-F2A4-424D-BCA2-DBD7B23C49FE/patientMpower.app/Frameworks/Journal.framework/Journal (0x10c332650). One of the two will be used. Which one is undefined.

I am on OSX 10.14.3, Xcode 10.1, iOS SDK 9.0


Attempted fixes:

  • Removing all pods
  • Removing CommonCrypto as sugggested elsewhere
  • carthage update --platform-iOS --no-use-binaries
  • Restarting Xcode, the computer
  • Deleting derivedData
  • Clean and rebuild

Well, obviously the debugger shouldn't crash. 🙂


My guess is that the debugger problem is just fallout from a deeper problem:


>>I also get hundreds of these warnings in my concole output, each for a different class.


This is a problem that you can't ignore, even though it may look like only a "warning". The most likely cause is that, when you put lots of your source files in a framework, you forgot to remove them from the original app target. That means they're compiled in both places, and the large number of duplicate symbols is perhaps crashing the debugger.


You can check the target membership of individual files by selecting them, and looking at the Files Inspector over at the right. There's a set of "target membership" checkboxes there, and each files should (typically) belong to one target only.


If you need to change a lot of files, it may be quicker to go to the Build Phases:


— Click on the top (project) item in the navigator on the left.


— Click on the app target in the TARGETS list that appears just to the right of that.


— Click on the Build Phases tab at the top center of the window.


— Expand the Compile Sources build phase.


— Select and delete source files that shouldn't be in that list. Deleting them removes them from that app target (but doesn't delete the files from disk, or remove them from the framework target).


However, you may have other files (such as resources) to deal with, so you need to check everything in your redesigned project to make sure you have everything in the right target(s).

Thank you for your response, I appreciate it.


I've double checked the compile source of my main app target. There definitely aren't any source files with this target and a framework target selected. To be certain it isn't an issue with compile source I went though each of the main app's source files and removed the target of my other app and the testing target where it was selected. After doing this the debugger still crashes but I get a slightly different message:

Shared Swift state for  has developed fatal errors and is being discarded.
REPL definitions and persistent names/types will be lost.

Can't construct shared Swift state for this process after repeated attempts.
Giving up.  Fatal errors:
error: :1:9: error: cannot open file '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/shims/AssertionReporting.h': Too many open files
#import "AssertionReporting.h"
        ^

error: could not build Objective-C module 'SwiftShims'

I tried deleteing Derived Data and running `xcode-select -r` and doing a clean build but this didn't work either.

Maybe this issue is somehow caused by the sheer number of targets I have: ~250

App Targets: 2

Frameworks: 117

Tests: 127


My project is incredibly large with a lot of components that I'd like to import into some app targets but not others.


For the hundreds of warnings I get in my console output about

Class X is implemented in both Y.framework and Z.framework

each class seems to be related to a Pod I am using. My podfile is organised by target, with some targets using the same type of pod. Pods such as GoogleAnalytics are used in nearly every framework as well as the app targets. However when I tried removing pods it did not fix the debugger.

Did you get a solution for this problem ?

I'm just experiencing the same issue with the newly installed XCode 11.2.1.


Thanks

Xcode 12 , 12.1, 12.2 debugger is garbage, works randomly, hope they'll fix it soon
Debugger not working
 
 
Q