Xcode 10.2 Lldb RPC server has crashed [duplicate] - crash

I am getting a message in my 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.

In my case the LLDB RPC server consistently crashed every time I ran my app, even after cleaning the build folder and removing and reinstalling Xcode (Version 8.3.3 (8E3004b)) completely.
It turned out that apparently LLDB took objection to a breakpoint I had set, just moving this breakpoint by a line resolved the issue.

Make sure you are not running the app in release mode, if it is in release mode then change it to debug.

In my case: I update to Xcode Version 9.3 (9E145) recently and Xcode execute to the line with breakpoint then I type "po XXX" commend it will show the same message.
I try to delete following files
~/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/Caches/com.apple.dt.Xcode
and it solved.
not knowing exactly why but worth to try.
remember to backup those files in order to recovered in case any unexpected situation occur.

I had the same problem and fixed it after I deleted some of the breakpoints. Not sure why this happen at all, but at least you can remove breakpoints and use some NSLog() or print() if you are in Swift and debug with the help of those. Good luck!

Clearly a lot of different causes for this, but for me I was using a DispatchGroup to keep track of multiple async tasks.
I had forgotten to call dispatchGroup.enter() before one of the async tasks (but still calling dispatchGroup.leave() when it finished).
Adding this in fixed the crash for me.

If workspace has lots of breakpoint then it will happen, So try to remove all the break point and see the magic.

For me just restarting the simulator worked.

I found the solution to this issue. I don't know is this correct or not, but this solution is work for me. what I did is Actually I connected two devices to my mac mini, in one device I run the app and get the above error in my console. Then I removed one device and tried, this time I didn't get any error in my console its worked fine. I think you guys won't believe this, I tried Almost 3 time with two devices and one device its only work for one device

This error occurs for different reasons and the main one is when you add a watch app later to your project where Xcode adds an extra build target to scheme. click on scheme section in right side of "run/stop buttons" then hit on edit scheme, hit on Build section which is the first one, There you see 2 targets one has 2 sub targets which includes watch app and watch extension in it and the other one has no sub targets and it is a watch app target.
Solution is simple delete the watch app target which has no sub targets and run the app again.

For me, I had an expression in my watch list that it was barfing on. When looking at the crash logs in Console, there was something like this on the reported crashed thread which gave it away:
lldb_private::EvaluateExpressionOptions const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, lldb_private::ValueObject*) + 619
17 com.apple.LLDB.framework 0x0000000102855f18 lldb::SBFrame::**EvaluateExpression**(char const*, lldb::SBExpressionOptions const&) + 696
18 lldb-rpc-server 0x00000001025e72e9 rpc_server::_ZN4lldb7SBFrame18EvaluateExpressionEPKcRKNS_19SBExpressionOptionsE::HandleRPCCall(rpc_common::Connection&, rpc_common::RPCStream&, rpc_common::RPCStream&) + 169
19 lldb-rpc-server 0x00000001025f8ce1 rpc_common::Connection::PrivateHandleRPCPacket(rpc_common::RPCPacket&, rpc_common::RPCPacket&, bool&) + 1553
20 lldb-rpc-server 0x00000001025fc36d Packets::ProcessPackets() + 1005
21 lldb-rpc-server 0x00000001025fbe96 Packets::ReadThread() + 214
22 lldb-rpc-server 0x00000001025fbdb9 Packets::RunReadThread(void*) + 9
23 libsystem_pthread.dylib 0x00007fff6a586109 _pthread_start + 148
24 libsystem_pthread.dylib 0x00007fff6a581b8b thread_start + 15

I ran across this same error with zero idea of what to do next. I tried the accepted answer and my project didn't have any breakpoints at all.
Turns out I had an observer that I didn't remove and every few times I would push off/on the vc that contained it it would eventually crash with the op's error. I had to enable zombies to figure out which vc was causing the error. I had to manually go through the code line by line to realize I didn't remove the observer. Once I removed it everything worked fine.
// not removing this caused the error
playerItem?.addObserver(self, forKeyPath: #keyPath(AVPlayerItem.status),
options: [.old, .new],
context: &playerItemContext)

