Same error XCode 14.3.1, macOS 13.4.1, M1 Max, Instruments Leaks, debug build of a c++ program using AppleClang 14.0.0. I eventually found a workaround by making a bash script that creates an xml plist file with a "get-task-allow" key and then applied it by running:
codesign -s - -v -f --entitlements allow.plist ./build/debug/MyProgram.app/Contents/MacOS/MyProgram
Here is the allow.plist xml file contents:
<?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>