mac上配置GDB遇到的坑及解决方法

一.创建codesign遇到未知错误-2,147,414,007

ps:具体怎么创建codesign 网上都有具体的方式,可以google(用下面的指令绑定)

sudo killall taskgated | sudo codesign -fs gdb-cert /usr/local/bin/gdb

怎么解决上面的问题,可以参考以下方式(https://opensource.apple.com/source/lldb/lldb-69/docs/code-signing.txt)

On MacOSX lldb needs to be code signed. The Debug and Release builds 
are set to code sign using a code signing certificate named 
lldb_codesign. 

If you don't have one yet you will need to:
- Launch /Applications/Utilities/Keychain Access.app

- In Keychain Access select the "login" keychain in the "Keychains"
  list in the upper left hand corner of the window.

- Select the following menu item:

	Keychain Access->Certificate Assistant->Create a Certificate...

- Set the following settings

	Name = lldb_codesign
	Identity Type = Self Signed Root
	Certificate Type = Code Signing

- Click Continue
- Click Continue
- Click Done
- Click on the "My Certificates"
- Double click on your new lldb_codesign certificate
- Turn down the "Trust" disclosure triangle

	Change:
		When using this certificate: Always Trust

- Enter your login password to confirm and make it trusted

The next steps are necessary on SnowLeopard, but are probably because of a bug
how Keychain Access makes certificates.

- Option-drag the new lldb_codesign certificate from the login keychain to
  the System keychain in the Keychains pane of the main Keychain Access window
  to make a copy of this certificate in the System keychain.  You'll have to
  authorize a few more times, set it to be "Always trusted" when asked.
- Switch to the System keychain, and drag the copy of lldb_codesign you just
  made there onto the desktop.
- Switch to Terminal, and run the following:

sudo security add-trust -d -r trustRoot -p basic -p codeSign -k /Library/Keychains/System.keychain ~/Desktop/lldb_codesign.cer

- Right click on the "lldb_codesign" certificate in the "System" keychain (NOT
  "login", but the one in "System"), and select "Delete" to delete it from
  the "System" keychain.
- Reboot
- Clean and rebuild lldb and you should be able to debug.

That should do it.

ps:我的机器上根据上面的方法做了之后,再创建gdbsign就不会有问题了

二.During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.

解决方式,回退gdb版本至8.0.1

Unlink current gdb: brew unlink gdb

Install gdb 8.0.1: brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/9ec9fb27a33698fc7636afce5c1c16787e9ce3f3/Formula/gdb.rb

ps: 当遇到sip的问题时

echo "set startup-with-shell off" >> ~/.gdbinit


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值