LoginSignup
13
16

More than 5 years have passed since last update.

Xcodeが落ちるようになった時にやったこと

Posted at

環境

  • Xcode6 Beta7(以下Xcode6)とXcode5.1.1(以下Xcode5)をインストールして使用
  • プラグイン管理にalcatrazを使用
  • プラグインは10個ほど使用中

現象

プラグインでClangFormat-Xcodeを使用していて、保存時に自動フォーマットという設定で使用。
保存中にXcode6がクラッシュしたので、再起動したところ保存時に必ずクラッシュするようになった。
保存時にコード整形を行わないようにすれば落ちない。
Xcode5でも同様に落ちるようになった。

クラッシュログ(一部)

Process: Xcode [4942]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 5.1.1 (5085)
Build Info: IDEFrameworks-5085000000000000~10
Code Type: X86-64 (Native)
Parent Process: launchd [257]
Responsible: Xcode [4942]
User ID: 501

Date/Time: 2014-09-07 10:22:52.769 +0900
OS Version: Mac OS X 10.9.4 (13E28)
Report Version: 11

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
ProductBuildVersion: 5B1008
UNCAUGHT EXCEPTION (NSInvalidArgumentException): launch path not accessible
UserInfo: (null)
Hints: None
Backtrace:
0 0x00007fff865d2244 exceptionPreprocess (in CoreFoundation)
1 0x0000000104bf5b10 DVTFailureHintExceptionPreprocessor (in DVTFoundation)
2 0x00007fff8395de75 objc_exception_throw (in libobjc.A.dylib)
3 0x00007fff865d210c +NSException raise:format:
4 0x00007fff8e527517 -NSConcreteTask launchWithDictionary:
5 0x000000010e44a355 -[TRVSCodeFragment formatWithStyle:usingClangFormatAtLaunchPath:block:] at /Users/username/Library/Application Support/Alcatraz/Plug-ins/ClangFormat/ClangFormat/TRVSCodeFragment.m:43 (in ClangFormat)
6 0x000000010e44bdda __85-[TRVSFormatter fragmentsOfContinuousLineRanges:usingTextStorage:withDocument:block:]_block_invoke at /Users/username/Library/Application Support/Alcatraz/Plug-ins/ClangFormat/ClangFormat/TRVSFormatter.m:234 (in ClangFormat)
7 0x00007fff865062f9 __53-[
NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke (in CoreFoundation)
8 0x00007fff86505a9f -__NSArrayM enumerateObjectsWithOptions:usingBlock:
9 0x000000010e44bae3 -[TRVSFormatter fragmentsOfContinuousLineRanges:usingTextStorage:withDocument:block:] at /Users/username/Library/Application Support/Alcatraz/Plug-ins/ClangFormat/ClangFormat/TRVSFormatter.m:196 (in ClangFormat)
10 0x000000010e44af79 -[TRVSFormatter formatRanges:inDocument:] at /Users/username/Library/Application Support/Alcatraz/Plug-ins/ClangFormat/ClangFormat/TRVSFormatter.m:116 (in ClangFormat)
11 0x000000010e44ad15 -[TRVSFormatter formatDocument:] at /Users/username/Library/Application Support/Alcatraz/Plug-ins/ClangFormat/ClangFormat/TRVSFormatter.m:91 (in ClangFormat)
12 0x000000010e44c641 -[NSDocument(TRVSClangFormat) trvs_saveDocumentWithDelegate:didSaveSelector:contextInfo:] at /Users/username/Library/Application Support/Alcatraz/Plug-ins/ClangFormat/ClangFormat/NSDocument+TRVSClangFormat.m:18 (in ClangFormat)

試したこと

ClangFormat-Xcodeをalcatrazで再インストール

結果はやはり落ちる

プラグインをクリーンインストール

クラッシュログで/Users/username/Library/Application Support/Alcatraz/Plug-ins/ClangFormat/で落ちているようなので調べる。

Users/username/Library/Application Support/Alcatraz/ここにプロジェクトがクローン、キャッシュされて、ビルドされているようなので、/Users/username/Library/Application Support/Alcatraz/Plug-ins/ClangFormat/を削除してもう一度インストールするもやはり落ちる。

/Users/username/Library/Application Support/Alcatraz/
Timemachineから正常に動いいていた時のものをフォルダごと持ってきて置き換えるけどやはり落ちる。

解決

もしかしてと思い、一度手動でコードフォーマットを実行。
Edit=>clang format=>Format selected Text
詳しい使い方は下記
http://ainame.hateblo.jp/entry/2014/04/06/022441

その後、保存時にフォーマットををするようにしてもクラッシュしなくなった。

原因

治った経緯からすると、保存時にclang-formatがキャッシュファイルみたいなものを作ってそれを使ってフォーマットしていて、そのファイルがXcodeが落ちた時に壊れたとかではないかと思われる。
手動でフォーマットしたことによって、ファイルが一度作りなおされたため落ちなくなったという感じかなと。

13
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
16