Reputation: 1101
I am debugging a cordova app and suspecting a memory issue, using too much when loading images for upload.
I can connect the debugger to the app and watch the disk I/O as the large images are loaded. The memory footprint for the app stays the same as expected, see below.
The images should reside in the wkwebview in the app, and that should be running in a separate com.apple.WebKit.WebContent process. I cannot connect to that process from the Xcode debugger, I get the following error
Could not attach to pid : “32335” Domain: IDEDebugSessionErrorDomain Code: 3 Failure Reason: attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries when the attached failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.)
In Console.app, debugserver reports:
1 +0.000000 sec [7edb/0103]: error: ::task_for_pid ( target_tport = 0x0203, pid = 32335, &task ) => err = 0x00000005 ((os/kern) failure) err = ::task_for_pid ( target_tport = 0x0203, pid = 32335, &task ) => err = 0x00000005 ((os/kern) failure) (0x00000005)
leading to https://developer.apple.com/forums/thread/694700
I have tried the suggestions in the link to no avail.
sudo DevToolsSecurity -enable
deleting the cerificates in ~/Library/MobileDevice/Provisioning\ Profiles (new ones are generated automatically)
my build.json contains the suggested settings:
"ios": {
"debug": {
"codeSignIdentity": "iPhone Developer",
"developmentTeam": "P9Q2VE5DWW",
"packageType": "development",
"automaticProvisioning": true,
"buildFlag": [
"EMBEDDED_CONTENT_CONTAINS_SWIFT=YES",
"DEPLOYMENT_POSTPROCESSING=NO",
"CODE_SIGN_INJECT_BASE_ENTITLEMENTS=YES",
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
"LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\""
]
},
Is there anything else I can try, and is it even possible to connect to the separate com.apple.WebKit.WebContent process?
Upvotes: 0
Views: 526
Reputation: 27203
Debugging on macOS and other Darwin systems is on an opt-in basis. If an app or helper tool does not choose to be debuggable, then you can't debug it, and you get the error that you have shown. This is for security reasons, and all the system binaries on macOS mark themselves as non-debuggable.
This access is controlled by "SIP" - System Integrity Protection, so you will need to defang that to some extent to debug system processes. This thread discusses how to disable just the debugging protections:
https://discussions.apple.com/thread/251326883
Upvotes: 1