mac 10.14.4 gdb安装 tips
按照常规教程 codesign 之后,gdb仍然提示:
Unable to find Mach task port for process-id 39847: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))
解决参考:
macOS Mojave: How to achieve codesign to enable debugging (gdb)?
This is related to codesign entitlements. you must add "com.apple.security.cs.debugger" key in signing process.
for example you must change codesign -fs gdb-cert /usr/local/bin/gdb
to codesign --entitlements gdb.xml -fs gdbcert /usr/local/bin/gdb
.
gdb.xml content must something like following 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签名还在。
另外一个 error,gdb>run
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!
Copyright © 2024 Primzahl. All rights reserved.