Topic : Attaching debugger via lldb to remote process on tv device
Current status
I launch an app on a remote tv device that is paired to a macbook using the command
xcrun devicectl device process launch --start-stopped -d XXXX-XXXXXX, com.metasample.SampleApp -j launch.json
App is launched in stopped state and waiting for debugger to be attached to continue execution
Using the XCode->Debug->Attach to Process, I am able to select the process and connect to the process and execute the app through the debugger.
Expectation
I would want to replace step 3 and use a command line instead to attach the debugger to the remote process instead of doing it via XCode.(the reason is to automate the execution without any manual intervention)
I know the process id of the app on the remote tv device when i inspect the launch.json file that is created when the launch the app. eg pid 312
I also know the ip address of the device eg ip 192.168.178.29
However I do not know how to establish the debug session using lldb from command line.
I launch lldb in the command line and execute these commands
platform select remote-tvos
target create /Users/works/apps/SampleApp-Payload/SampleApp.app/SampleApp
gdb-remote 192.168.178.29: "what is the port?" - I do not know what port to connect to?
Many Thanks for your suggestions and inputs on how to connect to the remote app via command line lldb.
Post
Replies
Boosts
Views
Activity
I am trying to retrieve the crash logs from the iPhone programatically.
The use case is, we are testing many different apps on an iPhone as part of the CI/CD process.
As part to this CI/CD process, when an app crashes, we want to retrieve the crash logs from the iPhone and send a notification to the development team with the crash log.
So is there a way to extract the crash logs programatically.
Also what is the naming convention for a crash log file that is created in an iPhone.
Thanks!
I have Xcode 15.1 and iPhone 14 with iOS 17.3. Developer mode is enabled on the iPhone.
I am executing the command
xcrun devicectl diagnose -k -v
I encounter errors when the command is executed (Truncated some output without any errors to be within 7000 char limit)
Using verbose logging.
Collecting diagnostics from this machine and all nearby devices. You can restrict the list of targeted devices using --devices.
This may take several minutes.
5413D57C-7CBD-4F75-94AF-E8AE7CDF2C8C: Adding device results entry for 'iPhone-7675 (iPhone 14)'
iPhone-7675 (iPhone 14): Fetch DDI metadata
iPhone-7675 (iPhone 14): Starting operation 'Fetch DDI metadata'
iPhone-7675 (iPhone 14): Finished 'Fetch DDI metadata'. Results at /private/var/folders/zf/3p2mcxsx6tj36w19yfthy81jxrfr_j/T/TemporaryItems/NSIRD_devicectl_Hohg2i/devicectl_diagnose_2024_02_20.14-44-05/5413D57C-7CBD-4F75-94AF-E8AE7CDF2C8C/DDIMetadata.json
iPhone-7675 (Connected, iOS 17.3 21D50, 5413D57C-7CBD-4F75-94AF-E8AE7CDF2C8C): Collecting diagnostics
iPhone-7675 (iPhone 14): Starting operation 'Gather network state'
host: Adding host results entry for 'Host System'
Host System: Starting operation 'Gather network state'
Host System: Starting operation 'Gather Bonjour adverts'
Host System: Starting operation 'Gather CoreDevice defaults'
Host System: Starting operation 'Gather RemotePairing defaults'
iPhone-7675 (iPhone 14): Gather network state: Failed to spawn binary: The specified operation is not implemented on this device. (com.apple.dt.CoreDeviceError error 1.)
--------------------------------------------------------------------------------
Host System: Starting operation 'Get CoreDevice version'
The operation couldn’t be completed. (CoreDevice.ActionError error 2.)
NSDebugDescription = This operation cannot be performed on this device.
Host System: Finished 'Gather network state'. Results at /private/var/folders/zf/3p2mcxsx6tj36w19yfthy81jxrfr_j/T/TemporaryItems/NSIRD_devicectl_Hohg2i/devicectl_diagnose_2024_02_20.14-44-05/host/ifconfig.txt
Host System: Starting operation 'Get default Xcode version'
Host System: Starting operation 'Get path to the default Xcode install'
Host System: Starting operation 'List information about all devices'
Host System: Finished 'List information about all devices'. Results at /private/var/folders/zf/3p2mcxsx6tj36w19yfthy81jxrfr_j/T/TemporaryItems/NSIRD_devicectl_Hohg2i/devicectl_diagnose_2024_02_20.14-44-05/host/CoreDevice-listDevices.json
Host System: Starting operation 'List preferred DDIs for all platforms'
Host System: Finished 'Get path to the default Xcode install'. Results at /private/var/folders/zf/3p2mcxsx6tj36w19yfthy81jxrfr_j/T/TemporaryItems/NSIRD_devicectl_Hohg2i/devicectl_diagnose_2024_02_20.14-44-05/host/DefaultXcode-path.txt
Unable to find preferred DDI for iOS platform: CoreDeviceError(errorCode: 12007, errorUserInfo: ["DDIPlatform": "iOS", "NSLocalizedDescription": "Unable to find a developer disk image to use for the iOS platform (variants: Internal).", "DDIVariants": ["Internal"]])
Unable to find preferred DDI for tvOS platform: CoreDeviceError(errorCode: 12007, errorUserInfo: ["DDIVariants": ["Internal"], "NSLocalizedDescription": "Unable to find a developer disk image to use for the tvOS platform (variants: Internal).", "DDIPlatform": "tvOS"])
Unable to find preferred DDI for watchOS platform: CoreDeviceError(errorCode: 12007, errorUserInfo: ["DDIPlatform": "watchOS", "DDIVariants": ["Internal"], "NSLocalizedDescription": "Unable to find a developer disk image to use for the watchOS platform (variants: Internal)."])
Unable to find preferred DDI for macOS platform: CoreDeviceError(errorCode: 12007, errorUserInfo: ["DDIPlatform": "macOS", "DDIVariants": ["Public"], "NSLocalizedDescription": "Unable to find a developer disk image to use for the macOS platform (variants: Public)."])
Unable to find preferred DDI for macOS platform: CoreDeviceError(errorCode: 12007, errorUserInfo: ["DDIPlatform": "macOS", "NSLocalizedDescription": "Unable to find a developer disk image to use for the macOS platform (variants: Internal).", "DDIVariants": ["Internal"]])
Unable to find preferred DDI for visionOS platform: CoreDeviceError(errorCode: 12007, errorUserInfo: ["DDIPlatform": "xrOS", "DDIVariants": ["Public"], "NSLocalizedDescription": "Unable to find a developer disk image to use for the xrOS platform (variants: Public)."])
Unable to find preferred DDI for visionOS platform: CoreDeviceError(errorCode: 12007, errorUserInfo: ["DDIPlatform": "xrOS", "NSLocalizedDescription": "Unable to find a developer disk image to use for the xrOS platform (variants: Internal).", "DDIVariants": ["Internal"]])
Host System: Finished 'List preferred DDIs for all platforms'. Results at /private/var/folders/zf/3p2mcxsx6tj36w19yfthy81jxrfr_j/T/TemporaryItems/NSIRD_devicectl_Hohg2i/devicectl_diagnose_2024_02_20.14-44-05/host/CoreDevice-preferredDDIs.json
Host System: Starting operation 'Copy the Core Device database'
Copying CoreDevice database
Host System: Finished 'Copy the Core Device database'. Results at /private/var/folders/zf/3p2mcxsx6tj36w19yfthy81jxrfr_j/T/TemporaryItems/NSIRD_devicectl_Hohg2i/devicectl_diagnose_2024_02_20.14-44-05/host/CoreDevice-db.sqlite
Host System: Starting operation 'Copy the DDI version.plists from /Library/Developer/DeveloperDiskImages'
Copying DDI version.plists from /Library/Developer/DeveloperDiskImages
Host System: 'Copy the DDI version.plists from /Library/Developer/DeveloperDiskImages' failed: The file “DeveloperDiskImages” couldn’t be opened because there is no such file. (NSCocoaErrorDomain error 260.)
NSFilePath = /Library/Developer/DeveloperDiskImages
NSURL = file:///Library/Developer/DeveloperDiskImages/
--------------------------------------------------------------------------------
The operation couldn’t be completed. No such file or directory (NSPOSIXErrorDomain error 2.)
<TRUNCATED>
Effective timeout: 3600, remainingTime: 3596, will wait: 3536 seconds
Waiting for 1/14 tasks to finish…
Pending operations:
- Host System: Gather Bonjour adverts
Host System: Finished 'Gather Bonjour adverts'. Results at /private/var/folders/zf/3p2mcxsx6tj36w19yfthy81jxrfr_j/T/TemporaryItems/NSIRD_devicectl_Hohg2i/devicectl_diagnose_2024_02_20.14-44-05/host/dns-sd.txt
Wrote file to /tmp/devicectl_diagnose_2024_02_20.14-44-05.zip
Setting diagnostics destination to '/tmp/devicectl_diagnose_2024_02_20.14-44-05.zip'
Captured diagnostics do not include a host sysdiagnose. Please capture one separately.
Captured diagnostics do not include a sysdiagnose from any device. Please capture one if relevant to your issue.
Command Completed, took 6.333 seconds
How to resolve these errors.
Additionally I am also not able to see the crash logs in the Xcode, when I go into Windows > Devices and Simulators > Open Recent Logs
Thanks!