我试图编译一个7.x版本的gdb而没有任何运气。 我对可执行文件进行了编码(http://sourceware.org/gdb/wiki/BuildingOnDarwin)。
以下版本存在这些问题。
7.5,7.4,git clone:我的应用程序的未知加载命令0x2a(和其他)以及启动gbd时的不同系统库。当试图打印矢量时,我总是得到: 找不到“main(int,char **)”
的框架基础7.3(macports和gdb-website):启动应用程序时,它无法设置断点并继续运行。
(gdb) start
Temporary breakpoint 1 at 0x100000950: file ../src/main.cpp, line 15.
Starting program: [...]
BFD: unable to read unknown load command 0x24
BFD: unable to read unknown load command 0x2a
BFD: unable to read unknown load command 0x26
Error in re-setting breakpoint 1: Cannot access memory at address 0x100000950
[application continues]
我使用系统llvm-gcc,gcc4.7和svn-gcc4.8进行编译。 有没有人成功在Mountain Lion上安装gdb?
答案 0 :(得分:11)
我在山狮上安装了gdb 7.5而没有问题...
这些步骤可能会对您有所帮助:./ configure --prefix = / usr / local --enable-targets = x86_64-apple-darwin10 --enable-64-bit-bfd --disable-werror --build = x86_64-apple-darwin10 --host = x86_64-apple-darwin10 --target = x86_64-apple -darwin10
然后make install gdb。
创建您自己的证书,如此处所述并签署gdb http://sourceware.org/gdb/wiki/BuildingOnDarwin
您必须明确声明:codesign -s gdb-cert / usr / local / gdb 在签署gdb之前,请确保已经设置了证书 信任。在签署你的gdb之前也要关闭钥匙串。
希望这也适用于您的
答案 1 :(得分:5)
我按照此处尝试的步骤解决了此问题:http://coding.derkeiler.com/Archive/Ada/comp.lang.ada/2012-09/msg00305.html
步骤
其他链接:
答案 2 :(得分:2)
它似乎对我不起作用...与默认的自制设置相同的问题
v1:src zeph$ brew install gdb
==> Downloading http://ftpmirror.gnu.org/gdb/gdb-7.5.tar.bz2
Already downloaded: /Library/Caches/Homebrew/gdb-7.5.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/gdb/7.5 --with-python=/usr --with-system-readline --enable-targets=x86_64-apple-darwin10 --enable-64-bit-bfd --disable-werror --build=x86_64-apple-darwin10 --hos
==> make
==> make install
==> Caveats
gdb requires special privileges to access Mach ports.
You will need to codesign the binary. For instructions, see:
http://sourceware.org/gdb/wiki/BuildingOnDarwin
==> Summary
/usr/local/Cellar/gdb/7.5: 62 files, 9.3M, built in 119 seconds
v1:src zeph$ codesign -s gdb-cert /usr/local/Cellar/gdb/7.5/bin/gdb
v1:src zeph$ /usr/local/Cellar/gdb/7.5/bin/gdb --args /Users/zeph/tmp/CouchBase/src/install/bin/memcached -d -u root -P /tmp/0libmemcached_memc.pid -t 1 -p 11221 -U 11221 -m 128
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-darwin10".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
BFD: /Users/zeph/tmp/CouchBase/src/install/bin/memcached: unknown load command 0x29
BFD: /Users/zeph/tmp/CouchBase/src/install/bin/memcached: unknown load command 0x29
Reading symbols from /Users/zeph/tmp/CouchBase/src/install/bin/memcached...done.
(gdb) run
Starting program: /Users/zeph/tmp/CouchBase/src/install/bin/memcached -d -u root -P /tmp/0libmemcached_memc.pid -t 1 -p 11221 -U 11221 -m 128
Unable to find Mach task port for process-id 28755: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))
(gdb)
k,在全面获得全部证书之后,我不得不重新签名
codesign -fs gdb-cert /usr/local/Cellar/gdb/7.5/bin/gdb
答案 3 :(得分:2)
OP的问题有两个问题。关于签署可执行文件或修改taskgated并使用setgid procmod的内容已被涵盖。第二个问题是关于未知加载命令的警告。我也碰到了这个问题,经过一系列搜索后发现了以下补丁,修复了它: