gdb不能使用mac
先说问题:1、gdb不能使用,重新用homebrew install 了gdb
2、brew装的gdb可以用了,但是等start调试的时候报这些错误:
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib
gdb Reason: image not found
或者:
Unable to find Mach task port for process-id 15634: (os/kern) failure (0x5).
During startup program terminated with signal ?, Unknown signal.
经google研究,说没有code-sign的原因,然后一通stackoverflow乱搜,遂,卒。
总之是怎么整都不行,然后brew info gdb查看发现当初安装好gdb homebrew有这么几句提示:
==> Caveats
gdb requires special privileges to access Mach ports.
You will need to codesign the binary. For instructions, see:
https://sourceware.org/gdb/wiki/BuildingOnDarwin
On 10.12 (Sierra) or later with SIP, you need to run this:
echo "set startup-with-shell off" >> ~/.gdbinit
遂按照上面的提示最后一行 echo "set startup-with-shell off" >> ~/.gdbinit
结果发现,也不行。
确定了是没有codesign引起的原因,又google,查到一遍文章apple专门关于codesign的:https://opensource.apple.com/source/lldb/lldb-69/docs/code-signing.txt
大概看了下意思,发现要手动Create a Certificate...,觉得好麻烦啊,肯定没这么麻烦,还不死心,继续google。。。结果你懂的
无奈,只能返回去看brew info gdb,发现上面这句链接:
https://sourceware.org/gdb/wiki/BuildingOnDarwin
发现还是需要手动Create a Certificate,罢了,这个写的排版和Troubleshooting都不错,耐着心看下去吧,
跟着尝试了一遍,证书也创好了,taskgated也kill掉了,结果还是不行。。。
再Troubleshooting,
发现没有“Ensure that the certificate is marked as Always Trust”
把证书打开,显示简介,发现里面有调整的选项,换成Always Trust
重新kill了taskgated
新开一个terminal
gdb
start
弹出了一框:输入用户名和密码,老老实实照办,最终:
[New Thread 0x1403 of process 17715]
warning: unhandled dyld version (15)
Thread 2 hit Temporary breakpoint 1, main () at int.c:4
4 int a = 0;
(gdb)
真是不容易啊!
这件事说明:碰到问题不要动不动就google乱找一气,应该沉下心来仔细观察应有的报错和已知提示,从中找到解决问题的办法,往往是最有效的!
最新文章
- python 抽象类、抽象方法、接口、依赖注入、SOLIP
- iOS开发小技巧--相机相册的正确打开方式
- jQuery实践——选择器篇
- Linux提权基础
- C++ 之 策略模式
- XCOJ 1168 (搜索+期望+高斯消元法)
- Swift编程规范
- SQL Server Insert操作中的锁
- Web API 2:Action的返回类型
- 支持虚拟化也开来虚拟化就是装不上HyperV的解决方法
- C++ 命名管道 与Winform跨进程通信
- MySQL完整教程(共8章)
- mongodb 创建更新语法
- RN原生调用一:安卓Toast
- 前端框架(kraken、Express、Node、MVC)
- springmvc 孔浩
- PAT 甲级 1143 Lowest Common Ancestor
- 微信开发使用 frp 实现本地测试
- easyui------设置datagrid('getEditor')时焦点问题
- 浴谷八连测R4题解