Mac OS X无法运行GDB [英] Mac OS X cannot run GDB
问题描述
计算机设置:Mac OS X Yosemite
Computer setup: Mac OS X Yosemite
我的gdb功能很好。但是今天,
My gdb functions well before. But today,
当我尝试使用gdb调试:
When I try to use gdb to debug:
(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
I tried to add key chain like this; http://ntraft.com/installing-gdb-on-os-x-mavericks/ and this: https://sourceware.org/gdb/wiki/BuildingOnDarwin
然后重启电脑。但是问题仍然存在。
And restart my computer. But the problem is still there.
推荐答案
这可以通过在任务设置中设置-p来修复:
This can be fixed by setting the -p in the taskgated plist:
编辑(作为sudo): /System/Library/LaunchDaemons/com.apple.taskgated.plist
edit (as sudo): /System/Library/LaunchDaemons/com.apple.taskgated.plist
... <snip> ...
<key>ProgramArguments</key>
<array>
<string>/usr/libexec/taskgated</string>
<string>-sp</string>
</array>
从任务组件
手册:
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
这篇关于Mac OS X无法运行GDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!