【发布时间】:2018-08-06 15:59:46
【问题描述】:
我已经用 brew 安装了 gdb 8.1。
我也有 codesign gdb 和 .gdbinit 如下:
set startup-with-shell off.
我已禁用 SIP 功能:
$ 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 上工作的正确步骤是什么?
【问题讨论】:
-
似乎 gdb 在 macos 上已损坏,请参阅 github.com/Homebrew/homebrew-core/issues/5912 和 sourceware.org/bugzilla/show_bug.cgi?id=20266。
-
嘿,我遇到了同样的问题。你采取了哪些措施来解决这个问题?您在运行程序时是否收到过此错误:
Unable to find Mach task port for process-id 62995: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8))? -
@nullbyte 见下面的答案,下载 gdb 到 8.0.1 工作正常。
-
@nullbyte 这实际上是一个单独的、不相关的问题。 See my question.
-
@xdavidliu 这实际上是一个非常相关的问题。