Homebrew GDB 无法在 Yosemite 10.10 上打开核心文件 [英] Homebrew GDB can't open core file on Yosemite 10.10

查看:23
本文介绍了Homebrew GDB 无法在 Yosemite 10.10 上打开核心文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过 Homebrew 安装了 GDB 7.8.1 和 GCC 4.9.

I installed GDB 7.8.1 and GCC 4.9 through Homebrew.

当我打开一个由 GCC 编译的 (gcc-4.9 -g xxx.c -o xxx) 程序生成的核心文件时,它会报告:

When I open a core file generated by a GCC-compiled (gcc-4.9 -g xxx.c -o xxx) program, it reports:

→  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

我搜索了一下,发现有人建议使用 LLDB 而不是 GDB.

I googled and found someone suggested to use LLDB instead of GDB.

是否可以使用 GDB 调试核心文件?是不是因为 GDB 不支持 Yosemite 上的二进制格式?

Is is possible to use GDB to debug the core file? And is it because GDB does not support the binary format on Yosemite?

推荐答案

基于长期的GDB开发者关于这个问题的讨论线程,苹果似乎没有将他们的更改合并回官方的 GNU 主线,而是选择在他们自己的网站上发布修改后的源代码.因此,Homebrew GDB 安装(使用库存 GDB 源)无法加载 OS X 核心文件.

Based on the long GDB developers' discussion thread on this issue, it seems Apple did not merge their changes back to the official GNU mainline, and instead chose to publish the modified source code on their own site. As a result, the Homebrew GDB install (which uses the stock GDB sources) can't load OS X core files.

此时,我看到了三个选择:

At this point, I see three choices:

  1. 学习 LLDB.GDB 到 LLDB 备忘单a> 提供帮助.

从 MacPorts 安装 Apple 的自定义 GDB. 我早就放弃了 MacPorts,所以无法测试它,但如果您安装了 MacPorts,请尝试以下操作:

Install Apple's custom GDB from MacPorts. I've long forsaken MacPorts, so I can't test it, but if you have MacPorts installed, try the following:

$ 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

  • 翻译 MacPorts 的 GDB 补丁并将规范构建成 Homebrew 公式.理论上可行,但我没有时间自己做.

  • Translate MacPorts' GDB patches and build spec into a Homebrew formula. It's theoretically possible, but I don't have the time to do it myself.

    就个人而言,我选择只学习 LLDB.Apple 已永久迁移到 LLVM,因此旧补丁 GDB 停止使用最新最好的 Xcode 工具可能只是时间问题.

    Personally, I've opted to just learn LLDB. Apple has moved permanently to LLVM, so it's probably just a matter of time before the old patched GDB stops working with the latest-and-greatest Xcode tools.

    这篇关于Homebrew GDB 无法在 Yosemite 10.10 上打开核心文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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