Homebrew GDB can't open core file on Yosemite 10.10

后端 未结 1 719
甜味超标
甜味超标 2020-12-29 14:48

I installed GDB 7.8.1 and GCC 4.9 through Homebrew.

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

相关标签:
1条回答
  • 2020-12-29 15:06

    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. Give in and learn LLDB. There's a GDB to LLDB cheat sheet to help.

    2. 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
      
    3. 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.

    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.

    0 讨论(0)
提交回复
热议问题