macos - macOS Mojave 10.14.2 上的 gdb
问题描述
- 操作系统版本:macOS Mojave 10.14.2
- gdb:8.2.1(使用 brew install gdb 安装)
我成功地进行了代码设计
codesign --entitlements gdb-entitlement.xml -fs gdb-cert $(which gdb)
我有这样的简单代码:
int main(int argc, char *argv[]) { std::cout << "你好,世界" << std::endl; 返回0;}
然后 gdb 挂起
zhifandeMacBook-Pro:cpp-quick-start zhifan$ g++ -g main.cpp
zhifandeMacBook-Pro:cpp-quick-start zhifan$ gdb ./a.out
GNU gdb (GDB) 8.2.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-darwin18.2.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/zhifan/github/cpp-quick-start/a.out.dSYM/Contents/Resources/DWARF/a.out...done.
done.
(gdb) start
Temporary breakpoint 1 at 0x100000f54: file main.cpp, line 5.
Starting program: /Users/zhifan/github/cpp-quick-start/a.out
[New Thread 0x1903 of process 11780]
[New Thread 0x1a03 of process 11780]
During startup program terminated with signal ?, Unknown signal.
(gdb) set startup-with-shell off
(gdb) start
Temporary breakpoint 2 at 0x100000f54: file main.cpp, line 5.
Starting program: /Users/zhifan/github/cpp-quick-start/a.out
[New Thread 0x2707 of process 11806]
我的 gdb 一直挂在这里([进程 11806 的新线程 0x2707])。
我不能使用 8.0.1,因为问题未知加载命令 0x32
我还可以做些什么?
解决方案
好的,根据我过去两年使用 MacBook Pro 编码的经验。我从来没有成功让 gdb 正常工作。macOS 使用 Xcode Developer 工具进行编译。这些工具包括与 gdb 非常相似的 lldb。
这是一个可以帮助您做到这一点的网站。 https://lldb.llvm.org/lldb-gdb.html 这是一张直接展示gdb工具和lldb工具的图。希望这可以帮助。
推荐阅读
- html - 图像不会并排显示
- javascript - Axios:如何访问被拒绝的承诺的响应对象?
- python - pygame 使精灵向上和向下移动
- node.js - 在将有效负载发送到客户端之前从 requestjs 转换有效负载
- ios - 反应本机iOS构建问题在提供的路径中找不到应用程序包
- c# - 在没有 Parallel.For() 的情况下在 c# 中的 for 循环中实现多线程
- python - 如何在 abaqus python 脚本中引用 findAt 列表/元组
- c# - 打印列表对象 c#
- bash - bash - 下划线后的第一个字符大写
- html - 对齐同一行上的两个按钮有效,但不是 div