Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
gdb不';t在macos High Sierra 10.13.3上工作_Macos_Gdb - Fatal编程技术网

gdb不';t在macos High Sierra 10.13.3上工作

gdb不';t在macos High Sierra 10.13.3上工作,macos,gdb,Macos,Gdb,我已经用brew安装了gdb 8.1 我还有代码设计gdb和.gdbinit,如下所示: 在外壳关闭时设置启动 我已禁用SIP功能: $ csrutil status System Integrity Protection status: disabled. 但gdb仍然不起作用: #include <iostream> using namespace std; int main() { cout << "hello world!" << endl;

我已经用brew安装了gdb 8.1

我还有代码设计gdb和.gdbinit,如下所示:

在外壳关闭时设置启动

我已禁用SIP功能:

$ csrutil status
System Integrity Protection status: disabled.
但gdb仍然不起作用:

#include <iostream>
using namespace std;

int main() {
  cout << "hello world!" << endl;
  return 0;
}
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) 
GNU gdb(gdb)8.1
版权所有(C)2018免费软件基金会。
许可证GPLv3+:GNU GPL版本3或更高版本
这是自由软件:您可以自由更改和重新发布它。
在法律允许的范围内,不存在任何担保。键入“显示复制”
和“显示保修”了解详细信息。
此GDB配置为“x86_64-apple-darwin17.3.0”。
键入“显示配置”以获取配置详细信息。
有关错误报告说明,请参阅:
.
在线查找GDB手册和其他文档资源,网址为:
.
要获得帮助,请键入“帮助”。
键入“apropos word”以搜索与“word”相关的命令。。。
从a.out读取符号…从/Users/mypc/Downloads/a.out.dSYM/Contents/Resources/DWARF/a.out读取符号…完成。
完成。
(gdb)运行
启动程序:/Users/mypc/Downloads/a.out
[进程802的新线程0x2503]
[进程802的新线程0x2303]
启动期间,程序以信号?终止,未知信号。
(gdb)

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

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

如何降级到gdb 8.0.1
  • 取消当前gdb的链接:
    brew取消gdb的链接
  • 安装gdb 8.0.1:
    brew安装https://raw.githubusercontent.com/Homebrew/homebrew-core/9ec9fb27a33698fc7636afce5c1c16787e9ce3f3/Formula/gdb.rb
  • 可选:避免使用
    brew pin gdb升级gdb

就我而言,降级到8.0.1没有帮助。
但以下步骤有所帮助

(我插入了步骤12,“检查它是否工作”,因为我没有重新启动,而是测试了gdb,它工作得很好。我没有遵循步骤12+)


  • 开放式钥匙链访问
  • 在菜单中,打开钥匙链访问>证书助手>创建证书
  • 给它一个名称(例如,
    gdb证书
    • 标识类型:自签名根
    • 证书类型:代码签名
    • 检查:让我覆盖默认值
  • 继续,直到“为…指定位置”
  • 将钥匙链位置设置为系统
  • 创建证书并关闭证书助手
  • 在系统密钥链中查找证书
  • 双击证书
  • 展开信任,将代码签名设置为“始终信任”
  • 重新启动终端中的taskgated:
    killall taskgated
  • 使用您的证书对gdb进行代码设计:
    Codesign-fs-gdb-cert/usr/local/bin/gdb
  • ---检查它是否有效---
  • 关闭mac并在恢复模式下重新启动(按住
    command-R
    ,直到出现apple徽标)
  • 打开终端窗口
  • 修改系统完整性保护以允许调试:
    csrutil启用--无调试
  • 重新启动你的Mac电脑
  • 使用gdb进行调试现在应该可以按预期工作
  • 信息来源:
    赛拉预科:

    Sierra:

    我使用的是macOS 10.13.6,我遇到了相同的问题“(请检查gdb是否进行了代码设计-请参阅taskgated(8))

    当我将GDB从8.2.1降级到8.0.1,然后再次创建并签署GDB证书时,它就工作了


    别忘了在eclipse的调试器中将gdb的路径从8.2.1更改为8.0.1,重新启动它就会工作。

    似乎gdb在macos上被破坏了,请参见和。嘿,我也遇到了同样的问题。你采取了什么措施来解决这个问题?运行程序时是否曾收到此错误:
    无法找到进程id 62995:(os/kern)失败(0x5)的Mach任务端口。(请检查gdb是否进行了代码签名-请参阅taskgated(8))
    ?@nullbyte请参阅下面的答案,将gdb下载到8.0.1可以正常工作。@nullbyte这实际上是一个独立的、不相关的问题@xdavidliu这实际上是一个非常相关的问题。它对我也起了作用。奇怪的是,为什么会出现这种错误,并且可能会引起与a的混淆。这不可能是相同的错误,因为8.0.1没有这个问题。我在提交了错误报告,并且在一系列实验之后,我认为这是一个在提交f6ac5f3d63e03a81c4ff3749aba234961cc9090e中引入的错误。查看此错误的线程:看起来这在8.2.1中仍然是一个问题。不幸的是,这似乎无法解决Mojave上的问题,即使最新的“Mojave上的修复”提交到gdb公式,错误仍然存在(即使在代码签名gdb之后)。这在macOS 10.14.2上不起作用,列出原因会更有用。这是一个无关的问题,不幸的是,这些步骤总结在官方维基上:。我不认为csrutil步骤是必要的。Mac OS Sierra 10.13.6 gdb 8.0.1我发现我的系统中已经有gdbcert1了。从7点开始跟踪一切。作品
    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)