mac Certifying GDB
来源:互联网 发布:淘宝发货地与实际不符 编辑:程序博客网 时间:2024/04/29 08:17
背景
mac gdb调试程序时报错:
Unable to find Mach task port for process-id 28885: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))
问题原因:
This is because the Darwin kernel will refuse to allow gdb to debug another process if you don’t have special rights, since debugging a process means having full control over that process, and that isn’t allowed by default since it would be exploitable by malware. (The kernel won’t refuse if you are root, but of course you don’t want to be root to debug.)
The most up to date method to allow gdb to control another process is to sign it with any system-trusted code signing authority.
一、打开钥匙串访问程序
Open up the Keychain Access application (/Applications/Utilities/Keychain Access.app). Navigate via the menu to Keychain Access > Certificate Assistant > Create Certificate…
二、输入证书名并选择证书类型
除第一个红框name可以自定义外,其它两个红框内容的选择必须和这里一致,否则会Certifying GDB失败。
三、设置认证时长
The maximum validity period is 999 days. I don’t really want to deal with this again, so I’m going to max it out.
四、选择证书存储位置
Keep clicking the “Continue” button until you are asked for a location. Set it to “System”.
这里一定要选择“system”。
五、生成成功
六、使证书被信任
Now make sure the cert is always trusted. Right-click the new certificate and select Get Info. Under the Trust section, set Code Signing to Always Trust.
七、重启mac加载证书
Now that we have a certificate, we need to use it to sign GDB. Quit Keychain Access (you must quit Keychain Access!) 。重启mac,使刚才创建的证书被系统加载(网上介绍的杀掉进程taskgated
后,让其自动重启加载证书的方法并不总是有效)。
八、code sign GDB
在终端下运行如下命令: codesign -s gdb-cert $(which gdb-apple)
其中:
- 参数
-s
后面跟的为刚才创建的证书名。 - 参数
$(which gdb-apple)
为gdb的路径名(可通过运行命令which gdb
获得)。
这里我运行的命令为: codesign -s gdb-cert /usr/local/bin/gdb
到此为止,mac Certifying GDB完成,可以gdb调试程序了。
九、参考链接
http://ntraft.com/installing-gdb-on-os-x-mavericks/
http://opensource.apple.com//source/lldb/lldb-69/docs/code-signing.txt
http://stackoverflow.com/questions/11504377/gdb-fails-with-unable-to-find-mach-task-port-for-process-id-error
http://www.cnblogs.com/yishuiliunian/archive/2013/01/13/2858836.html
- mac Certifying GDB
- CAV11: Verification of Certifying Computations
- Mac Application GDB Usage
- mac 10.9 安装gdb
- mac 上安装 gdb
- mac 安装 gdb
- Mac上安装gdb
- mac brew gdb
- Mac - gdb配置
- mac上安装gdb
- MAC 设置gdb调试
- 7.Mac gdb
- Mac OSX GDB调试
- gdb调试 mac os
- mac下gdb签名认证
- Mac OS X 安装gdb
- mac下liteide gdb 调试
- Mac OS X 使用gdb
- 01背包
- Hello CSDN
- ViewDragHelper简单使用
- TimesTen 数据库复制学习:13. 设置复制系统
- 初学者如何查阅自然语言处理(NLP)领域学术资料
- mac Certifying GDB
- Vue.js学习 Item1 --快速入门
- Python 代码风格---指南
- cygwin安装遇到的问题
- httpclient在android studio中用不了
- Git的相关用法
- ViewGroup获取导入view的高宽数据(没走完onCreate)
- JS闭包知识点整理
- 写在大三即将结束前