1. 程式人生 > >【macOS】macOS安裝gdb 2018.12

【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".

 

參考:

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