Mac OS X无法运行GDB

时间:2015-09-19 07:13:33

标签: macos debugging gdb

计算机设置:Mac OS X Yosemite

我的gdb之前功能很好。但今天,

当我尝试使用gdb进行调试时:

(gdb) run 
Starting program: /Users/JackZhao/Desktop/work/reviewC/pp 
Unable to find Mach task port for process-id 627: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))

我试图像这样添加密钥链; http://ntraft.com/installing-gdb-on-os-x-mavericks/ 还有这个: https://sourceware.org/gdb/wiki/BuildingOnDarwin

然后重启我的电脑。但问题仍然存在。

1 个答案:

答案 0 :(得分:0)

这可以通过在taskgated plist中设置-p来解决:

编辑(作为sudo):/System/Library/LaunchDaemons/com.apple.taskgated.plist

        ... <snip> ...

        <key>ProgramArguments</key>
        <array>
                <string>/usr/libexec/taskgated</string>
                <string>-sp</string>
        </array>

来自taskgated手册:

OPTIONS
 -p       Accepts the old (Tiger) convention that a process with a primary effective group of procmod or procview is allowed to get task ports. Without this option, this legacy mode
          is not supported.

参考:https://trac.macports.org/ticket/36727