Xcode 12.4 Instruments的Time Profiler启动即崩溃问题咨询
Xcode 12.4 Time Profiler 启动崩溃问题修复方案
问题背景
使用Xcode 12.4内置的Instruments工具时出现异常:Allocations工具可正常运行,但Time Profiler选中启动就会立即崩溃,以下排查方案均无效:
- 专门针对Instruments调试场景启动应用
- 选择附加到已启动的应用进程,而非直接通过Instruments启动应用
- 先成功启动Allocations工具,再在Instruments界面点击「+」按钮选择Time Profiler,仍触发相同崩溃
- 分别切换Debug、Release两种构建配置重试
- 清空项目构建目录后,重试上述所有操作
崩溃日志
Crashed Thread: 3 Dispatch queue: com.apple.dt.frame.activity Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Signal: Illegal instruction: 4 Termination Reason: Namespace SIGNAL, Code 0x4 Terminating Process: exc handler [13064] // ... Thread 3 Crashed:: Dispatch queue: com.apple.dt.frame.activity 0 com.apple.dt.InstrumentsAnalysisCore 0x00000001082497f3 std::__1::__hash_iterator<std::__1::__hash_node<void*, void*>*> std::__1::__hash_table<void*, std::__1::hash<void*>, std::__1::equal_to<void*>, std::__1::allocator<void*> >::find<void*>(void* const&) + 83 1 com.apple.dt.InstrumentsAnalysisCore 0x0000000108249044 XRCLIPS::_delegateCallbackRouter(environmentData*, udfContext*, udfValue*) + 628 2 com.apple.dt.InstrumentsAnalysisCore 0x00000001083018a0 EvaluateExpression + 464 3 com.apple.dt.InstrumentsAnalysisCore 0x00000001083069a8 PutProcBind + 216 4 com.apple.dt.InstrumentsAnalysisCore 0x0000000108301a89 EvaluateExpression + 953 5 com.apple.dt.InstrumentsAnalysisCore 0x00000001081e61ab PrognFunction + 75 6 com.apple.dt.InstrumentsAnalysisCore 0x00000001083018a0 EvaluateExpression + 464 7 com.apple.dt.InstrumentsAnalysisCore 0x000000010830887c EvaluateProcActions + 604 8 com.apple.dt.InstrumentsAnalysisCore 0x000000010832b357 Run + 2327 9 com.apple.dt.InstrumentsAnalysisCore 0x000000010832c312 RunCommand + 130 10 com.apple.dt.InstrumentsAnalysisCore 0x00000001083018a0 EvaluateExpression + 464 11 com.apple.dt.InstrumentsAnalysisCore 0x00000001081e61ab PrognFunction + 75 12 com.apple.dt.InstrumentsAnalysisCore 0x00000001083018a0 EvaluateExpression + 464 13 com.apple.dt.InstrumentsAnalysisCore 0x000000010830887c EvaluateProcActions + 604 14 com.apple.dt.InstrumentsAnalysisCore 0x00000001081f4cc7 CallDeffunction + 391 15 com.apple.dt.InstrumentsAnalysisCore 0x000000010831df17 EvaluateDeffunctionCall + 39 16 com.apple.dt.InstrumentsAnalysisCore 0x0000000108301a89 EvaluateExpression + 953 17 com.apple.dt.InstrumentsAnalysisCore 0x00000001082b0478 RouteCommand + 1128 18 com.apple.dt.InstrumentsAnalysisCore 0x000000010824acdc invocation function for block in XRCLIPS::executeCommand(NSString*, NSString*) + 684 19 com.apple.dt.InstrumentsAnalysisCore 0x000000010824a7c3 _runInCLocale(void () block_pointer) + 51 20 com.apple.dt.InstrumentsAnalysisCore 0x000000010824a9dc XRCLIPS::executeCommand(NSString*, NSString*) + 124 21 com.apple.dt.InstrumentsAnalysisCore 0x00000001082c369d -[XRAnalysisCoreBindingHemisphere solveBindingProblem] + 109 22 com.apple.dt.instruments.InstrumentsPlugIn 0x00000001087c6835 -[XRAnalysisCoreSetupAgent _solveBindingProblem:] + 130 23 com.apple.dt.instruments.InstrumentsPlugIn 0x00000001087c5b8c -[XRAnalysisCoreSetupAgent executeStopOnItinerary:] + 695 24 com.apple.dt.instruments.DVTInstrumentsUtilities 0x0000000107fa40e4 -[XRMobileAgent(XRMobileAgentStop) hello] + 272 25 com.apple.dt.instruments.DVTInstrumentsUtilities 0x0000000107fa041d __51-[XRFrameActivityManager _reevaluateArrivingAgent:]_block_invoke + 112 26 com.apple.dt.instruments.DVTInstrumentsUtilities 0x0000000107fa7fc3 xray::scheduler::ActivityManager::_processActivity(void*) + 115 27 libdispatch.dylib 0x00007fff67acf658 _dispatch_client_callout + 8 28 libdispatch.dylib 0x00007fff67ad4c44 _dispatch_lane_serial_drain + 597 29 libdispatch.dylib 0x00007fff67ad55d6 _dispatch_lane_invoke + 363 30 libdispatch.dylib 0x00007fff67adec09 _dispatch_workloop_worker_thread + 596 31 libsystem_pthread.dylib 0x00007fff67d2da3d _pthread_wqthread + 290 32 libsystem_pthread.dylib 0x00007fff67d2cb77 start_wqthread + 15 // ... Thread 3 crashed with X86 Thread State (64-bit): rax: 0x0000000000007fb2 rbx: 0x0000000000000004 rcx: 0x8ddf04fbc068655b rdx: 0x1124171e0a32926b rdi: 0x00007fb2984d6258 rsi: 0x00007fb29ca7f7a0 rbp: 0x00007000011afe70 rsp: 0x00007000011afe70 r8: 0x9ddfea08eb382d69 r9: 0x0000000000000002 r10: 0x00007fff85335500 r11: 0x00007fff2d9e6128 r12: 0x00007fb299af8460 r13: 0x00007000011aff30 r14: 0x0000000000000004 r15: 0x00007fff6697dca0 rip: 0x00000001082497f3 rfl: 0x0000000000010a03 cr2: 0x00000001081f1a10 Logical CPU: 1 Error Code: 0x00000000 Trap Number: 6 // ... VM Region Summary: ReadOnly portion of Libraries: Total=828.9M resident=0K(0%) swapped_out_or_unallocated=828.9M(100%) Writable regions: Total=100.2M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=100.2M(100%) VIRTUAL REGION REGION TYPE SIZE COUNT (non-coalesced) =========== ======= ======= Accelerate framework 384K 3 Activity Tracing 256K 1 CG backing stores 224K 2 CG image 116K 18 CG raster data 216K 11 CoreAnimation 7068K 56 CoreGraphics 8K 1 CoreImage 20K 5 CoreUI image data 1296K 18 Dispatch continuations 4096K 1 Foundation 4K 1 IOKit 7940K 1 Kernel Alloc Once 8K 1 MALLOC 70.3M 113 MALLOC guard page 32K 8 OpenGL GLSL 256K 3 STACK GUARD 56.1M 14 Stack 14.6M 14 VM_ALLOCATE 368K 21 VM_ALLOCATE (reserved) 2048K 2 reserved VM address space (unallocated) __DATA 77.0M 576 __DATA_CONST 1957K 73 __FONT_DATA 4K 1 __GLSLBUILTINS 5176K 1 __LINKEDIT 409.5M 118 __OBJC_RO 32.3M 1 __OBJC_RW 1908K 2 __TEXT 419.8M 548 __UNICODE 564K 1 mapped file 132.1M 42 shared memory 632K 14 =========== ======= ======= TOTAL 1.2G 1671 TOTAL, minus reserved VM space 1.2G 1671
环境与设备信息
Process: Instruments [13064] Path: /Applications/Xcode_12.4.app/Contents/Applications/Instruments.app/Contents/MacOS/Instruments Identifier: com.apple.dt.Instruments Instruments Version: 12.4 (64543.2) Build Info: Instruments-64543002000000000~11 (12D4e) Code Type: X86-64 (Native) Parent Process: ??? [1] Responsible: Instruments [13064] User ID: 502 Date/Time: 2021-10-03 16:02:23.335 +0430 OS Version: Mac OS X 10.15.7 (19H2) Report Version: 12 Anonymous UUID: 3AB66FC9-BBB6-ACB0-2877-9239C69E7BC1 Sleep/Wake UUID: D2B09D01-75C0-4596-810A-69604C2B70E3 Time Awake Since Boot: 19000 seconds Time Since Wake: 19000 seconds System Integrity Protection: disabled // ... Model: MacBookPro7,1, BootROM 68.0.0.0.0, 2 processors, Intel Core 2 Duo, 2.4 GHz, 4 GB, SMC 1.62f7 Graphics: kHW_NVidiaGeForce320MItem, NVIDIA GeForce 320M, 256 MB Memory Module: BANK 0/DIMM0, 2 GB, DDR3, 1067 MHz, 0x80AD, 0x484D54313235533654465238432D47372020 Memory Module: BANK 1/DIMM0, 2 GB, DDR3, 1067 MHz, 0x80AD, 0x484D54313235533654465238432D47372020 AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x8D), Broadcom BCM43xx 1.0 (5.106.98.102.31) Bluetooth: Version 7.0.6f7, 3 services, 25 devices, 1 incoming serial ports Network Service: Wi-Fi, AirPort, en1 Network Service: iPhone, Ethernet, en3 Serial ATA Device: TOSHIBA MK2555GSXF, 250.06 GB Serial ATA Device: MATSHITADVD-R UJ-898 USB Device: USB Bus USB Device: USB Bus USB Device: BRCM2046 Hub USB Device: Bluetooth USB Host Controller USB Device: IR Receiver USB Device: Apple Internal Keyboard / Trackpad USB Device: USB 2.0 Bus USB Device: Built-in iSight USB Device: SAMSUNG_Android USB Device: USB 2.0 Bus USB Device: iPhone USB Device: Internal Memory Card Reader Thunderbolt Bus:
修复方案
从崩溃栈可判定故障出在Instruments核心分析组件的内部逻辑错误,结合运行环境,可按以下顺序尝试修复:
- 重置Instruments偏好设置:完全关闭Instruments后,在终端执行
defaults delete com.apple.dt.Instruments清除所有自定义配置,重启Instruments后重试 - 深度清理Xcode缓存:删除
~/Library/Developer/Xcode/DerivedData下的全部内容,同时删除~/Library/Caches/com.apple.dt.Instruments目录,再重启设备重试 - 调整启动路径:不通过Xcode入口打开Instruments,直接从启动台独立启动Instruments,手动选择Time Profiler模板后再关联目标应用进程
- 改用命令行采集:如果图形界面仍崩溃,可使用
xctrace命令行工具完成性能采集,示例命令:xctrace record --template 'Time Profiler' --launch <你的应用本地路径> - 兼容适配调整:当前设备SIP处于关闭状态,老版本Xcode的Instruments在SIP关闭的Catalina系统上存在已知兼容问题,可临时开启SIP后重试,或升级至Xcode 12.5及以上版本。
内容的提问来源于stack exchange,提问作者Top-Master
相关产品推荐
相关产品推荐

