In the past, there was a super-convenient package `carge-instruments` that made running Instruments for your binary a breeze. Unfortunately, ever since Big Sur got introduced, tt doesn’t work; we’re hitting this error instead: cmyr/cargo-instruments#40 Everything binary now needs to be signed, even if it’s just an ad-hoc signature.
Paste the following content in ~~/debug.plist~ file.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>com.apple.security.get-task-allow</key><true/></dict></plist>
codesign -s - -f --entitlements ~/debug.plist target/debug/maker
codesign -dvvv target/debug/maker
xcrun xctrace record --template 'Leaks' --launch -- target/debug/maker testnet
Note: you can choose from different Instruments templates, depending on your debugging needs. You can also create your own ones. You can find the template names inside Instruments - when you open it, you will be prompted to pick one. Type the desired one instead of “Leaks” in the above command.
You can stop collecting data by pressing Ctrl+c
Navigate to the new *.trace
file that appeared in your working directory.
You can quickly open the trace in new instance of Instruments for analysis by typing open
before the filename, e.g.
open Launch_maker_2022-05-05_13.51.31_F7D754B8.trace