如何在Mac OSX El Capitan中安装gdb(调试器)? [英] How to install gdb (debugger) in Mac OSX El Capitan?
问题描述
如何在Mac OSX El Capitan中安装gdb(调试器)?我曾尝试安装gdb,但几次都失败。
我正在关注这个网址: 任何人都可以在这方面帮助我。 是这个问题的两个解决方案,他们都在这个问题的其他答案中提到,并且如何让gdb在OSX 10.11 El Capitan下使用macports?,但是为了清除这里的一些混淆是我的总结(作为一个答案,因为它有点长的评论): 哪种方法更安全?我猜可以归结为1)信任自签名证书和2)给用户更多权限。 如果使用签名替代方法,禁用SIP添加<-c $ c> taskgated 的-p选项不是必需的。 不过,请注意这个替代方案,调试只允许 em> 使用codesign使用名为 (使用MacPorts标准路径,必要时采用) 代码签名配方(包括创建证书),请参阅: 请注意,您需要重新启动钥匙串应用程序和任务门户服务(最简单的方法是重新启动)。 根据@ user14241的回答,dis abling SIP并将-p选项添加到 在添加-p选项(允许组procmod和procview)到taskgated之后,您还需要添加应允许使用的用户gdb到procmod组。 配方是: 在恢复模式下重启,打开终端并运行 重启机器并编辑 以恢复模式重新启用SIP( 重新启动机器并将用户 另一个不涉及将用户添加到组的方法是将可执行文件setgid procmod ,因为这也使得 How to install gdb (debugger) in Mac OSX El Capitan ? I have tried installing gdb but failed couple of time. I was following this URL : http://ntraft.com/installing-gdb-on-os-x-mavericks/ , MAC doesnot allow to install MacPorts. Could anyone please help me in this regard. There are two solutions to the problem, and they are both mentioned in other answers to this question and to How to get gdb to work using macports under OSX 10.11 El Capitan?, but to clear up some confusion here is my summary (as an answer since it got a bit long for a comment): Which alternative is more secure I guess boils down to the choice between 1) trusting self-signed certificates and 2) giving users more privileges. If the signature alternative is used, disabling SIP to add the -p option to However, note that with this alternative, debugging is only allowed for users in the Using codesign to sign using a cert named (using the MacPorts standard path, adopt as necessary) For detailed code-signing recipes (incl cert creation), see :
https://gcc.gnu.org/onlinedocs/gcc-4.8.1/gnat_ugn_unw/Codesigning-the-Debugger.html or
https://sourceware.org/gdb/wiki/BuildingOnDarwin Note that you need to restart the keychain application and the taskgated service during and after the process (the easiest way is to reboot). As per the answer by @user14241, disabling SIP and adding the -p option to After adding the -p option (allow groups procmod and procview) to taskgated you also need to add the users that should be allowed to use gdb to the procmod group. The recipe is: restart in recovery mode, open a terminal and run restart machine and edit restart in recovery mode to reenable SIP ( restart machine and add user An alternative that does not involve adding users to groups is to make the executable setgid procmod, as that also makes
这篇关于如何在Mac OSX El Capitan中安装gdb(调试器)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
$ b 备选1:对二进制文件进行签名
_developer
group 。
gdb-cert
:
codesign -s gdb-cert / opt / local / bin / ggdb
https://gcc.gnu.org/onlinedocs/gcc-4.8.1/gnat_ugn_unw/Codesigning-the-Debugger.html 或
https://sourceware.org/gdb/wiki/BuildingOnDarwin
方案2:使用传统选项进行任务处理
taskgated
是一个选项。请注意,如果使用此选项,则不需要签名二进制文件,并且它还绕过用于进行身份验证的对话框,以便作为开发人员工具组的成员进行身份验证( _developer $ c $
csrutil disable
/ System / Library / LaunchDaemons / com.apple.taskgated.plist
,添加
-p
opion:
< array>
< string> / usr / libexec / taskgated< / string>
< string> -sp< / string>
< / array>
csrutil enable < code $)
USERNAME
添加到组中 procmod
:
sudo dseditgroup -o编辑-a USERNAME -t用户procmod
procmod
执行setgid二进制文件的任何用户的有效组标识符(在
sudo chgrp procmod / path / to / gdb
sudo chmod g + s / path / to / gdb
Alternative 1: signing the binary
taskgated
is not required._developer
group.gdb-cert
: codesign -s gdb-cert /opt/local/bin/ggdb
Alternative 2: use the legacy option for taskgated
taskgated
is an option. Note that if using this option, signing the binary is not needed, and it also bypasses the dialog for authenticating as a member of the Developer Tools group (_developer
).
csrutil disable
/System/Library/LaunchDaemons/com.apple.taskgated.plist
, adding
the -p
opion:<array>
<string>/usr/libexec/taskgated</string>
<string>-sp</string>
</array>
csrutil enable
)USERNAME
to the group procmod
: sudo dseditgroup -o edit -a USERNAME -t user procmod
procmod
the effective group id of any user executing the setgid binary (suggested in https://apple.stackexchange.com/a/112132)sudo chgrp procmod /path/to/gdb
sudo chmod g+s /path/to/gdb