【macOS】macOS安装gdb 2018.12

lldb的插件不太会用,因此尝试在macOS上安装一下gdb,还是遇到很多问题,暂且记录一下。很快brew应该就更新了,到时直接brew  install gdb即可。

20181212最终安装方案:

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/cb7a4c1b8e52220ed8d5d382268e5a36fad99815/Formula/gdb.rb --HEAD

方法二(未尝试),切换到gdb8.0.1 https://github.com/Homebrew/homebrew-core/issues/25172

给gdb签名

- https://www.jianshu.com/p/ce2d77d7d1c4
- https://blog.csdn.net/am290333566/article/details/81186399

注:我使用 codesign -v /usr/local/bin/gdb 代码签名后,还是会遇到错误,暂时未解决,所以我是sudo gdb启动程序的。如果有解决的同学麻烦评论告诉我~

Unable to find Mach task port for process-id 1481: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))

最终的gdb版本

➜  ~ gdb
GNU gdb (GDB) 8.2.50.20181212-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin18.2.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".

【macOS】macOS安装gdb 2018.12

 

参考:

https://*.com/questions/52529838/gdb-8-2-cant-recognized-executable-file-on-macos-mojave-10-14