gdb で password を要求される

ROOT で seg fault を起こすと gdb が走りますが、うちの環境だと Xcode の update 時に何か設定がおかしくなることがあり、gdb の実行時に password を求められる場合があります。そのため、途中で seg fault の error を表示した状態で止まってしまいます。

root [8] hoge()

 *** Break *** segmentation violation
Root > 


▲ 表示される 1 つ目。"Developer Tools Access needs to take control of another process for debugging to continue. Type your password to allow this."


▲ 2 つ目。"gdb-i386-apple-darwin needs needs to take control of another process for debugging to continue. Type your password to allow this."

解決策は簡単で、/usr/sbin/DevToolsSecurity を実行する。もしも Xcode の update で再度おかしくなったら、再び実行すれば良い。実際、うちの環境だと何度か実行しています。

sudo /usr/sbin/DevToolsSecurity -enable

原因はよく分からないのと (これが普通の挙動なのかも)、副作用に何があるかはちゃんと調べてません。