I have found a solution for this, this may not be the perfect but kind a fix my problem.
Go to target Build Settings -> Other Swift Flags -> check Debug Values added
Remove everything except $(inherited) and -DDEBUG
Remove Derived Data
Clean and Run

I am having this issue in Xcode 12.1.1 (12A7605b) in January 2021 on macOS Catalina with a Swift project.
I tried Clean, delete Derived data, restarting mac, running on different simulators and real devices - no luck.
Others suggest removing the breakpoint, but for me this breakpoint is needed for debugging (I guess I can figure out how to debug in a different way, with a differently placed breakpoint or with print statements, but that's frustrating).
I filed a bug report with Apple as the error message suggest - I urge others to do the same to increase the chance of a fix by Apple.
In the meanwhile I use this workaround - wrap the code where you want the breakpoint in a DispatchQueue.main.async:
DispatchQueue.main.async { [self] in
print("Put the breakpoint on this line")
}
(Note we use [self] here because it's just debug code, but in most cases these async calls need [weak self] to avoid retain cycles and memory leaks)

The problem I encountered was that the main project was objC, the Swift library introduced by Cococapods, and then crashed during breakpoint debugging of the Swift library
The solution
Add a swift class to the main project, name it at will, and do not need to add the bridge header file
Switch to project Settings, not Target Settings, and find build_setting
SWIFT_ACTIVE_COMPILATION_CONDITIONS adds a DEBUG as follows:
SWIFT_ACTIVE_COMPILATION_CONDITIONS
Debug Debug
Release

In my case. I'm also using SQLite.swift to create database. The crashing happened when I tried to change a column data type of an existing table in code(which was not in the right way to do it), then inserted a tuple with new data type, then tried to print all the tuple out.
Solution: Delete the .sqlite3 database file you have or delete the table with conflict data type and recreate them all.

Related

Mysterious errors after updating to Xcode 6

I am getting mysterious console errors when building my application since I updated Xcode to 6.1 from 5. The application works fine, but I'd like to find out what is causing these errors and get rid of them.
Errors are as follows. An exception breakpoint just halts in main, so no real clues there.
2014-11-08 09:30:28.800 Finances[5848:1545133] Failed to connect
(accountSupplementaryDataValue) outlet from (FINAccountEditorWindowController) to
(NSWindow): missing setter or instance variable
2014-11-08 09:30:28.800 Finances[5848:1545133] Failed to connect (delegate) outlet
from (FINAccountEditorWindowController) to (FINAppDelegate): missing setter
or instance variable
objc[5848]: Class _NSZombie_OS_dispatch_queue_runloop is implemented in
both ?? and ??. One of the two will be used. Which one is undefined.
Any ideas?
Apparently you can ignore it? From Greg Parker’s Twitter feed: “Race in the zombie implementation, maybe? You can ignore it.”
For me when I had those problems I carefully went through them and googled them bit by bit to solve them. Though for some what I did was put the file on a flash drive and delete the file from my computer and then reboot the Xcode and with some the computer too and put the projects back on from the flash drive. If that don't work then maybe try loading them on to a computer with Xcode 5 and seeing if the errors are still there?

build failed with: ld: duplicate symbol _OBJC_CLASS_$_Algebra5FirstViewController

I am getting this error suddenly when running my app via iPhone simulator:
clang: error: linker command failed with exit code 1 (use -v to see
invocation):
ld: duplicate symbol _OBJC_CLASS_$_Algebra5FirstViewController in
.../Algebra5-anwcuftojtxtgkfootneeeqhwztj/Build/Intermediates/Algebra5.build/Debug-iphonesimulator/Algebra5.build/Objects-normal/i386/ExercisesViewController.o
and
.../Algebra5-anwcuftojtxtgkfootneeeqhwztj/Build/Intermediates/Algebra5.build/Debug-iphonesimulator/PSLE
Algebra5.build/Objects-normal/i386/PSLE_Algebra5FirstViewController.o
for architecture i386
What is it all about?
It look like the class Algebra5FirstViewController is compile multiple time.
Can you make sure that the .m and .mm is only included once in your project sources in Xcode? You can also confirm this by checking in the compile log (last icon at the right, next to the breakpoints icon) and see that confirm that it is only compiled once.
Also, if this class is part of a library that you link against and you have a class with the same name, you could have the same error.
Finally, you can try a clean and rebuild, just in case the old object files are still present and there is some junk in the compiled files. Just in case...
EDIT
I also note that the second reference is made in the file for ExercisesViewController. Maybe there is something in this file. Either you #imported the Algebra5FirstViewController file instead of the .h, or the ExercisesViewController has #implementation (Algebra5FirstViewController) instead of #implementation (ExercisesViewController), or there was some junk with this file that will cleaned with a Clean an Rebuild.
That can happen if the same .m file is referenced multiple times in your target's "Compile Sources" section in "Build Phases". Remove duplicate entries and you should be fine.
also had this problem by declaring a const * NSString in the header file (incorrectly) instead of the implementation file (correctly)
I got this issue because I accidentally imported the .m instead of the .h. Hope reading this saves someone with same problem some time.
I had same problem. Got it solved!
If you have imported any files into project then check .m (main) file for same does exists in Targets (Project Name) -> Build Phases -> Compile Sources.
If file does not exists then include it using (+) Add button shown.
Also, if duplicate files exists (if any) then delete it.
Now press cmd+shift+k to clean the project. New Build should not display this error.
I got a similar error when adding files from another project, like #paiego explained. My error was that I didn't check "Add to targets". As explained above, I deleted the references and added the files again but this time checking "Add to targets".
I was getting similar error and I got it resolved this way.
Try to set Build Active Architecture Only to NO for 'Pods' project and
your app's target
In one case, I saw this error when dragging a new class' .h and .m into the project. The only solution I found was to remove the references to these files and then add them back via the project menu.
I met it when import a ViewController.m in TableViewController. Try to delete '#import "ViewController.m"' if it exited. Hope this help!
'linker command failed with exit code 1 (use -v to see invocation)'- I got this error when running a phonegap application on iPhone. I changed Build Active Architecture Only to Yes and it worked fine.
It seems that for m, I dragged the files into the project and after that didn't work, clicked file "add files to project". Both were the incorrect approach. just drag it into the projects folder (in finder) that houses the other .h and .m files.
once i got
18 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1
For me this was due to that i have used "const NSInteger" in my switch case.
What i did is change the const NSInteger to enum, and replace the reference with enum values.
This fixed the error for me.
This happens either, some files are missing in the "Compile Sources" section, or duplicate entries are found for some file(s). In my case, I had duplicate entries for two files, I deleted one entry for each of the files, that solved my problem. Hope this helps.
I found this article that provided a solution for me. It pertains to Xcode 7 where the default for No Common Blocks is Yes rather than No in previous versions.
This is a quote from the article:
The problem seems to be that the "No common blocks" in the "Apple LLVM
6.1 - Code Generation" section in the Build settings pane is set to Yes, in the latest version of Xcode.
This caused what I will describe as circular references where a class that was included in my Compile Sources was referenced via a #import in another source file (appDelegate.m). This caused duplicate blocks for variables that were declared in the original base class.
Changing the value to No immediately enabled my app to compile and resolved my problem.
I'm posting a new answer to this because I ran into this error and had to use a different solution that I think is specific to iOS 9.
I had to explicitly disable the Enable Bitcode in Build Settings, which is automatically turned on in the update.
Referenced answer: New warnings in iOS 9
[XCODE 7.1 UPDATE]
First Option That Worked:
I changed the Deployment Target from 7.1 to 8.1 and the error went away.
Hope that helps someone.
UPDATE (day 2): Second time I'm back here in 2 days.
On day 2 I started to get more errors in addition to this annoying error. The problem was a conflicting file that Xcode didn't recognize. I used the links below as help:
"_OBJC_CLASS_$_viewsampleViewController", referenced from:
‘ld: warning: directory not found for option’
And ultimately:
"_OBJC_CLASS_$_viewsampleViewController", referenced from:
I was deleting everything from the FrameWork Search Paths + Compile Resources + Run Script Phases + the pods and then re-installing them again to ultimately find success.
The issue on my size (on day 2) was more of a problem with conflicting files or files that Xcode didn't recognize.
But ultimately, removing everything (mentioned above and in the links), cleaning a lot of times and reinstalling the pods/frameworks/run script phases helped.
Really hope this helps someone.
Running Xcode 4.6.3 on OSX 10.7.5 was able to fix this error by changing Architectures to Native Architecture of Build Machine from $(NATIVE_ARCH_ACTUAL).
I received this once by (accidentally) importing both the .h and .m files into the same class.
I got this error while implementing a subclass without the necessary framework added (MPMoviePlayerController without the MediaPlayer framework, in this example)
I got this same issue when working with Bolts.framework. It turns out that when Bolts gets corrupted, no amount of re-importing will fix the issue. I had to go back to the original download file and reimport it completely from scratch. This fixed it right away. It was such a weird issue that it took me forever to figure it out... hopefully this tip will spare some of you from the same frustrations :)
This occurred for me when I named a UILabel reference and an int the same thing, I didn't get an error when I typed it only when I tried to run it so I didn't realize that that was the problem, but if you have something like a label which is the "score" and you call it score, and name an int which is the score also score then this problem occurs.
Variations on this issue can occur if you have a missing library or file. Check there aren't any missing files in your Project Explorer: they'll be written in red if Xcode can't find them.
"Link Binary With Libraries" had old project name pod library. Fixed after removal.
List item
Project
Build Phases
Link Binary With Libraries
Remove deprecated library.
I had this same issue with a library, and I tried all of the answers listed here and nothing helped.
I ended up simply removing the library from Link Binary With Libraries and then re-adding it and it worked fine.
The only (and unfailing) way to resolve this issue is building test from command line:
xcodebuild -workspace MyProject.xcworkspace/ -scheme MyScheme -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.3.1' test
So, at this point, your compilation will surely fail but you'll see all linking problem. In my case, I had several problem such as:
ld: framework 'Foo' not found
To resolve this, you need to on your target, BuildSettings->Linking->OtherLinkerFlags and remove 'Foo' framework .
Use of unresolved identifier 'ClassName' .
To resolve this, I need to add/check file's target membership to UITest target too.
Other possible problems will be raised by xcodebuild and you can easily fix it.
Simply cleaning CMD + SHIFT + K, then building CMD + B worked for me.
In my case I had a reference to a library in Other Linker Flags. Removing it got rid of the error.
I had the same error.
I had imported a audio frame work that i was no longer using. I removed it (DO NOT DELETE IT!) and it built successfully.

iOS 5 TableView crashes

Something got changed at the new SDK and my code suddenly isn't working.
I created a new empty project and created only a UITableView in it.
I used the same code as i've been used to, except the compiler said that i do not need to use autorelease anymore, so i removed it.
Oh, and I replaced retain with strong as i was recommended.
When I run the app it shows the TableView like it should look, but the minute i touch anywhere on screen, like scrolling for example, it crashes with EXC_BAD_ACCESS error.
What do I miss??
You should post some more informations on where your program crashed! But I don't think the mentioned compiler warnings are the reason. You should have tried to run your project with the compiler by turning of ARC (automatic reference count) and see what happens. If you can go back, do that first.
Also maybe there went something wrong with the changes you made because of ARC . If you have not done the changes with the Xcode refactoring tool I recommend you doing so.
Therefor select in the Xcode Menu:
Edit > Refactor > Convert to Objectiv-C ARC...
It will go through your code and apply the changes. Apple recommends though that your project should work without crashes and warnings before using it.

iOS App crashing before entering main() with Xcode 4.2 & iOS 5

Background
After upgrading xcode4.1/ios4 to xcode4.2/ios5 I am experiencing crashes while the App is loading and before it even enters main().
I have set a break point in main() but it is never reached.
Compiling the project in Xcode 4.1 with a Base SDK of 4.3 works fine on iOS 4.x and iOS 5.
Compiling the same project in Xcode 4.2 with a Base SDK of 5.0 works fine on 4.x but crashes in iOS 5, both on the simulator and on a device.
Simulator Crash
Crashes with EXC_BAD_ACCESS
List of calls, all system calls, not even the main() has not been called yet.
My best guess is a problem loading a library, but have know idea how to track it down!
Attempts at a resolution
Turned on Zombies
Turned on all logging
Added different versions of system libraries (libz.1.2.5.dylib and libz.dylib)
Cleaned the project
Deleted the App form the simulator
Delete the Derived Data folder
What is your deployment target?
My deployment target was iOS4.0. I changed it to iOS4.3 and the issue is resolved! (Building against iOS5 GM SDK, of course.) My app now runs in the iOS5 simulator.
I got this idea from an answer in another SO thread that said ARC is supported in iOS4.3 and above. My app doesn't use ARC, nor do any of it's dependent libraries, as far as I can tell. The answer also said something about weak reference zeroing, which seemed... perhaps relevent since a lot of people have had success in removing specific linker directives concerning weak references to libSystem.B.dylib.
It bothers me a little that I have to move up my base deployment target beyond 4.0 because that feels like I am cutting out a lot of potential users. Despite Apple's hope that everyone will always upgrade their devices, many people do not. Oh well.
EDIT
It's worth mentioning that this project was originally done under Xcode3, so there is likely just some bizarre cruft in the project itself that is both unneeded and causing this problem. But I'll be damned if I can find it!
EDIT 2
Well, well, well... upon further inspection... I found 2 errant references to libSystem.B.dylib in my project.pbxproj file that were not visible through Xcode's build settings, but that I had to remove by hand with a text editor!
Once doing this, I reset the base deployment version to 4.0, built for the iOS5 simulator, and the app ran without issue.
Amazing.
The lesson: Never underestimate the chances for there to be garbage in your project file.
EDIT 3
Removing the 3 occurrences of these lines in the project.pbxprojfile inside the Xcode project package (right click and show package contents).
Check your linker flags. Some libraries you might have been using required a flag like this:
-weak_library /usr/lib/libSystem.B.dylib
The weak linking allowed building against iOS 4.x with a 3.x deployment target. For whatever reason, it's completely broken in the simulator now.
I was playing around with the scheme diagnostics, and got this exact same behavior by accidentally setting "Enable Guard Malloc" on. I had targeteted 4.3 and was running under ARC on the 5.0 Simulator. The app would run fine when launched from the simulator, just not from XCode. Go to Product->Edit Scheme..., select the "Run" item in the table to the left, and then the "Diagnostics" tab to the right. Uncheck "Enable Guard Malloc".
I tried everything in rjstelling and MarkGranoff's posts to no avail. I can now reproducibly cause it to not happen by turning off Guard Malloc on my debug scheme. Guard Malloc on--crash, off--no crash. I never had the problem on the device only the simulator. I applied the fixes in the post above first so I don't know if this would have fixed the problem without those changes or not. Hope this helps someone else.
I had the exact same diagnostic, but the solution was entirely different.
However, the solution described in the answers here didn't work for me, because I found no "weak"-related issues in my project.pbxproj
However, I found that the cause of my problem was a deadlock in an +(void)initialize method called from the main thread. In this method, I was calling dispatch_sync(dispatch_get_main_queue(), ^{[some block code]}). Changing this to a dispatch_async (note the "a") solved my problem.
The way I discovered the issue was accidental. While nothing seemed to happen, the "thread" navigator of Xcode was telling me that the app itself wasn't crashed. And I accidentaly clicked on "pause" in the debugger. And suddenly it stopped exactly where the deadlock was. Which after some thoughts is just logically obvious.
I had similar problem with logic unit testing (running separate target without dependency on the main app in the iOS simulator), in my situation problem was in lldb, here is more details:
Logic unit tests crash
An app crashing before entering main.m can happen when a linked framework doesn't get copied, for example because the project uses Carthage and the Run Script build phase /usr/local/bin/carthage copy-frameworks is missing.
Xcode 4.2 still has some rough edges from my usage. A complete removal and re-install fixed an issue I had (it was stuck on "Attaching" and none of the solutions on the "official" SO thread helped). Might be a bit extreme though.
Select the top-level project in the File Navigator and go to the Build Phases tab. Expand "Link Binary with Frameworks" section—are there any frameworks that aren't Apple-provided? Are they Optional or Required? And does any of your code required any additional frameworks?
To help more could you post all the log messages that are currently being obscured by the call stack popup?
You can apply the linker flag conditionally to iOS SDKs but not the iPhone Simulator in XCode 4.
Select Other Linker Flags, click Add Build Setting, choose Add Conditional Setting, and apply -weak_library /usr/lib/libSystem.B.dylib just for iOS SDK.
This lets simulator builds still work.
Guard malloc was the problem for me too. Probably because I'm using libxml2.2.7.3.dylib.
This question describes the same crash, but he was lucky enough to be turning guard malloc on, so it was obvious what caused the crash. I just got the crash after upgrading Xcode to 4.2.
I'd like to include the stack trace so that it is Googleable. I had trouble finding this page.
#0 0x00000000 in <????> ()
#1 0x99924ef3 in mig_get_reply_port ()
#2 0x9991e70c in mach_ports_lookup ()
#3 0x0141c124 in _xpc_domain_init_local ()
#4 0x01419eb1 in _libxpc_initializer ()
#5 0x8fe2a15b in __dyld__ZN16ImageLoaderMachO18doModInitFunctionsERKN11ImageLoader11LinkContextE ()
#6 0x8fe29cc0 in __dyld__ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE ()
#7 0x8fe27220 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
#8 0x8fe271b6 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
#9 0x8fe271b6 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
#10 0x8fe271b6 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
#11 0x8fe271b6 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
#12 0x8fe281c0 in __dyld__ZN11ImageLoader15runInitializersERKNS_11LinkContextERNS_21InitializerTimingListE ()
#13 0x8fe1c626 in __dyld__ZN4dyld24initializeMainExecutableEv ()
#14 0x8fe20ef2 in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_ ()
#15 0x8fe1a2ef in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKclS2_ ()
#16 0x8fe1a063 in __dyld__dyld_start ()
In my case it was the -objc flag in Other Linker Flags. I had to remove that and it worked like a charm.
I seem to remember having had a similar crashing bug prior to main() being called and I tracked it to a mismatch between IBOutlets declared in app delegate vs in my nibs. Go through and check your outlets to see if any are somehow misconfigured.
-mz

Xcode + Time Machine (or Finder copy) = NSInternalInconsistencyException

After using Finder to make a copy of my project, the iPhone Simulator crashes giving me an NSInternalInconsistencyException error. I subsequently used Time Machine to restore the project before I made the copy, but am still getting the NSInternalInconsistencyException error.
This is a small homework assignment and re-creating it wouldn't be the end of the world. My big concern is that I don't understand something fundamental about how Xcode is working. Any illumination would be greatly appreciated.
Update
Apple identified the bug. The iPhone Simulator keeps the last-run version of the app onboard, and doesn't replace it with the copied/Time-Machine-Restored version that is in Run-and-Build. Deleting the app from the iPhone Simulator and performing a new Run-and-Build resolves the issue.
Sounds like a bug. Your source code files should be fine, so hopefully it's not a big deal to just create a new project and add those files so that you can get back to work. You might also want to report the issue to Apple, especially if you can make it happen again.