Post

Replies

Boosts

Views

Activity

How to trace an iOS app with dtrace in a simulator
Hey everybody! I need to collect all my app function calls since it starts. I'm trying to use the dtrace tool, however, the app crashes. Steps to reproduce: Configure lldb to break app execution on start: (lldb) settings set target.process.stop-on-sharedlibrary-events 1. Run the app in a simulator and wait it hits the breakpoint. Run the dtrace from a terminal: $ sudo dtrace -qn 'pid$target:::entry' -p $(pgrep -x MyApp) Detach the debugger: (lldb) process detach My app crashes instantly: Incident Identifier: 2C1D5F92-D282-4AD1-A7B2-F14FB3E1D848 CrashReporter Key: 19EF8693-57CE-CC1B-873D-AD4D9D549E6E Hardware Model: MacBookPro18,2 Process: MyApp [25120] Path: /Users/USER/Library/Developer/CoreSimulator/Devices/5AF0B43E-B4BF-44CC-A7CA-B727C4E675B0/data/Containers/Bundle/Application/E1786004-CD42-42EB-B0C3-ACF3E7C96394/MyApp/MyApp Identifier: local.MyApp Version: 1.0 (1) Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd_sim [27288] Coalition: com.apple.CoreSimulator.SimDevice.5AF0B43E-B4BF-44CC-A7CA-B727C4E675B0 [4660] Responsible Process: SimulatorTrampoline [3083] Date/Time: 2023-04-04 11:38:33.4457 +0300 Launch Time: 2023-04-04 11:37:58.5666 +0300 OS Version: macOS 13.3 (22E252) Release Type: User Report Version: 104 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x0000000102400000 Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [25120] Triggered by Thread: 0 Thread 0 Crashed: 0 ??? 0x102400000 ??? 1 dyld 0x10264fbe0 dyld4::prepareSim(dyld4::RuntimeState&, char const*) + 904 2 dyld 0x10264e64c dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 276 3 dyld 0x10264de18 start + 1964 Thread 0 crashed with ARM Thread State (64-bit): x0: 0x0000000000000000 x1: 0x0000000000000001 x2: 0x000000016da7cb30 x3: 0x0000000000000000 x4: 0x0000000000000000 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x0000000000000000 x8: 0x0000000000000000 x9: 0x000000016da7cb38 x10: 0x0000000102538000 x11: 0x00000001023bc0b0 x12: 0x0000000000000000 x13: 0x0000000000000b00 x14: 0x0000000000000000 x15: 0x0000000000000000 x16: 0x00000001026bec34 x17: 0x19580001026da038 x18: 0x0000000000000000 x19: 0x0000000000000000 x20: 0x000000016da7cdb0 x21: 0x0000000000000001 x22: 0x000000016da7cb40 x23: 0x0000000102400000 x24: 0x00000001024a4000 x25: 0x0000000000094000 x26: 0x0000000000000000 x27: 0x0000000000000000 x28: 0x0000000000000000 fp: 0x000000016da7cbe0 lr: 0x000000010267ec00 sp: 0x000000016da7cb30 pc: 0x0000000102400000 cpsr: 0x80001000 far: 0x0000000102624000 esr: 0xf2000000 (Breakpoint) brk 0 Binary Images: 0x102648000 - 0x1026d7fff dyld (*) <6f2c2bb8-4bbc-3b64-b927-d3f3193b6295> /usr/lib/dyld 0x102538000 - 0x102587fff dyld_sim (*) <4eba7f04-0a30-3166-8a68-9125b8a1d5f9> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim 0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ??? Error Formulating Crash Report: dyld_process_snapshot_get_shared_cache failed EOF
1
0
1k
Apr ’23
Can't get a cumulativeHitchTimeRatio metric from MetricKit
Hello guys! I'm trying to collect metrics for each UIViewController in my iOS app. I can see all aggregated metrics except the cumulativeHitchTimeRatio one. I created a sample project and run UI test for more than 2 hours to allow Apple MetricKit to collect the metrics. When I run measure UI test it collects needed data well (look attached screenshots), but, unfortunately, I receive empty signpostMetrics array next day (json attached) in the didReceive(_:) method. Could you help me to understand how to get the cumulativeHitchTimeRatio metric from the MetricKit framework?
3
0
1.7k
Feb ’23