diff -uNr gdb-1824.orig/gdb-wrapper gdb-1824/gdb-wrapper --- gdb-1824.orig/gdb-wrapper 1969-12-31 19:00:00.000000000 -0500 +++ gdb-1824/gdb-wrapper 2015-04-13 17:21:01.000000000 -0400 @@ -0,0 +1,28 @@ +#!/bin/bash +# Shell wrapper for Apple gdb + +if [ $UID != 0 ]; then + codesign --verify @FINKPREFIX@/lib/apple-gdb/gdb + if [ $? -eq 1 ]; then + echo "" + echo "The gdb binary must be codesigned to run as non-root." + echo "If Keychain certificate has been created as described in" + echo "the DescUsage section of the apple-gdb.info packaging file," + echo "execute 'sudo codesign -s gdb-cert @FINKPREFIX@/lib/apple-gdb/gdb'." + exit 1 + fi + if [ "`uname -r | cut -d. -f1`" -ge "12" ]; then + plistfile=/System/Library/LaunchDaemons/com.apple.taskgated.plist + if [ !`grep "-sp" $plistfile` ] && [ !`grep "-ps" $plistfile` ] ; then + echo "Non-root gdb use requires /System/Library/LaunchDaemons/com.apple.taskgated.plist" + echo "to pass -p. Change the line..." + echo " string>-s" + echo "to...\n" + echo " string>-sp" + echo "A restart is required due to kernel caching for the change to take effect." + exit 1 + fi + fi +fi + +exec @FINKPREFIX@/lib/apple-gdb/gdb "${@}"