我想通过eclipse-cdt或emacs来调试我的程序。但是,现在它们都失败了,因为gdb在Yosemite中还没有得到认证。
我的gdb安装状态是这里。我通过home-brew安装了gdb。
dplee@dpleeui-MacBook-Pro ~/w/fish-shell> uname -a
Darwin dpleeui-MacBook-Pro.local 14.4.0 Darwin Kernel Version 14.4.0:
Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
dplee@dpleeui-MacBook-Pro ~/w/fish-shell> gdb --version
GNU gdb (GDB) 7.9.1
Copyright (C) 2015 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.3.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".如果我执行gdb,我仍然会遇到相同的错误消息,如下所示。
(gdb) b main
Breakpoint 1 at 0x10020b9a9: file fish.cpp, line 512.
(gdb) r
Starting program: /Users/dplee/work/fish-shell/fish
Unable to find Mach task port for process-id 719: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))
(gdb) 我遵循了这些指导原则,但是我不能重新启动任务门控,因为它的进程id是0。
https://sourceware.org/gdb/wiki/BuildingOnDarwin
https://stackoverflow.com/questions/11504377
dplee@dpleeui-MacBook-Pro ~/w/fish-shell> ps -ef| grep taskgate
0 91 1 0 4:28PM ?? 0:01.08 /usr/libexec/taskgated -s
501 826 350 0 5:04PM ttys000 0:00.00 grep taskgate有没有人已经解决了这个问题,并且正在使用eclipse和emacs的gdb调试功能?我非常喜欢在MacOS中使用带有emacs的gdb。
发布于 2015-08-11 20:31:41
我在MacOS Yosemite找到了关于eclipse和gdb的答案here。
简而言之,gdb团队几乎停止了在os x中更新gdb,只支持lldb。许多c++开发人员在这个问题上遇到了麻烦。他们中的一些人正在迁移到Xcode,但他们说它不像eclipse-cdt那样好。
如果您仍然希望使用eclipse作为调试器,有一种方法可以尝试。以下是Jim Knarf的评论。(See Comment #23)
You need to download GDB source code from http://www.gnu.org/software/gdb/download/
Then after building it, you will need to "sign" the application with appropriate certificate, and reboot the system before you can use it. See https://sourceware.org/gdb/wiki/BuildingOnDarwin about how to use 'codesign' and 'task gated' commands.
Here are the steps you need to take:
1. download gdb source code
2. become root (su command)
3. build the application using configure, make, and make install commands
4. put the new gdb application to /usr/local/bin
5. vi /System/Library/LaunchDaemons/com.apple.taskgated.plist
change option -s to -sp
and save the file
6. spctl --master-disable
7. create 'gdb-cert' certificate in System using Keychain Access application
8. codesign -s gdb-cert `which gdb`
9. restart the computer.
Now you can use gdb as a standalone debugger or use it in Eclipse.发布于 2015-08-11 20:36:30
如果你想在eclipse中使用lldb,这可以是你的另一个选择。https://github.com/freedib/lldbmi2
https://stackoverflow.com/questions/31940832
复制相似问题