mirror of
https://github.com/1Password/arboard.git
synced 2025-07-07 13:25:18 +00:00
Add helper script for diagnosing any future leak issues
This commit is contained in:
parent
1e9c093667
commit
f409d085ee
2 changed files with 27 additions and 0 deletions
7
tools/debugger.entitlements
Normal file
7
tools/debugger.entitlements
Normal file
|
@ -0,0 +1,7 @@
|
|||
<!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>
|
20
tools/run_with_leaks.sh
Executable file
20
tools/run_with_leaks.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# This script is a utility on Apple platforms to run one
|
||||
# of arboard's example binaries under the `leaks` CLI tool,
|
||||
# which can help to diagnose memory leakage in any kind of
|
||||
# native or runtime-managed code.
|
||||
|
||||
example_name="$@"
|
||||
|
||||
script_dir=$(dirname $BASH_SOURCE[0])
|
||||
|
||||
# Build the example
|
||||
cargo build --example "$example_name"
|
||||
|
||||
# Sign it with the required entitlements for process debugging.
|
||||
codesign -s - -v -f --entitlements "$script_dir/debugger.entitlements" "./target/debug/examples/$example_name"
|
||||
|
||||
# Run the example binary under `leaks` to look for any leaked objects.
|
||||
leaks --atExit -- "./target/debug/examples/$example_name"
|
Loading…
Add table
Add a link
Reference in a new issue