gdb 不适用于 macos High Sierra 10.13.3 [英] gdb doesn't work on macos High Sierra 10.13.3

查看:21
本文介绍了gdb 不适用于 macos High Sierra 10.13.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用 brew 安装了 gdb 8.1.

I have installed gdb 8.1 with brew.

我也有 codesign gdb 和 .gdbinit 如下:

I have codesign gdb also and .gdbinit as below:

set startup-with-shell off.

我已禁用 SIP 功能:

I have disabled SIP feature:

$ csrutil status
System Integrity Protection status: disabled.

但是gdb还是不行:

#include <iostream>
using namespace std;

int main() {
  cout << "hello world!" << endl;
  return 0;
}

编译命令:

g++ -g test.cpp

gdb 输出:

GNU gdb (GDB) 8.1
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-darwin17.3.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".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...Reading symbols from /Users/mypc/Downloads/a.out.dSYM/Contents/Resources/DWARF/a.out...done.
done.
(gdb) run
Starting program: /Users/mypc/Downloads/a.out 
[New Thread 0x2503 of process 802]
[New Thread 0x2303 of process 802]
During startup program terminated with signal ?, Unknown signal.
(gdb) 

让 gdb 在 macos sierra 上工作的正确步骤是什么?

What correct steps to make gdb work on macos sierra?

推荐答案

这是最新的gdb 8.1造成的,将gdb降级到8.0.1可以解决这个问题.

This is caused by latest gdb 8.1, downgrade gdb to 8.0.1 could solve this problem.

  • 取消链接当前 gdb:brew unlink gdb
  • 安装 gdb 8.0.1:brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/9ec9fb27a33698fc7636afce5c1c16787e9ce3f3/Formula/gdb.rb
  • 可选:避免使用 brew pin gdb
  • 升级 gdb
  • Unlink current gdb: brew unlink gdb
  • Install gdb 8.0.1: brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/9ec9fb27a33698fc7636afce5c1c16787e9ce3f3/Formula/gdb.rb
  • Optional: avoid upgrade gdb with brew pin gdb

这篇关于gdb 不适用于 macos High Sierra 10.13.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