Mac OS X cannot run GDB

血红的双手。 提交于 2020-01-14 03:48:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!