先说问题: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乱找一气,应该沉下心来仔细观察应有的报错和已知提示,从中找到解决问题的办法,往往是最有效的!

最新文章

  1. python 抽象类、抽象方法、接口、依赖注入、SOLIP
  2. iOS开发小技巧--相机相册的正确打开方式
  3. jQuery实践——选择器篇
  4. Linux提权基础
  5. C++ 之 策略模式
  6. XCOJ 1168 (搜索+期望+高斯消元法)
  7. Swift编程规范
  8. SQL Server Insert操作中的锁
  9. Web API 2:Action的返回类型
  10. 支持虚拟化也开来虚拟化就是装不上HyperV的解决方法
  11. C++ 命名管道 与Winform跨进程通信
  12. MySQL完整教程(共8章)
  13. mongodb 创建更新语法
  14. RN原生调用一:安卓Toast
  15. 前端框架(kraken、Express、Node、MVC)
  16. springmvc 孔浩
  17. PAT 甲级 1143 Lowest Common Ancestor
  18. 微信开发使用 frp 实现本地测试
  19. easyui------设置datagrid('getEditor')时焦点问题
  20. 浴谷八连测R4题解

热门文章

  1. KingbaseES interval 分区表介绍
  2. 【读书笔记】C#高级编程 第十四章 内存管理和指针
  3. Docker安装Redis并使用Another Redis Desktop Manager连接
  4. Windows打印服务器上无法删除打印机
  5. Beats:在Docker里运行Filebeat
  6. #css#如何使用hover,实现父对子的样式改变?
  7. 大数据常用的Linux命令
  8. Spring笔记四
  9. POJ2763 Housewife Wind (树链剖分)
  10. IDEA 调试起来太费劲?你需要了解这几招!