PJ.*_*des 7 macos gdb osx-yosemite
我通过Homebrew安装了GDB 7.8.1和GCC 4.9.
当我打开由GCC编译的(gcc-4.9 -g xxx.c -o xxx)程序生成的核心文件时,它会报告:
? gdb ./list_test /cores/core.1176
GNU gdb (GDB) 7.8.1
Copyright (C) 2014 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-darwin14.0.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 ./list_test...
warning: `/var/folders/r1/3sx4x5k1557g_v5by83k4hg00000gn/T//cchuMtAU.o': can't open to read symbols: No such file or directory.
(no debugging symbols found)...done.
"/cores/core.1176": no core file handler recognizes format
Run Code Online (Sandbox Code Playgroud)
我用谷歌搜索,发现有人建议使用LLDB而不是GDB.
是否可以使用GDB来调试核心文件?是因为GDB不支持优胜美地的二进制格式?
Adr*_*ian 14
基于长期GDB开发人员关于此问题的讨论主题,似乎Apple没有将他们的更改合并回官方GNU主线,而是选择在他们自己的网站上发布修改后的源代码.因此,Homebrew GDB安装(使用库存GDB源)无法加载OS X核心文件.
在这一点上,我看到三个选择:
屈服并学习LLDB.有一个GDB到LLDB的备忘单可以提供帮助.
从MacPorts安装Apple的自定义GDB.我一直在抛弃MacPorts,所以我无法测试它,但是如果你安装了MacPorts,请尝试以下方法:
$ sudo port install gdb-apple
$ codesign -s <your_GDB_cert_id> /opt/local/bin/gdb-apple
$ /opt/local/bin/gdb-apple ./list_test /cores/core.1176
Run Code Online (Sandbox Code Playgroud)翻译MacPorts的GDB补丁并将规范构建为Homebrew公式.这在理论上是可行的,但我没有时间亲自去做.
就个人而言,我选择只学习LLDB.Apple已经永久性地转移到了LLVM,因此旧的修补GDB停止使用最新和最强大的Xcode工具可能只是时间问题.
| 归档时间: |
|
| 查看次数: |
5423 次 |
| 最近记录: |