mac 10.14.4 gdb安裝 tips

按照常規教程 codesign 以後,gdb仍然提示:html

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

解決參考:macos

macOS Mojave: How to achieve codesign to enable debugging (gdb)?app

https://stackoverflow.com/questions/52699661/macos-mojave-how-to-achieve-codesign-to-enable-debugging-gdbspa

 

This is related to codesign entitlements. you must add "com.apple.security.cs.debugger" key in signing process.debug

for example you must change codesign -fs gdb-cert /usr/local/bin/gdb to codesign --entitlements gdb.xml -fs gdbcert /usr/local/bin/gdb .3d

gdb.xml content must something like following code.code

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.cs.debugger</key>
    <true/>
</dict>
</plist>

注:若是要取消對gdb的證書籤名,可使用 codesign --remove-signature /usr/local/bin/gdb 來完成,前提是你的gdb-cert簽名還在。xml


 

另一個 error,gdb>runhtm

During startup program terminated with signal ?, Unknown signal.

目前穩定版無解:最終選擇使用 git 開發版:gdb-8.3.50.20190401.tar.xz

下載地址:ftp://sourceware.org/pub/gdb/snapshots/current/gdb-8.3.50.20190401.tar.xz

安裝完成: GDB 版本:GNU gdb (GDB) 8.3.50.20190401-git

解決參考:

GDB errors on macOS Mojave

https://stackoverflow.com/questions/54736753/gdb-errors-on-macos-mojave

OK,gdb!

相關文章
相關標籤/搜索