问题
Computer setup: Mac OS X Yosemite
My gdb functions well before. But today,
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))
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.
回答1:
This can be fixed by setting the -p in the 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>
From the taskgated
manual:
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.
reference: https://trac.macports.org/ticket/36727
来源:https://stackoverflow.com/questions/32665409/mac-os-x-cannot-run-gdb