我想通过OS / X El Capitan运行gdb
(通过自制软件安装)。我在网上经历了多个关于代码签名,创建证书等的帖子,但它仍然无效。
(参见例如:How to get a "codesigned" gdb on OSX?)
我的代码已正确签名,如下所示:
codesign -vvd /usr/local/bin/gdb
Executable=/usr/local/Cellar/gdb/7.11/bin/gdb
Identifier=org.gnu.gdb
Format=Mach-O thin (x86_64)
CodeDirectory v=20100 size=44540 flags=0x0(none) hashes=1388+2 location=embedded
Signature size=1772
Authority=gdb-cert
Signed Time=Jul 4, 2016, 7:37:55 AM
Info.plist entries=4
TeamIdentifier=not set
Sealed Resources=none
Internal requirements count=1 size=88
以及
codesign -vvd /usr/local/Cellar/gdb/7.11/bin/gdb
Executable=/usr/local/Cellar/gdb/7.11/bin/gdb
Identifier=org.gnu.gdb
Format=Mach-O thin (x86_64)
CodeDirectory v=20100 size=44540 flags=0x0(none) hashes=1388+2 location=embedded
Signature size=1772
Authority=gdb-cert
Signed Time=Jul 4, 2016, 7:37:55 AM
Info.plist entries=4
TeamIdentifier=not set
Sealed Resources=none
Internal requirements count=1 size=88
我的用户是_developer
和procmod
的成员,我认为这可能很重要。
但一切都无济于事。当我尝试调试我的程序时,我仍然收到错误:
gdb a.out
GNU gdb (GDB) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
...
Reading symbols from a.out...(no debugging symbols found)...done.
(gdb) run
Starting program: a.out
Unable to find Mach task port for process-id 658: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))
(gdb)
我甚至尝试sudo spctl --master-disable
完全关闭对已签名编码的检查,但我仍然遇到同样的错误。
但是,如果我以root
运行,那么它可以运行。
我真的希望能够以普通用户身份运行gdb。有谁知道发生了什么?