0

我试图在 emacs 24.3 中编译 7.5 版本的 gdb,但出现未知的加载命令错误。

在此生产部署之前,相同的设置在 OSX 10.6.8 Snow Leopard 平台上运行。

遵循指南( http://sourceware.org/gdb/wiki/BuildingOnDarwin)后,我没有发现代码签名的可执行文件有任何问题。

但是每当我调试一个简单的温度转换程序时,总是出现以下错误:

Current directory is /Users/xyz/Documents/C++....../CPP_Programs_mac/Chap01/Conversion/
BFD: /Users/xyz/Documents/C++......./CPP_Programs_mac/Chap01/Conversion/main.out: unknown load command 0x2
BFD: /Users/xyz/Documents/C++...../CPP_Programs_mac/Chap01/Conversion/main.out: unknown load command 0x29
BFD: /Users/xyz/Documents/C++...../CPP_Programs_mac/Chap01/Conversion/main.out: unknown load command 0x2b
GNU gdb (GDB) 7.5
Copyright (C) 2012 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-darwin12.3.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
BFD: /Users/xyz/Documents/C++...../CPP_Programs_mac/Chap01/Conversion/main.out: unknown load command 0x2a
BFD: /Users/xyz/Documents/C++..../CPP_Programs_mac/Chap01/Conversion/main.out: unknown load command 0x28
BFD: /Users/xyz/Documents/C++..../CPP_Programs_mac/Chap01/Conversion/main.out: unknown load command 0x29
BFD: /Users/xyz/Documents/C++..../CPP_Programs_mac/Chap01/Conversion/main.out: unknown load command 0x2b
Reading symbols from /Users/xyz/Documents/C++.../CPP_Programs_mac/Chap01/Conversion/main.out...(no debugging symbols found)...done.
(gdb)              

即使有这些错误,我仍然可以“开始”(运行)它和另一个缓冲区来执行程序。然后gud画面出现很多错误:

BFD: /usr/lib/libstdc++.6.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/libstdc++.6.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/libSystem.B.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/libSystem.B.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/libc++abi.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/libc++abi.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libcache.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libcache.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libcommonCrypto.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libcommonCrypto.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libcompiler_rt.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libcompiler_rt.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libcopyfile.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libcopyfile.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libdispatch.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libdispatch.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libdnsinfo.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libdnsinfo.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libdyld.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libdyld.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libkeymgr.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libkeymgr.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/liblaunch.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/liblaunch.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libmacho.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libmacho.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libquarantine.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libquarantine.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libremovefile.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libremovefile.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libsystem_blocks.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libsystem_blocks.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libsystem_c.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libsystem_c.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libsystem_dnssd.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libsystem_dnssd.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libsystem_info.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libsystem_info.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libsystem_kernel.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libsystem_kernel.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libsystem_m.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libsystem_m.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libsystem_network.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libsystem_network.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libsystem_notify.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libsystem_notify.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libsystem_sandbox.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libsystem_sandbox.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libunc.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libunc.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libunwind.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libunwind.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libxpc.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libxpc.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/system/libcorecrypto.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/system/libcorecrypto.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/libobjc.A.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/libobjc.A.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/libauto.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/libauto.dylib(i386:x86-64): unknown load command 0x2b
BFD: /usr/lib/libc++.1.dylib(i386:x86-64): unknown load command 0x2a
BFD: /usr/lib/libc++.1.dylib(i386:x86-64): unknown load command 0x2b
(gdb)          

在终端中运行 gdb 有同样的错误。我非常努力地google,发现去年很多用户报告了这些错误。我想知道新版本的 gdb 是否解决了这些问题。

有没有人在山狮的 gdb 7.5 中取得成功?甚至根本尝试过gdb 7.6?

谢谢

4

1 回答 1

4

Mac OS X 上的二进制文件有一系列加载命令,动态链接器 (dyld) 的指令,关于如何加载/运行程序。它们以指示加载命令类型的字节开始。其中一些对于调试器理解正确运行至关重要,有些对于调试器并不重要。有一点表明它们被认为是“重要的”(LC_REQ_DYLD),但 gdb 会警告它无法识别的每个加载命令。0x2aLC_SOURCE_VERSION和 0x2b 是LC_DYLIB_CODE_SIGN_DRS,这些加载命令是 Mac OS X 10.8 aka Mountain Lion 的新命令。这对于调试器的正确操作都不重要。

当您安装了另一个正常工作的 gdb 时,可能有人更新了它知道的加载命令列表。

我强烈建议使用 Apple 支持的调试器 lldb。它在 Xcode 4.6 中已经相当成熟,您在 gdb 中经常使用的大多数命令都可以按原样工作,或者稍作修改,请参阅http://lldb.llvm.org/lldb-gdb.html

于 2013-05-03T08:39:35.540 回答