Closed fbaptista closed 2 years ago
print(rpc.call('com.apple.instruments.server.services.processcontrol', 'launchSuspendedProcessWithDevicePath:bundleIdentifier:environment:arguments:options:',
'',
'com.alipay.iphoneclient',
{'OS_ACTIVITY_DT_MODE': '1', 'HIPreventRefEncoding': '1', 'DYLD_PRINT_TO_STDERR': '1'},
[],
{'StartSuspendedKey': True, 'iODestinationKey': 0}).selector)
When "StartSuspendedKey" is True and the pid is returned successfully, the app is in debug mode
Hello Yue Chen, thanks a lot for sharing your approach. I found two issues taking this mechanism:
Do you think there is a way to get this information without having those issues?
Update: Even using this mechanism with an unlocked device, if the app is on debug mode, the device got stuck. To reproduce you can try running the code first with a debug app, and then with a release one.
Example:
pid_1 = _rpc_channel.call(
'com.apple.instruments.server.services.processcontrol',
'launchSuspendedProcessWithDevicePath:bundleIdentifier:environment:arguments:options:',
'',
'com.mydebug-app',
{'OS_ACTIVITY_DT_MODE': '1', 'HIPreventRefEncoding': '1', 'DYLD_PRINT_TO_STDERR': '1'},[],
{'StartSuspendedKey': True}).selector
pid_2 = _rpc_channel.call(
'com.apple.instruments.server.services.processcontrol',
'launchSuspendedProcessWithDevicePath:bundleIdentifier:environment:arguments:options:',
'',
'com.any-app',
{'OS_ACTIVITY_DT_MODE': '1', 'HIPreventRefEncoding': '1', 'DYLD_PRINT_TO_STDERR': '1'},[],
{'StartSuspendedKey': True}).selector
After running the first launch, device got stuck until you manually kill the starting app. It is like the instrument server is expecting another command 🤷🏽♂️
if HouseArrestService().send_command('com.xxxx'):
You can try using house_arrest. I don't know any other way
This definitively works fast and without issues! You rock !
Hello there! We are writing a routine to get Startup Time calculation using TimeProfiler over instruments. It will be nice to create a PR to this repo to add those capabilities.
Is there any way to check in advance if a certain APP is in debug mode ? This will be the pre-requisite to make this routine work properly.
Thanks !